Exemplo n.º 1
0
        /// <summary>
        /// Sau khi sửa
        /// </summary>
        /// <param name="ret"></param>
        private void afterModify(DC_TSUAT ret)
        {
            if (ret != null)
            {
                LMessage.ShowMessage("M.DungChung.CapNhatThanhCong", LMessage.MessageBoxType.Information);

                Id                      = ret.ID;
                tthaiNvu                = ret.TTHAI_NVU;
                txtMa.Text              = ret.MA_TSUAT;
                lblTrangThai.Content    = BusinessConstant.layNgonNguNghiepVu(ret.TTHAI_NVU);
                txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguNghiepVu(ret.TTHAI_NVU);

                CommonFunction.RefreshButton(Toolbar, DatabaseConstant.Action.XEM, tthaiNvu, null, DatabaseConstant.Function.DC_DM_TINH_THANH);

                tbiThongTinChung.Focus();
            }
            else
            {
                LMessage.ShowMessage("M.DungChung.CapNhatKoThanhCong", LMessage.MessageBoxType.Error);
            }

            // Yêu cầu Unlock bản ghi cần sửa
            UtilitiesProcess process    = new UtilitiesProcess();
            List <int>       listLockId = new List <int>();

            listLockId.Add(Id);

            bool retUnlockData = process.UnlockData(DatabaseConstant.Module.DMDC,
                                                    DatabaseConstant.Function.DC_DM_TINH_THANH,
                                                    DatabaseConstant.Table.DC_TSUAT,
                                                    DatabaseConstant.Action.SUA,
                                                    listLockId);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sau khi thêm mới
        /// </summary>
        /// <param name="ret"></param>
        private void afterAddNew(DC_TSUAT ret)
        {
            if (ret != null)
            {
                LMessage.ShowMessage("M.DungChung.ThemThanhCong", LMessage.MessageBoxType.Information);

                if (cbMultiAdd.IsChecked == true)
                {
                    Id = 0;
                    beforeAddNew();
                }
                else if (!DatabaseConstant.CLOSE_DETAIL_FORM)
                {
                    Id                      = ret.ID;
                    tthaiNvu                = ret.TTHAI_NVU;
                    txtMa.Text              = ret.MA_TSUAT;
                    lblTrangThai.Content    = BusinessConstant.layNgonNguNghiepVu(ret.TTHAI_NVU);
                    txtTrangThaiBanGhi.Text = BusinessConstant.layNgonNguNghiepVu(ret.TTHAI_NVU);

                    CommonFunction.RefreshButton(Toolbar, DatabaseConstant.Action.XEM, tthaiNvu, null, DatabaseConstant.Function.DC_DM_TINH_THANH);

                    tbiThongTinChung.Focus();
                }
                else
                {
                    onClose();
                }
            }
            else
            {
                LMessage.ShowMessage("M.DungChung.ThemKhongThanhCong", LMessage.MessageBoxType.Error);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Lưu dữ liệu (hay trình duyệt)
        /// </summary>
        private void onSave()
        {
            string trangThai = CommonFunction.LayTrangThaiBanGhi(DatabaseConstant.Action.LUU, BusinessConstant.layTrangThaiNghiepVu(tthaiNvu));

            if (Validation())
            {
                DanhMucProcess danhMucProcess = new DanhMucProcess();
                try
                {
                    // Dữ liệu truyền vào và dữ liệu trả về
                    DC_TSUAT obj = new DC_TSUAT();
                    DC_TSUAT ret = null;

                    // Nếu là lưu tạm hoặc thêm mới lần đầu
                    if (Id == 0)
                    {
                        // Lấy dữ liệu từ form
                        GetFormData(ref obj);
                        obj.TTHAI_NVU = trangThai;

                        // Set các thông tin khác
                        obj.TTHAI_BGHI = BusinessConstant.TrangThaiSuDung.SU_DUNG.layGiaTri();
                        obj.NGUOI_NHAP = ClientInformation.TenDangNhap;
                        obj.NGAY_NHAP  = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat);
                        ret            = danhMucProcess.ThemTanSuat(obj);

                        afterAddNew(ret);
                    }
                    // Nếu là lưu tạm khi sửa
                    // Hoặc lưu tạm khi sửa sau duyệt
                    // Hoặc sửa
                    else
                    {
                        // Lấy thông tin cũ
                        obj = danhMucProcess.getTanSuatById(Id);

                        // Lấy dữ liệu từ form
                        GetFormData(ref obj);
                        obj.TTHAI_NVU = trangThai;

                        ret = danhMucProcess.SuaTanSuat(obj);
                        afterModify(ret);
                    }
                }
                catch (System.Exception ex)
                {
                    this.Cursor = Cursors.Arrow;
                    CommonFunction.ThongBaoLoi(ex);
                    LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                }
                finally
                {
                    danhMucProcess = null;
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Đưa dữ liệu từ form vào object DC_TSUAT
 /// </summary>
 private void GetFormData(ref DC_TSUAT obj)
 {
     obj.MA_TSUAT             = txtMa.Text;
     obj.TEN_TSUAT            = txtTen.Text;
     obj.TSUAT_LAN            = Convert.ToInt32(nudLan.Value);
     obj.TSUAT_TGIAN_SLUONG   = Convert.ToInt32(nudThoiGian.Value);
     obj.TSUAT_TGIAN_DVI_TINH = lstSourceTanSuat.ElementAt(cmbLoaiThoiGian.SelectedIndex).KeywordStrings.First();
     obj.NGAY_NHAP            = LDateTime.GetCurrentDate(ApplicationConstant.defaultDateTimeFormat);
     obj.MA_DVI_QLY           = ClientInformation.MaDonVi;
     obj.MA_DVI_TAO           = ClientInformation.MaDonVi;
     obj.NGUOI_NHAP           = ClientInformation.TenDangNhap;
     return;
 }