/// <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); } }
/// <summary> /// hàm thực hiện việc thêm phiếu nhập kho thuốc /// </summary> /// <param name="objPhieuNhap"></param> /// <param name="arrPhieuNhapCts"></param> /// <returns></returns> public ActionResult ThemPhieuTraLaiKho(TPhieutrathuocKholeVekhochan objPhieuNhap, TPhieutrathuocKholeVekhochanChitiet[] arrPhieuNhapCts) { try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { objPhieuNhap.NgayTao = globalVariables.SysDate; objPhieuNhap.NguoiTao = globalVariables.UserName; objPhieuNhap.MaPhieu = Utility.sDbnull(THU_VIEN_CHUNG.MaTraLaiKho()); objPhieuNhap.IsNew = true; objPhieuNhap.Save(); if (objPhieuNhap != null) { 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 them phieu nhap kho :{0}", exception); return(ActionResult.Error); } }
/// <summary> /// hàm thực hiện việc thêm phiếu nhập kho thuốc /// </summary> /// <param name="objPhieuNhap"></param> /// <param name="arrPhieuNhapCts"></param> /// <returns></returns> public ActionResult ThemPhieuTraLaiKho(TPhieutrathuocKholeVekhochan objPhieuNhap, TPhieutrathuocKholeVekhochanChitiet[] arrPhieuNhapCts) { try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { objPhieuNhap.NgayTao = globalVariables.SysDate; objPhieuNhap.NguoiTao = globalVariables.UserName; objPhieuNhap.MaPhieu = Utility.sDbnull(THU_VIEN_CHUNG.MaTraLaiKho()); objPhieuNhap.IsNew = true; objPhieuNhap.Save(); if (objPhieuNhap != null) { 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 them phieu nhap kho :{0}", exception); return ActionResult.Error; } }
/// <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 Insert(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.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); }