/// <summary> /// hàm thực hiện việc cập nhập thông tin nhập kho thuốc /// </summary> /// <param name="objPhieuNhap"></param> /// <param name="arrPhieuNhapCts"></param> /// <returns></returns> public ActionResult UpdatePhieuTraLaiKho(TPhieutrathuocKholeVekhochan objPhieuNhap, TPhieutrathuocKholeVekhochanChitiet[] arrPhieuNhapCts) { try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { objPhieuNhap.NgaySua = globalVariables.SysDate; objPhieuNhap.NguoiSua = globalVariables.UserName; objPhieuNhap.MarkOld(); objPhieuNhap.IsNew = false; objPhieuNhap.Save(); new Delete().From(TPhieutrathuocKholeVekhochanChitiet.Schema) .Where(TPhieutrathuocKholeVekhochanChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute(); foreach (TPhieutrathuocKholeVekhochanChitiet objPhieuNhapTraCt in arrPhieuNhapCts) { objPhieuNhapTraCt.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapTraCt.GiaNhap) * Utility.Int32Dbnull(objPhieuNhapTraCt.SoLuong); objPhieuNhapTraCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1); objPhieuNhapTraCt.IsNew = true; objPhieuNhapTraCt.Save(); } } Scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error("Loi trong qua trinh sua phieu nhap kho :{0}", exception); return(ActionResult.Error); } }
private TPhieutrathuocKholeVekhochan CreatePhieuNhapKho() { TPhieutrathuocKholeVekhochan objPhieuNhapTra = new TPhieutrathuocKholeVekhochan(); if (em_Action == action.Update) { objPhieuNhapTra.MarkOld(); objPhieuNhapTra.IsLoaded = true; objPhieuNhapTra.IdPhieu = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1); objPhieuNhapTra.NguoiSua = globalVariables.UserName; objPhieuNhapTra.NgaySua = globalVariables.SysDate; } objPhieuNhapTra.IdKhoatra = (short)globalVariables.IdKhoaNhanvien; objPhieuNhapTra.IdKhonhan = Utility.Int16Dbnull(cboKhoLinh.SelectedValue, -1); objPhieuNhapTra.IdKhotra = Utility.Int16Dbnull(cboKhoTra.SelectedValue, -1); objPhieuNhapTra.MaNhacungcap = "-1"; objPhieuNhapTra.TrangThai = 0; objPhieuNhapTra.MotaThem = txtLydotra.Text; objPhieuNhapTra.IdNhanvien = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1); if (Utility.Int32Dbnull(objPhieuNhapTra.IdNhanvien, -1) <= 0) { objPhieuNhapTra.IdNhanvien = globalVariables.gv_intIDNhanvien; } objPhieuNhapTra.NgayTra = dtNgayNhap.Value; objPhieuNhapTra.NgayTao = globalVariables.SysDate; objPhieuNhapTra.NguoiTao = globalVariables.UserName; objPhieuNhapTra.LoaiPhieu = (byte?)LoaiPhieu.PhieuNhapTraLaiKhoLeVeKhoChan; objPhieuNhapTra.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuNhapTraLaiKhoLeVeKhoChan); objPhieuNhapTra.KieuThuocvattu = KIEU_THUOC_VT; return(objPhieuNhapTra); }
private TPhieutrathuocKholeVekhochan CreatePhieuNhapKho() { TPhieutrathuocKholeVekhochan objPhieuNhapTra = new TPhieutrathuocKholeVekhochan(); if (em_Action == action.Update) { objPhieuNhapTra.MarkOld(); objPhieuNhapTra.IsLoaded = true; objPhieuNhapTra.IdPhieu = Utility.Int32Dbnull(txtIDPhieuNhapKho.Text, -1); objPhieuNhapTra.NguoiSua = globalVariables.UserName; objPhieuNhapTra.NgaySua = globalVariables.SysDate; } objPhieuNhapTra.IdKhoatra = (short)globalVariables.IdKhoaNhanvien; objPhieuNhapTra.IdKhonhan = Utility.Int16Dbnull(cboKhoLinh.SelectedValue, -1); objPhieuNhapTra.IdKhotra = Utility.Int16Dbnull(cboKhoTra.SelectedValue, -1); objPhieuNhapTra.MaNhacungcap = "-1"; objPhieuNhapTra.TrangThai = 0; objPhieuNhapTra.MotaThem = txtLydotra.Text; objPhieuNhapTra.IdNhanvien = Utility.Int16Dbnull(cboNhanVien.SelectedValue, -1); if (Utility.Int32Dbnull(objPhieuNhapTra.IdNhanvien, -1) <= 0) objPhieuNhapTra.IdNhanvien = globalVariables.gv_intIDNhanvien; objPhieuNhapTra.NgayTra = dtNgayNhap.Value; objPhieuNhapTra.NgayTao = globalVariables.SysDate; objPhieuNhapTra.NguoiTao = globalVariables.UserName; objPhieuNhapTra.LoaiPhieu = (byte?)LoaiPhieu.PhieuNhapTraLaiKhoLeVeKhoChan; objPhieuNhapTra.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuNhapTraLaiKhoLeVeKhoChan); objPhieuNhapTra.KieuThuocvattu = KIEU_THUOC_VT; return objPhieuNhapTra; }
/// <summary> /// hàm thực hiện việc cập nhập thông tin nhập kho thuốc /// </summary> /// <param name="objPhieuNhap"></param> /// <param name="arrPhieuNhapCts"></param> /// <returns></returns> public ActionResult UpdatePhieuTraLaiKho(TPhieutrathuocKholeVekhochan objPhieuNhap, TPhieutrathuocKholeVekhochanChitiet[] arrPhieuNhapCts) { try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { objPhieuNhap.NgaySua = globalVariables.SysDate; objPhieuNhap.NguoiSua = globalVariables.UserName; objPhieuNhap.MarkOld(); objPhieuNhap.IsNew = false; objPhieuNhap.Save(); new Delete().From(TPhieutrathuocKholeVekhochanChitiet.Schema) .Where(TPhieutrathuocKholeVekhochanChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute(); foreach (TPhieutrathuocKholeVekhochanChitiet objPhieuNhapTraCt in arrPhieuNhapCts) { objPhieuNhapTraCt.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapTraCt.GiaNhap)* Utility.Int32Dbnull(objPhieuNhapTraCt.SoLuong); objPhieuNhapTraCt.IdPhieu = Utility.Int32Dbnull(objPhieuNhap.IdPhieu, -1); objPhieuNhapTraCt.IsNew = true; objPhieuNhapTraCt.Save(); } } Scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("Loi trong qua trinh sua phieu nhap kho :{0}", exception); return ActionResult.Error; } }
public void Update(long IdPhieu,string MaPhieu,DateTime? NgayTra,short? IdNhanvien,short? IdKhotra,short? IdKhoatra,short? IdKhonhan,short? IdKhoaThuchien,string NguoiTao,DateTime? NgayTao,string MaNhacungcap,byte? LoaiPhieu,string TenLoaiphieu,byte? TrangThai,DateTime? NgaySua,string NguoiSua,string NguoiXacnhan,DateTime? NgayXacnhan,string KieuThuocvattu,string MotaThem) { TPhieutrathuocKholeVekhochan item = new TPhieutrathuocKholeVekhochan(); item.MarkOld(); item.IsLoaded = true; item.IdPhieu = IdPhieu; item.MaPhieu = MaPhieu; item.NgayTra = NgayTra; item.IdNhanvien = IdNhanvien; item.IdKhotra = IdKhotra; item.IdKhoatra = IdKhoatra; item.IdKhonhan = IdKhonhan; item.IdKhoaThuchien = IdKhoaThuchien; item.NguoiTao = NguoiTao; item.NgayTao = NgayTao; item.MaNhacungcap = MaNhacungcap; item.LoaiPhieu = LoaiPhieu; item.TenLoaiphieu = TenLoaiphieu; item.TrangThai = TrangThai; item.NgaySua = NgaySua; item.NguoiSua = NguoiSua; item.NguoiXacnhan = NguoiXacnhan; item.NgayXacnhan = NgayXacnhan; item.KieuThuocvattu = KieuThuocvattu; item.MotaThem = MotaThem; item.Save(UserName); }