public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { //if(Convert.ToDateTime(objTreatment.NgayLapPhieu)) SqlQuery sqlQuery = new Select().From(NoitruPhieudieutri.Schema) .Where(NoitruPhieudieutri.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri); if (sqlQuery.GetRecordCount() <= 0) { objTreatment.NgaySua = null; objTreatment.NguoiSua = string.Empty; objTreatment.IsNew = true; objTreatment.Save(); } else { objTreatment.TenMaysua = globalVariables.gv_strComputerName; objTreatment.IpMaysua = globalVariables.gv_strIPAddress; objTreatment.NgaySua = DateTime.Now; objTreatment.NguoiSua = globalVariables.UserName; objTreatment.MarkOld(); objTreatment.IsNew = false; objTreatment.IsLoaded = true; objTreatment.Save(); new Update(KcbChidinhcl.Schema) .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri) .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri) .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); } new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute(); } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString()); return(ActionResult.Error); } }
public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { if (objTreatment.IdPhieudieutri <= 0) { objTreatment.NgaySua = null; objTreatment.NguoiSua = string.Empty; objTreatment.IsNew = true; objTreatment.Save(); } else { objTreatment.MarkOld(); objTreatment.IsNew = false; objTreatment.IsLoaded = true; objTreatment.Save(); new Update(KcbChidinhcl.Schema) .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri) .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri) .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); } new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute(); } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString()); return(ActionResult.Error); } }
public void Insert(string MaLuotkham,int? IdBenhnhan,short? IdBacsi,int? IdBuongGiuong,long? IdBuong,long? IdGiuong,short? IdKhoanoitru,string Thu,string ThongtinTheodoi,string ThongtinDieutri,DateTime? NgayDieutri,string GioDieutri,byte? TthaiBosung,byte? TthaiIn,byte? TrangThai,int? IdGoi,byte? TrongGoi,DateTime? NgayTao,string NguoiTao,DateTime? NgaySua,string NguoiSua,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua) { NoitruPhieudieutri item = new NoitruPhieudieutri(); item.MaLuotkham = MaLuotkham; item.IdBenhnhan = IdBenhnhan; item.IdBacsi = IdBacsi; item.IdBuongGiuong = IdBuongGiuong; item.IdBuong = IdBuong; item.IdGiuong = IdGiuong; item.IdKhoanoitru = IdKhoanoitru; item.Thu = Thu; item.ThongtinTheodoi = ThongtinTheodoi; item.ThongtinDieutri = ThongtinDieutri; item.NgayDieutri = NgayDieutri; item.GioDieutri = GioDieutri; item.TthaiBosung = TthaiBosung; item.TthaiIn = TthaiIn; item.TrangThai = TrangThai; item.IdGoi = IdGoi; item.TrongGoi = TrongGoi; item.NgayTao = NgayTao; item.NguoiTao = NguoiTao; item.NgaySua = NgaySua; item.NguoiSua = NguoiSua; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.Save(UserName); }
public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { if (objTreatment.IdPhieudieutri<=0) { objTreatment.NgaySua = null; objTreatment.NguoiSua = string.Empty; objTreatment.IsNew = true; objTreatment.Save(); } else { objTreatment.MarkOld(); objTreatment.IsNew = false; objTreatment.IsLoaded = true; objTreatment.Save(); new Update(KcbChidinhcl.Schema) .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri) .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri) .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); } new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute(); } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString()); return ActionResult.Error; } }
public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment) { try { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { //if(Convert.ToDateTime(objTreatment.NgayLapPhieu)) SqlQuery sqlQuery = new Select().From(NoitruPhieudieutri.Schema) .Where(NoitruPhieudieutri.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri); if (sqlQuery.GetRecordCount() <= 0) { objTreatment.NgaySua = null; objTreatment.NguoiSua = string.Empty; objTreatment.IsNew = true; objTreatment.Save(); } else { objTreatment.TenMaysua = globalVariables.gv_strComputerName; objTreatment.IpMaysua = globalVariables.gv_strIPAddress; objTreatment.NgaySua = DateTime.Now; objTreatment.NguoiSua = globalVariables.UserName; objTreatment.MarkOld(); objTreatment.IsNew = false; objTreatment.IsLoaded = true; objTreatment.Save(); new Update(KcbChidinhcl.Schema) .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri) .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); new Update(KcbDonthuoc.Schema) .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri) .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute(); } new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2) .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute(); } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString()); return ActionResult.Error; } }