98 lines
3.8 KiB
C#
98 lines
3.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using dccdc.Models;
|
|
using Dapper;
|
|
|
|
namespace dccdc.DAL
|
|
{
|
|
public class BarCodeProjectMaintainDal
|
|
{
|
|
public List<BarCodeProjectMaintainModel> GetAllList(string id)
|
|
{
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|
{
|
|
string param = "";
|
|
if (id != "")
|
|
{
|
|
param = " and bar_code_maintain_id=@id";
|
|
}
|
|
return conn.Query<BarCodeProjectMaintainModel>("select * from bar_code_project_maintain where 1=1 " + param, new { @id = id}).ToList();
|
|
}
|
|
}
|
|
|
|
public bool Add(BarCodeProjectMaintainModel model)
|
|
{
|
|
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|
{
|
|
string sql = @"INSERT INTO [bar_code_project_maintain]
|
|
([code_name]
|
|
,[bar_code_maintain_id]
|
|
,[project]
|
|
,[exam_project_maintain_id]
|
|
,[project_code])
|
|
VALUES
|
|
(@code_name
|
|
,@bar_code_maintain_id
|
|
,@project
|
|
,@exam_project_maintain_id
|
|
,@project_code)";
|
|
return (conn.Execute(sql, model) != 0 ? true : false);
|
|
}
|
|
}
|
|
|
|
internal List<Models.BarCodeMaintainModel> getListByphysical_num(string id)
|
|
{
|
|
//throw new NotImplementedException();
|
|
string sql = @"select distinct d.* from dbo.professionalExam_project_result a join exam_project_maintain b on a.project_id=b.project_id
|
|
join bar_code_project_maintain c on c.exam_project_maintain_id=b.project_id join bar_code_maintain d
|
|
on d.id=c.bar_code_maintain_id
|
|
where person_id=@id and d.is_print='是'";
|
|
using (var conn = CommHelper.GetSqlConnection())
|
|
{
|
|
return conn.Query<BarCodeMaintainModel>(sql, new { id = id }).ToList();
|
|
}
|
|
}
|
|
|
|
public bool Update(BarCodeProjectMaintainModel model)
|
|
{
|
|
string sql = @"UPDATE [bar_code_project_maintain]
|
|
SET [code_name] = @code_name
|
|
,[project] = @project
|
|
WHERE id=@id
|
|
";
|
|
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|
{
|
|
return (conn.Execute(sql, model) != 0 ? true : false);
|
|
}
|
|
}
|
|
public bool del(BarCodeProjectMaintainModel model)
|
|
{
|
|
string sql = @"delete from [bar_code_project_maintain]
|
|
WHERE bar_code_maintain_id=@bar_code_maintain_id and exam_project_maintain_id=@exam_project_maintain_id
|
|
";
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|
{
|
|
return (conn.Execute(sql, new { bar_code_maintain_id=model.bar_code_maintain_id, exam_project_maintain_id=model.exam_project_maintain_id }) != 0 ? true : false);
|
|
}
|
|
}
|
|
internal List<Models.ExaminationProcessModel> getxzlitByphysical_num(string id1, int id2)
|
|
{
|
|
//throw new NotImplementedException();
|
|
string sql = @"select DISTINCT a.* from examination_process a join professionalExam_project_result b on a.person_id=b.person_id and a.exam_group_maintain_id=b.exam_group_maintain_id
|
|
join exam_project_maintain c on b.project_id = c.project_id
|
|
join bar_code_project_maintain d on c.project_id = d.project_code
|
|
where d.bar_code_maintain_id = @bid and a.person_id = @pid";
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|
{
|
|
return conn.Query<ExaminationProcessModel>(sql, new { pid = id1, bid = id2 }).ToList();
|
|
}
|
|
}
|
|
}
|
|
}
|