public ActionResult ThemnhomChidinhCLS(DmucNhomcanlamsang objNhom, List <DmucNhomcanlamsangChitiet> lstChitiet) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { if (objNhom != null) { objNhom.IsNew = true; objNhom.Save(); foreach (DmucNhomcanlamsangChitiet objChitiet in lstChitiet) { objChitiet.IdNhom = objNhom.Id; if (Utility.Int32Dbnull(objChitiet.SoLuong) <= 0) { objChitiet.SoLuong = 1; } if (objChitiet.IdChitiet <= 0) { objChitiet.IsNew = true; objChitiet.Save(); } else { objChitiet.MarkOld(); objChitiet.IsNew = false; objChitiet.Save(); } } } } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { return(ActionResult.Error); } }
public ActionResult CapnhatnhomchidinhCLS(DmucNhomcanlamsang objNhom, List<DmucNhomcanlamsangChitiet> lstChitiet) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { objNhom.Save(); foreach (DmucNhomcanlamsangChitiet objChitiet in lstChitiet) { objChitiet.IdNhom = objNhom.Id; if (Utility.Int32Dbnull(objChitiet.SoLuong) <= 0) objChitiet.SoLuong = 1; if (objChitiet.IdChitiet <= 0) { objChitiet.IsNew = true; objChitiet.Save(); } else { objChitiet.MarkOld(); objChitiet.IsNew = false; objChitiet.Save(); } } } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.InfoException("Loi thong tin ", exception); return ActionResult.Error; } }
private void CapnhatNhom(DmucNhomcanlamsang objDmucNhomcanlamsangs) { DataRow[] arrDr = m_dtNhom.Select(DmucNhomcanlamsang.Columns.Id + "=" + objDmucNhomcanlamsangs.Id); if (arrDr.Length > 0) { arrDr[0][DmucNhomcanlamsang.Columns.MaNhom] = objDmucNhomcanlamsangs.MaNhom; arrDr[0][DmucNhomcanlamsang.Columns.TenNhom] = objDmucNhomcanlamsangs.TenNhom; arrDr[0][DmucNhomcanlamsang.Columns.MaLoainhom] = objDmucNhomcanlamsangs.MaLoainhom; arrDr[0][DmucNhomcanlamsang.Columns.MotaThem] = objDmucNhomcanlamsangs.MotaThem; arrDr[0]["ten_loainhom"] = txtLoainhom.Text; arrDr[0][DmucNhomcanlamsang.Columns.NguoiSua] = objDmucNhomcanlamsangs.NguoiSua; arrDr[0][DmucNhomcanlamsang.Columns.NgaySua] = objDmucNhomcanlamsangs.NgaySua; m_dtNhom.AcceptChanges(); } }
private void Themmoinhom(DmucNhomcanlamsang objDmucNhomcanlamsangs) { DataRow dr = m_dtNhom.NewRow(); dr[DmucNhomcanlamsang.Columns.Id] = objDmucNhomcanlamsangs.Id; dr[DmucNhomcanlamsang.Columns.MaNhom] = objDmucNhomcanlamsangs.MaNhom; dr[DmucNhomcanlamsang.Columns.TenNhom] = objDmucNhomcanlamsangs.TenNhom; dr[DmucNhomcanlamsang.Columns.MaLoainhom] = objDmucNhomcanlamsangs.MaLoainhom; dr[DmucNhomcanlamsang.Columns.MotaThem] = objDmucNhomcanlamsangs.MotaThem; dr["ten_loainhom"] = txtLoainhom.Text; dr[DmucNhomcanlamsang.Columns.NguoiTao] = objDmucNhomcanlamsangs.NguoiTao; dr[DmucNhomcanlamsang.Columns.NgayTao] = objDmucNhomcanlamsangs.NgayTao; m_dtNhom.Rows.Add(dr); }
/// <summary> /// hàm thực hiện việc khởi tạo thông tin của phiếu chỉ định cận lâm sàng /// </summary> /// <returns></returns> private DmucNhomcanlamsang TaoDmucNhomcanlamsang() { DmucNhomcanlamsang objDmucNhomcanlamsangs = new DmucNhomcanlamsang(); if (m_eAction == action.Insert) { objDmucNhomcanlamsangs = new DmucNhomcanlamsang(); objDmucNhomcanlamsangs.IsNew = true; objDmucNhomcanlamsangs.NguoiTao = globalVariables.UserName; objDmucNhomcanlamsangs.NgayTao = globalVariables.SysDate; } else { objDmucNhomcanlamsangs = DmucNhomcanlamsang.FetchByID(Utility.Int16Dbnull(txtId.Text,-1)); objDmucNhomcanlamsangs.IsNew = false; objDmucNhomcanlamsangs.MarkOld(); objDmucNhomcanlamsangs.IsLoaded = true; objDmucNhomcanlamsangs.NguoiSua = globalVariables.UserName; objDmucNhomcanlamsangs.NgaySua= globalVariables.SysDate; } objDmucNhomcanlamsangs.MaNhom = Utility.DoTrim(txtManhom.Text); objDmucNhomcanlamsangs.TenNhom = Utility.DoTrim(txtTennhom.Text); objDmucNhomcanlamsangs.MaLoainhom = Utility.DoTrim(txtLoainhom.myCode); objDmucNhomcanlamsangs.MotaThem = Utility.DoTrim(txtMotathem.Text); return objDmucNhomcanlamsangs; }
public void Insert(string MaNhom,string TenNhom,string MotaThem,string NguoiTao,DateTime NgayTao,string NguoiSua,DateTime? NgaySua,string MaLoainhom) { DmucNhomcanlamsang item = new DmucNhomcanlamsang(); item.MaNhom = MaNhom; item.TenNhom = TenNhom; item.MotaThem = MotaThem; item.NguoiTao = NguoiTao; item.NgayTao = NgayTao; item.NguoiSua = NguoiSua; item.NgaySua = NgaySua; item.MaLoainhom = MaLoainhom; item.Save(UserName); }
public void Update(short Id,string MaNhom,string TenNhom,string MotaThem,string NguoiTao,DateTime NgayTao,string NguoiSua,DateTime? NgaySua,string MaLoainhom) { DmucNhomcanlamsang item = new DmucNhomcanlamsang(); item.MarkOld(); item.IsLoaded = true; item.Id = Id; item.MaNhom = MaNhom; item.TenNhom = TenNhom; item.MotaThem = MotaThem; item.NguoiTao = NguoiTao; item.NgayTao = NgayTao; item.NguoiSua = NguoiSua; item.NgaySua = NgaySua; item.MaLoainhom = MaLoainhom; item.Save(UserName); }