private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } _userRepository.ChangePassword(GlobalConstants.username, txtNewPassword.Text.Trim()); UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Close(); } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private bool CheckData() { if (txtCustomerNo.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtCustomerNo.Focus(); return(false); } else if (txtCustomerName.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtCustomerName.Focus(); return(false); } Customer customer = _customerRepository.FirstOrDefault(_ => _.CustomerNo.Equals(txtCustomerNo.Text.Trim())); if (customer != null && ( String.IsNullOrEmpty(_id) || (!String.IsNullOrEmpty(_id) && txtCustomerNo.Text.Trim() != customer.CustomerNo) )) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Dữ liệu đã tồn tại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtCustomerNo.Focus(); return(false); } return(true); }
private bool CheckData() { if (txtOldPassword.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtOldPassword.Focus(); return(false); } else if (txtNewPassword.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtNewPassword.Focus(); return(false); } else if (txtConfirmPassword.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtConfirmPassword.Focus(); return(false); } else if (txtNewPassword.Text.Trim() != txtConfirmPassword.Text.Trim()) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Dữ liệu không đúng"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtConfirmPassword.Focus(); return(false); } _userRepository.CheckSecurity(GlobalConstants.username, txtOldPassword.Text.Trim()); if (_userRepository.error) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText(_userRepository.errorMessage), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtOldPassword.Focus(); return(false); } return(true); }
private void AddProduct() { if (CheckExist(viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "Id").ToString())) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Dữ liệu đã tồn tại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { _orderDetail.Rows.Add(new object[] { "X", viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "Id").ToString(), viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "ItemCode").ToString(), viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "ItemName").ToString(), viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "UnitId").ToString(), viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "UnitName").ToString(), 0, float.Parse(viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "SalePrice").ToString()), float.Parse(viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "SalePrice").ToString()), float.Parse(viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "RemainVirtual").ToString()), float.Parse(viewDuLieuInventory.GetRowCellValue(viewDuLieuInventory.FocusedRowHandle, "RemainActual").ToString()) }); Calculate(viewDuLieu.RowCount - 1); } }
private void Save(bool submit) { try { if (!CheckData()) { return; } _projectDataContext = new ProjectDataContext(); _orderRepository = new OrderRepository(_projectDataContext); _orderDetailRepository = new OrderDetailRepository(_projectDataContext); _productRepository = new ProductRepository(_projectDataContext); //Table Order Order order = new Order(); order.OrderDate = dtpOrderDate.Value; order.CarNumberOrder = txtCarNumberOrder.Text.Trim(); order.UseCarStatus = (chkCompany.Checked ? GlobalConstants.UseCarStatusValue.Company : GlobalConstants.UseCarStatusValue.Agency); order.Total = float.Parse(txtTongTienChuaBaoGomVAT.Text); order.VAT = (float)txtVAT.Value; order.VATMoney = float.Parse(txtTienVAT.Text); order.ProcessingCarStatus = GlobalConstants.ProcessingCarStatusValue.None; order.ProcessingStatus = (submit ? GlobalConstants.ProcessingStatusValue.WaitApprove : GlobalConstants.ProcessingStatusValue.None); _orderRepository.Save(order); txtOrderNo.Text = _orderRepository.id; for (int i = 0; i < viewDuLieu.RowCount; i++) { //Table OrderDetail OrderDetail orderDetail = new OrderDetail(); orderDetail.OrderId = txtOrderNo.Text; orderDetail.ItemId = viewDuLieu.GetRowCellValue(i, "ProductId").ToString(); orderDetail.Quantity = float.Parse(viewDuLieu.GetRowCellValue(i, "Quantity").ToString()); orderDetail.Price = float.Parse(viewDuLieu.GetRowCellValue(i, "Price").ToString()); orderDetail.Discount = 0; orderDetail.DiscountMoney = 0; _orderDetailRepository.Save(orderDetail); //Table Product _productRepository.CaculateRemainVirtual(viewDuLieu.GetRowCellValue(i, "ProductId").ToString(), float.Parse(viewDuLieu.GetRowCellValue(i, "Quantity").ToString())); } UnitOfWork productOfWork = new UnitOfWork(_projectDataContext); int result = productOfWork.Complete(); if (result > 0) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Clear(); } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } //Table AuthorityGroup AuthorityGroup authorityGroup = new AuthorityGroup(); authorityGroup.AuthorityGroupName = txtAuthorityGroupName.Text.Trim(); authorityGroup.Status = (chkUsing.Checked ? GlobalConstants.StatusValue.Using : GlobalConstants.StatusValue.NoUse); _authorityGroupRepository.Save(authorityGroup); if (!String.IsNullOrEmpty(_authorityGroupRepository.id)) { for (int i = 0; i < dgvDuLieu.RowCount; i++) { if (dgvDuLieu.Rows[i].Cells["Assign"].Value.ToString() == "1") { ProgramFunctionAuthority programFunctionAuthority = new ProgramFunctionAuthority(); programFunctionAuthority.ProgramName = dgvDuLieu.Rows[i].Cells["ProgramName"].Value.ToString(); programFunctionAuthority.FunctionName = dgvDuLieu.Rows[i].Cells["FunctionName"].Value.ToString(); programFunctionAuthority.AuthorityGroupID = _authorityGroupRepository.id; _programFunctionAuthorityRepository.Save(programFunctionAuthority); } else { _programFunctionAuthorityRepository.DeleteByProgramAndFunction(dgvDuLieu.Rows[i].Cells["ProgramName"].Value.ToString(), dgvDuLieu.Rows[i].Cells["FunctionName"].Value.ToString()); } } } UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { if (String.IsNullOrEmpty(_id)) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Clear(); } else { DialogResult = DialogResult.OK; Close(); } } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void frmMain_Load(object sender, EventArgs e) { _userRepository = new UserRepository(_projectDataContext); this.Icon = Properties.Resources.icon; this.Text = LanguageTranslate.ChangeLanguageText(this.Text); Translate(); Permission(); ribbonControl1.SelectPage(rbpChucNang); }
private bool CheckData() { if (txtCompany.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtCompany.Focus(); return(false); } return(true); }
public frmLicenses() { InitializeComponent(); lblMaKichHoat.Text = ": " + GlobalConstants.license.Read().ProductId; lblTrangThai.Text = ": " + LanguageTranslate.ChangeLanguageText("Dùng thử"); lblBanQuyen.Text = ": " + LanguageTranslate.ChangeLanguageText("Dùng thử cho 1 máy tính"); lblNgayKichHoat.Text = ": " + GlobalConstants.license.Read().TrialKeyBegin.ToString("dd/MM/yyyy HH:mm"); lblNgayHetHan.Text = ": " + GlobalConstants.license.Read().TrialKeyEnd.ToString("dd/MM/yyyy HH:mm"); lblConLai.Text = ": " + GlobalConstants.license.Read().TrialKeyLeft.ToString() + " " + LanguageTranslate.ChangeLanguageText("Ngày"); btnTrial.Enabled = (GlobalConstants.license.Read().TrialKeyLeft > 0); }
private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } //Table PartNumber PartNumber partNumber = new PartNumber(); partNumber.Id = _id; partNumber.PartNo = txtPartNo.Text.Trim(); partNumber.Model = txtModel.Text.Trim(); partNumber.Note = txtNote.Text.Trim(); partNumber.Status = (chkUsing.Checked ? GlobalConstants.StatusValue.Using : GlobalConstants.StatusValue.NoUse); _partNumberRepository.Save(partNumber); UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { if (String.IsNullOrEmpty(_id)) { if (_quickAdd) { this.Tag = txtPartNo.Text.Trim(); DialogResult = DialogResult.OK; Close(); } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Clear(); } } else { DialogResult = DialogResult.OK; Close(); } } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void frmMain_Load(object sender, EventArgs e) { _userRepository = new UserRepository(_projectDataContext); this.Icon = Properties.Resources.icon; this.Text = LanguageTranslate.ChangeLanguageText(this.Text); Translate(); Permission(); ribbonControl1.SelectPage(rbpChucNang); if (_userRepository.CheckOperator(GlobalConstants.username, "Operator")) { btnScanBarcode_ItemClick(null, null); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } //Table Category Category category = new Category(); category.Id = _id; category.CategoryName = txtCategoryName.Text.Trim(); category.Note = txtGhiChu.Text.Trim(); category.Status = (chkUsing.Checked ? GlobalConstants.StatusValue.Using : GlobalConstants.StatusValue.NoUse); _categoryRepository.Save(category); UnitOfWork categoryOfWork = new UnitOfWork(_projectDataContext); int result = categoryOfWork.Complete(); if (result > 0) { if (String.IsNullOrEmpty(_id)) { if (_quickAdd) { this.Tag = _categoryRepository.id; DialogResult = DialogResult.OK; Close(); } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Clear(); } } else { DialogResult = DialogResult.OK; Close(); } } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void timer_Tick(object sender, EventArgs e) { lblTittle.Text = LanguageTranslate.ChangeLanguageText("Tài khoản") + ": " + GlobalConstants.username + " | " + LanguageTranslate.ChangeLanguageText("Tên đầy đủ") + ": " + GlobalConstants.fullName + " | " + LanguageTranslate.ChangeLanguageText("Ngày") + ": " + DateTime.Now.ToString("dd/MM HH:mm:ss") + " | " + LanguageTranslate.ChangeLanguageText("Máy") + ": " + GlobalConstants.machineName; txtCa.Text = _shiftRepository.GetShiftNo(); //_serialPort.Write("2"); if (_countTimeEmpty > 0) { _countTimeEmpty--; if (_countTimeEmpty == 0) { ControlDisplay("", GlobalConstants.ResultStatusValue.Empty); } } }
private void frmMain_Load(object sender, EventArgs e) { this.Text = LanguageTranslate.ChangeLanguageText(this.Text); btnUsers.Caption = LanguageTranslate.ChangeLanguageText(btnUsers.Caption); btnChangePassword.Caption = LanguageTranslate.ChangeLanguageText(btnChangePassword.Caption); btnPartNumber.Caption = LanguageTranslate.ChangeLanguageText(btnPartNumber.Caption); btnRegistBarcode.Caption = LanguageTranslate.ChangeLanguageText(btnRegistBarcode.Caption); btnScanBarcode.Caption = LanguageTranslate.ChangeLanguageText(btnScanBarcode.Caption); rbpHeThong.Text = LanguageTranslate.ChangeLanguageText(rbpHeThong.Text); rbpChucNang.Text = LanguageTranslate.ChangeLanguageText(rbpChucNang.Text); rbpBaoCao.Text = LanguageTranslate.ChangeLanguageText(rbpBaoCao.Text); txtUser.Caption = LanguageTranslate.ChangeLanguageText("Tài khoản") + ": " + GlobalConstants.username + " | " + LanguageTranslate.ChangeLanguageText("Tên đầy đủ") + ": " + GlobalConstants.fullName; ribbonControl1.SelectPage(rbpChucNang); }
private void Translate() { rbpHeThong.Text = LanguageTranslate.ChangeLanguageText(rbpHeThong.Text); rbpDanhMuc.Text = LanguageTranslate.ChangeLanguageText(rbpDanhMuc.Text); rbpChucNang.Text = LanguageTranslate.ChangeLanguageText(rbpChucNang.Text); rbpBaoCao.Text = LanguageTranslate.ChangeLanguageText(rbpBaoCao.Text); btnUsers.Caption = LanguageTranslate.ChangeLanguageText(btnUsers.Caption); btnChangePassword.Caption = LanguageTranslate.ChangeLanguageText(btnChangePassword.Caption); btnLanguageLibrary.Caption = LanguageTranslate.ChangeLanguageText(btnLanguageLibrary.Caption); btnSetting.Caption = LanguageTranslate.ChangeLanguageText(btnSetting.Caption); txtUser.Caption = LanguageTranslate.ChangeLanguageText("Tài khoản") + ": " + GlobalConstants.username + " | " + LanguageTranslate.ChangeLanguageText("Tên đầy đủ") + ": " + GlobalConstants.fullName; }
private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } //Table Product Product product = new Product(); product.Id = _id; product.CategoryId = cbbCategory.SelectedValue.ToString(); product.ItemCode = txtItemCode.Text.Trim(); product.ItemName = txtItemName.Text.Trim(); product.UnitId = cbbUnit.SelectedValue.ToString(); product.ImportPrice = (float)txtImportPrice.Value; product.SalePrice = (float)txtSalePrice.Value; product.RetailPrice = (float)txtRetailPrice.Value; product.Note = txtGhiChu.Text.Trim(); product.Status = (chkUsing.Checked ? GlobalConstants.StatusValue.Using : GlobalConstants.StatusValue.NoUse); _productRepository.Save(product); UnitOfWork productOfWork = new UnitOfWork(_projectDataContext); int result = productOfWork.Complete(); if (result > 0) { if (String.IsNullOrEmpty(_id)) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Clear(); } else { DialogResult = DialogResult.OK; Close(); } } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } //Table RegistBarcode RegistBarcode registBarcode = new RegistBarcode(); registBarcode.Id = _id; registBarcode.PartNo = cbbPartNumber.Text.Trim(); registBarcode.RegistDate = dtpRegistDate.Value; registBarcode.MachineNo = cbbMachine.Text.Trim(); registBarcode.MoldNo = cbbMold.Text.Trim(); registBarcode.ShiftNo = cbbShift.Text.Trim(); registBarcode.SEQ = txtSEQ.Text.Trim(); registBarcode.Barcode = txtBarcode.Text.Trim(); registBarcode.Status = GlobalConstants.StatusValue.Using; _registBarcodeRepository.Save(registBarcode); UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { if (String.IsNullOrEmpty(_id)) { PrintBarcode(); XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Clear(); } else { DialogResult = DialogResult.OK; Close(); } } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private bool CheckData() { if (cbbPartNumber.SelectedValue == null || String.IsNullOrEmpty(cbbPartNumber.Text.Trim())) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa chọn dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); cbbPartNumber.Focus(); return(false); } else if (cbbMachine.SelectedValue == null || String.IsNullOrEmpty(cbbMachine.Text.Trim())) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa chọn dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); cbbMachine.Focus(); return(false); } else if (cbbMold.SelectedValue == null || String.IsNullOrEmpty(cbbMold.Text.Trim())) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa chọn dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); cbbMold.Focus(); return(false); } else if (cbbShift.SelectedValue == null || String.IsNullOrEmpty(cbbShift.Text.Trim())) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa chọn dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); cbbShift.Focus(); return(false); } else if (txtSEQ.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtSEQ.Focus(); return(false); } RegistBarcode registBarcode = _registBarcodeRepository.FirstOrDefault(_ => _.Barcode.Equals(txtBarcode.Text.Trim())); if (registBarcode != null && ( String.IsNullOrEmpty(_id) || (!String.IsNullOrEmpty(_id) && txtBarcode.Text.Trim() != registBarcode.Barcode) )) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Dữ liệu đã tồn tại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); cbbPartNumber.Focus(); return(false); } return(true); }
private void btnRegister_Click(object sender, EventArgs e) { frmLicense frm = new frmLicense(); frm.License = GlobalConstants.license; frm.BuyLicenseUrl = "http://datatech.vn/"; frm.Text = LanguageTranslate.ChangeLanguageText("Đăng ký sử dụng phần mềm") + " " + Properties.Settings.Default.Company; frm.Icon = Properties.Resources.icon; DialogResult dr = frm.ShowDialog(); if (dr != DialogResult.OK) { return; } DialogResult = DialogResult.OK; Close(); }
private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } //Table ProductionPlan ProductionPlan productionPlan = new ProductionPlan(); productionPlan.Id = _id; productionPlan.WorkOrder = txtWorkOrder.Text.Trim(); productionPlan.PartNo = cbbPartNumber.Text.Trim(); productionPlan.Model = ""; productionPlan.ExpectedDeliveryDate = dtpRegistDate.Value.Date; productionPlan.Quantity = double.Parse(txtQuantity.Text.Trim()); productionPlan.ProductionStatus = GlobalConstants.ProductionStatusValue.None; productionPlan.Status = GlobalConstants.StatusValue.Using; _productionPlanRepository.Save(productionPlan); UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { if (String.IsNullOrEmpty(_id)) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Clear(); } else { DialogResult = DialogResult.OK; Close(); } } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void btnDelete_Click(object sender, EventArgs e) { if (viewDuLieu.RowCount > 0 && XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Bạn có muốn xóa thông tin này?"), LanguageTranslate.ChangeLanguageText("Xác nhận"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { _moldRepository.Remove(viewDuLieu.GetRowCellValue(viewDuLieu.FocusedRowHandle, "Id").ToString()); UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { Search(); } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Xóa thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } }
private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } //Table Language LanguageLibrary languageLibrary = new LanguageLibrary(); languageLibrary.Id = _id; languageLibrary.English = txtEnglish.Text.Trim(); languageLibrary.Vietnamese = txtVietnamese.Text.Trim(); _languageLibraryRepository.Save(languageLibrary); UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { if (String.IsNullOrEmpty(_id)) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Clear(); } else { DialogResult = DialogResult.OK; Close(); } } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void btnSave_Click(object sender, EventArgs e) { if (!CheckData()) { return; } try { if (!CheckData()) { return; } _projectDataContext = new ProjectDataContext(); _settingMasterRepository = new SettingMasterRepository(_projectDataContext); //Table SettingMaster SettingMaster settingMaster = new SettingMaster(); settingMaster.Id = _id; settingMaster.Company = txtCompany.Text.Trim(); settingMaster.Address = txtAddress.Text.Trim(); settingMaster.Phone = txtPhone.Text.Trim(); settingMaster.TaxCode = txtTaxCode.Text.Trim(); _settingMasterRepository.Save(settingMaster); UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thành công"), LanguageTranslate.ChangeLanguageText("Thông báo")); Close(); } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private bool CheckData() { if (cbbCategory.SelectedValue == null || cbbCategory.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); cbbCategory.Focus(); return(false); } else if (txtItemCode.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtItemCode.Focus(); return(false); } else if (txtItemName.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtItemName.Focus(); return(false); } else if (cbbUnit.SelectedValue == null || cbbUnit.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); cbbUnit.Focus(); return(false); } Product product = _productRepository.FirstOrDefault(_ => _.ItemCode.Equals(txtItemCode.Text.Trim())); if (product != null && ( String.IsNullOrEmpty(_id) || (!String.IsNullOrEmpty(_id) && txtItemCode.Text.Trim() != product.ItemCode) )) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Dữ liệu đã tồn tại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtItemCode.Focus(); return(false); } return(true); }
private bool CheckData() { if (txtAgencyName.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtAgencyName.Focus(); return(false); } Agency agency = _agencyRepository.FirstOrDefault(_ => _.AgencyName.Equals(txtAgencyName.Text.Trim())); if (agency != null && ( String.IsNullOrEmpty(_id) || (!String.IsNullOrEmpty(_id) && txtAgencyName.Text.Trim() != agency.AgencyName) )) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Dữ liệu đã tồn tại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtAgencyName.Focus(); return(false); } return(true); }
private bool CheckData() { if (txtMachineNo.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtMachineNo.Focus(); return(false); } Machine machine = _machineRepository.FirstOrDefault(_ => _.MachineNo.Equals(txtMachineNo.Text.Trim())); if (machine != null && ( String.IsNullOrEmpty(_id) || (!String.IsNullOrEmpty(_id) && txtMachineNo.Text.Trim() != machine.MachineNo) )) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Dữ liệu đã tồn tại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtMachineNo.Focus(); return(false); } return(true); }
private bool CheckData() { if (txtUsername.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtUsername.Focus(); return(false); } else if (txtPassword.Text.Trim() == "") { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Chưa điền dữ liệu"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtPassword.Focus(); return(false); } _userRepository.CheckSecurity(txtUsername.Text.Trim(), txtPassword.Text.Trim()); if (_userRepository.error) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText(_userRepository.errorMessage), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); txtPassword.Focus(); return(false); } return(true); }
private void Translate() { btnUsers.Caption = LanguageTranslate.ChangeLanguageText(btnUsers.Caption); btnChangePassword.Caption = LanguageTranslate.ChangeLanguageText(btnChangePassword.Caption); btnLanguageLibrary.Caption = LanguageTranslate.ChangeLanguageText(btnLanguageLibrary.Caption); btnSetting.Caption = LanguageTranslate.ChangeLanguageText(btnSetting.Caption); btnPartNumber.Caption = LanguageTranslate.ChangeLanguageText(btnPartNumber.Caption); btnMachine.Caption = LanguageTranslate.ChangeLanguageText(btnMachine.Caption); btnShift.Caption = LanguageTranslate.ChangeLanguageText(btnShift.Caption); btnMold.Caption = LanguageTranslate.ChangeLanguageText(btnMold.Caption); btnRegistBarcode.Caption = LanguageTranslate.ChangeLanguageText(btnRegistBarcode.Caption); btnProductionPlan.Caption = LanguageTranslate.ChangeLanguageText(btnProductionPlan.Caption); btnScanBarcode.Caption = LanguageTranslate.ChangeLanguageText(btnScanBarcode.Caption); btnProductionHistory.Caption = LanguageTranslate.ChangeLanguageText(btnProductionHistory.Caption); btnProductReportOK.Caption = LanguageTranslate.ChangeLanguageText(btnProductReportOK.Caption); btnProductReportNG.Caption = LanguageTranslate.ChangeLanguageText(btnProductReportNG.Caption); btnReportSyntheticRegistBarcode.Caption = LanguageTranslate.ChangeLanguageText(btnReportSyntheticRegistBarcode.Caption); btnReportSyntheticProductionPlan.Caption = LanguageTranslate.ChangeLanguageText(btnReportSyntheticProductionPlan.Caption); rbpHeThong.Text = LanguageTranslate.ChangeLanguageText(rbpHeThong.Text); rbpDanhMuc.Text = LanguageTranslate.ChangeLanguageText(rbpDanhMuc.Text); rbpChucNang.Text = LanguageTranslate.ChangeLanguageText(rbpChucNang.Text); rbpBaoCao.Text = LanguageTranslate.ChangeLanguageText(rbpBaoCao.Text); txtUser.Caption = LanguageTranslate.ChangeLanguageText("Tài khoản") + ": " + GlobalConstants.username + " | " + LanguageTranslate.ChangeLanguageText("Tên đầy đủ") + ": " + GlobalConstants.fullName; }
private void frmMain_Load(object sender, EventArgs e) { _projectDataContext = new ProjectDataContext(); _userRepository = new UserRepository(_projectDataContext); this.Icon = Properties.Resources.icon; this.Text = LanguageTranslate.ChangeLanguageText(this.Text); Translate(); Permission(); ribbonControl1.SelectPage(rbpChucNang); //thread = new Thread(() => //{ // this.BeginInvoke(new MethodInvoker(() => // { // Alarm(); // try // { // thread.Abort(); // } // catch { } // })); //}); //thread.IsBackground = true; //thread.Start(); }
private void btnSave_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } //Table RegistBarcode RegistBarcode registBarcode = new RegistBarcode(); int seq = int.Parse(_registBarcodeRepository.GetSEQ(dtpRegistDate.Value, cbbShift.Text.Trim())); string barcode = ""; DataTable listBarcode = new DataTable(); listBarcode.Columns.Add("Barcode", typeof(string)); listBarcode.Columns.Add("PartNo", typeof(string)); listBarcode.Columns.Add("DateShift", typeof(string)); listBarcode.Columns.Add("MoldNoSEQ", typeof(string)); listBarcode.Columns.Add("VN", typeof(string)); for (int i = 0; i < txtQuantity.Value; i++) { //Generate barcode seq++; barcode = String.Format("{0}{1}{2}{3}{4}{5}", cbbPartNumber.Text.Trim(), dtpRegistDate.Value.ToString("yyMMdd"), cbbMachine.Text.Trim(), cbbShift.Text.Trim(), cbbMold.Text.Trim(), seq.ToString("0000")); //Set list barcode listBarcode.Rows.Add(new string[] { barcode, "P/N:" + cbbPartNumber.Text.Trim(), "Date:" + dtpRegistDate.Value.ToString("yyMMdd") + cbbShift.Text.Trim(), "M/N:" + cbbMold.Text.Trim() + "SEQ" + seq.ToString("0000"), "VN:" + GlobalConstants.VN }); //Insert data registBarcode = new RegistBarcode(); registBarcode.Id = _id; registBarcode.PartNo = cbbPartNumber.Text.Trim(); registBarcode.RegistDate = dtpRegistDate.Value.Date; registBarcode.MachineNo = cbbMachine.Text.Trim(); registBarcode.MoldNo = cbbMold.Text.Trim(); registBarcode.ShiftNo = cbbShift.Text.Trim(); registBarcode.SEQ = seq.ToString("0000"); registBarcode.Barcode = barcode; _registBarcodeRepository.Save(registBarcode); } UnitOfWork unitOfWork = new UnitOfWork(_projectDataContext); int result = unitOfWork.Complete(); if (result > 0) { if (String.IsNullOrEmpty(_id)) { _registBarcodeRepository.PrintListBarcode(listBarcode); Clear(); } else { DialogResult = DialogResult.OK; Close(); } } else { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { XtraMessageBox.Show(LanguageTranslate.ChangeLanguageText("Lưu thất bại"), LanguageTranslate.ChangeLanguageText("Thông báo"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }