public ActionResult UpdateDataChiDinhKiemNghiem(KnChidinhXn objChidinh, KnDangkyXn objLuotkham, KnChidinhChitiet[] arrAssignDetails) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { log.Trace("BEGIN UPDATE................................................................."); if (objLuotkham == null) { objLuotkham = new Select().From(KnDangkyXn.Schema) .Where(KnDangkyXn.Columns.MaDangky).IsEqualTo(objChidinh.MaDangky) .And(KnDangkyXn.Columns.IdKhachhang).IsEqualTo( Utility.Int32Dbnull(objChidinh.IdKhachhang)).ExecuteSingle <KnDangkyXn>(); } objChidinh.NgaySua = globalVariables.SysDate; objChidinh.NguoiSua = globalVariables.UserName; objChidinh.MarkOld(); objChidinh.Save(); //SPs.SpKcbCapnhatChidinh(objChidinh.IdChidinh, objChidinh.NgayChidinh, objChidinh.IdBacsiChidinh, objChidinh.IdPhongChidinh, objChidinh.NguoiSua // , objChidinh.NgaySua, objChidinh.MaChidinh, objChidinh.IpMaysua, objChidinh.TenMaysua, objChidinh.NguoigiaoMau // , objChidinh.NguoinhanMau, objChidinh.MotaThem, objChidinh.LastActionName).Execute(); log.Trace("1. Da cap nhat chi dinh dich vu CLS"); //if (Utility.Int32Dbnull(objChidinh.IdKham) > 0) //{ // SPs.SpKcbCapnhatBacsiKham(objChidinh.IdKham, objChidinh.IdBacsiChidinh, 1).Execute(); //} log.Info("Cap nhap lai thong tin cua phieu chi dinh voi Id_chidinh=" + objChidinh.IdChidinh); foreach (var knChidinhChitiet in arrAssignDetails) { if (knChidinhChitiet.IdChidinhChitiet <= 0) { knChidinhChitiet.NgayTao = globalVariables.SysDate; knChidinhChitiet.NguoiTao = globalVariables.UserName; knChidinhChitiet.IsNew = true; knChidinhChitiet.Save(); } else { knChidinhChitiet.NgaySua = globalVariables.SysDate; knChidinhChitiet.NguoiSua = globalVariables.UserName; knChidinhChitiet.MarkOld(); knChidinhChitiet.Save(); } } // InsertAssignDetail(objChidinh, objLuotkham, arrAssignDetails); log.Trace("1. Da cap nhat chi tiet chi dinh dich vu CLS"); } scope.Complete(); log.Trace("END UPDATE................................................................."); return(ActionResult.Success); } } catch (Exception exception) { log.InfoException("Loi thong tin ", exception); return(ActionResult.Error); } finally { GC.Collect(); } }
public ActionResult InsertDataChiDinhKn(KnChidinhXn objChidinh, KnDangkyXn objLuotkham, KnChidinhChitiet[] arrAssignDetails) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { if (objChidinh != null) { log.Trace("BEGIN INSERTING.........................................................."); if (objLuotkham == null) { log.Trace("Lieu co the vao day duoc khong.........................................................."); objLuotkham = new Select().From(KnDangkyXn.Schema) .Where(KnDangkyXn.Columns.MaDangky).IsEqualTo(objChidinh.MaDangky) .And(KnDangkyXn.Columns.IdKhachhang).IsEqualTo( Utility.Int32Dbnull(objChidinh.IdKhachhang)).ExecuteSingle <KnDangkyXn>(); } if (objLuotkham != null) { log.Trace("0.1. Bat dau sinh code"); objChidinh.MaChidinh = THU_VIEN_CHUNG.SinhMaChidinhKiemNghiem(); log.Trace("0.2. Bat dau them moi chi dinh CLS"); objChidinh.NgayTao = globalVariables.SysDate; objChidinh.NguoiTao = globalVariables.UserName; objChidinh.IsNew = true; objChidinh.Save(); log.Trace("0.3 Da thuc hien xong cau SP"); log.Trace("1. Da them moi chi dinh CLS"); foreach (var knChidinhChitiet in arrAssignDetails) { if (knChidinhChitiet.IdChidinhChitiet <= 0) { log.Info("1.2 Bat dau them moi Id_chidinh=" + objChidinh.IdChidinh + "timeprocess in : " + globalVariables.SysDate.ToString()); var sp = SPs.KnThemmoiChitietChidinh(knChidinhChitiet.IdChidinhChitiet, objChidinh.IdChidinh, objChidinh.MaChidinh, knChidinhChitiet.IdDichvu , knChidinhChitiet.IdChitietdichvu, knChidinhChitiet.DonGia, knChidinhChitiet.PhuThu, knChidinhChitiet.SoLuong, knChidinhChitiet.Donvi, knChidinhChitiet.PpKiemnghiem, knChidinhChitiet.Qcvn, knChidinhChitiet.ThanhTien, knChidinhChitiet.NgayNhapmau, knChidinhChitiet.Ketqua, knChidinhChitiet.NgaynhapKetqua, knChidinhChitiet.NguoinhapKq, knChidinhChitiet.TrangthaiThanhtoan, Utility.ByteDbnull(knChidinhChitiet.TrangThai), knChidinhChitiet.ChitieuPhantich, knChidinhChitiet.MahoaMau, knChidinhChitiet.NguoiTao, knChidinhChitiet.NgayTao, knChidinhChitiet.NguoiSua, knChidinhChitiet.NgaySua, knChidinhChitiet.IpMaytao, knChidinhChitiet.IpMaysua); sp.Execute(); knChidinhChitiet.IdChidinhChitiet = Utility.Int64Dbnull(sp.OutputValues[0]); knChidinhChitiet.MahoaMau = Utility.sDbnull(sp.OutputValues[1]); log.Info("1.3 ket thuc them moi Id_chidinh=" + objChidinh.IdChidinh + "timeprocess out: " + globalVariables.SysDate.ToString()); } } log.Trace("2. Da them moi chi tiet chi dinh CLS"); } else { return(ActionResult.Error); } } } scope.Complete(); log.Trace("FINISH INSERTING.........................................................."); return(ActionResult.Success); } } catch (Exception exception) { log.Error(string.Format("Loi khi them moi chi dinh dich vu CLS {0}", exception.Message)); return(ActionResult.Error); } finally { GC.Collect(); } }
public bool Destroy(object IdChidinh) { return(KnChidinhXn.Destroy(IdChidinh) == 1); }
public void Insert(long IdKhachhang, string MaDangky, DateTime NgayChidinh, short?TrangThai, short?TrangthaiThanhtoan, DateTime?NgayThanhtoan, string Barcode, string MaBenhpham, string MaChidinh, byte?UuTien, string MotaMau, string NguoigiaoMau, string NguoinhanMau, DateTime?NgaygiaoMau, string TinhtrangMau, byte?SosanhQcvn, decimal?LuongmauThetich, decimal?LuongmauHoaly, string NguoinhanHoaly, decimal?LuongmauVisinh, string NguoinhanVisinh, byte?DagiaoMau, byte?LuuMau, string DkLuumau, DateTime?NgayluuMau, byte?ThanhlyMau, string NguoiThanhly, DateTime?NgayThanhly, string MotaThem, DateTime?NgayhenTrakq, string NguoiTrakq, DateTime?NgayTrakq, byte?TrangthaiIn, string NguoiTao, DateTime?NgayTao, string IpMaytao, string NguoiSua, DateTime?NgaySua, string IpMaysua, string LastAction, decimal?LuongmauThauphu, string NguoinhanThauphu, string NguoigiaoVisinh, string NguoigiaoHoaly, string NguoigiaoThauphu) { KnChidinhXn item = new KnChidinhXn(); item.IdKhachhang = IdKhachhang; item.MaDangky = MaDangky; item.NgayChidinh = NgayChidinh; item.TrangThai = TrangThai; item.TrangthaiThanhtoan = TrangthaiThanhtoan; item.NgayThanhtoan = NgayThanhtoan; item.Barcode = Barcode; item.MaBenhpham = MaBenhpham; item.MaChidinh = MaChidinh; item.UuTien = UuTien; item.MotaMau = MotaMau; item.NguoigiaoMau = NguoigiaoMau; item.NguoinhanMau = NguoinhanMau; item.NgaygiaoMau = NgaygiaoMau; item.TinhtrangMau = TinhtrangMau; item.SosanhQcvn = SosanhQcvn; item.LuongmauThetich = LuongmauThetich; item.LuongmauHoaly = LuongmauHoaly; item.NguoinhanHoaly = NguoinhanHoaly; item.LuongmauVisinh = LuongmauVisinh; item.NguoinhanVisinh = NguoinhanVisinh; item.DagiaoMau = DagiaoMau; item.LuuMau = LuuMau; item.DkLuumau = DkLuumau; item.NgayluuMau = NgayluuMau; item.ThanhlyMau = ThanhlyMau; item.NguoiThanhly = NguoiThanhly; item.NgayThanhly = NgayThanhly; item.MotaThem = MotaThem; item.NgayhenTrakq = NgayhenTrakq; item.NguoiTrakq = NguoiTrakq; item.NgayTrakq = NgayTrakq; item.TrangthaiIn = TrangthaiIn; item.NguoiTao = NguoiTao; item.NgayTao = NgayTao; item.IpMaytao = IpMaytao; item.NguoiSua = NguoiSua; item.NgaySua = NgaySua; item.IpMaysua = IpMaysua; item.LastAction = LastAction; item.LuongmauThauphu = LuongmauThauphu; item.NguoinhanThauphu = NguoinhanThauphu; item.NguoigiaoVisinh = NguoigiaoVisinh; item.NguoigiaoHoaly = NguoigiaoHoaly; item.NguoigiaoThauphu = NguoigiaoThauphu; item.Save(UserName); }
public bool Delete(object IdChidinh) { return(KnChidinhXn.Delete(IdChidinh) == 1); }