/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnArticleDelete_Click(object sender, EventArgs e) { try { bool rowDeleted = false; var articleCodes = new List <string>(); if (gridScanArticle.Rows.Count == 1) { return; } for (int rowIndex = 1; rowIndex < gridScanArticle.Rows.Count; rowIndex++) { if (Convert.ToBoolean(gridScanArticle.Rows[rowIndex][(int)GridColumnArticles.Select])) { if (gridScanArticle.Rows[rowIndex][(int)GridColumnArticles.ArticleCode] != null) { rowDeleted = true; articleCodes.Add(gridScanArticle.Rows[rowIndex][(int)GridColumnArticles.ArticleCode].ToString()); } } } if (!rowDeleted) { CommonFunc.ShowMessage("Please select at least one item.", MessageType.Information); return; } else { if (CommonFunc.ShowMessage("The selected record(s) will be deleted. Are you sure?", MessageType.OKCancel) == DialogResult.OK) { var articleList = ArticleStockList.Where(a => articleCodes.Contains(a.ArticleCode)).ToList(); for (int iRow = 0; iRow < articleList.Count(); iRow++) { ArticleStockList.Remove(articleList[iRow]); } gridScanArticle.DataSource = ArticleStockList.ToList(); DefaultGridSetting(); chkSelectAll.Checked = false; } } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void txtCurrencyCode_TextChanged(object sender, EventArgs e) { try { txtCurrencyCode.Text = txtCurrencyCode.Text; txtCurrencyCode.AutoCompleteCustomSource = currencyCollection; } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void btnDeleteItemHierarchy_Click(object sender, EventArgs e) { try { // check how Many active child node if not then can be Delete . switch (SaveMode) { case (int)EnumSave.Tree: int treeChildArticleNoCount = this.articleHierarchyManager.GetTreeChildArticleNoCount(lbltp1TreeCode.Text); if (treeChildArticleNoCount == 0) { if (this.articleHierarchyManager.DeleteTree(lbltp1NodeCode.Text)) { MessageBox.Show(CommonFunc.getResourceString("IH002")); BindTree(); } } else { MessageBox.Show(string.Format("{0}{1}", CommonFunc.getResourceString("IH003"), treeChildArticleNoCount)); } break; case (int)EnumSave.Node: int childArticleNoCount = this.articleHierarchyManager.GetChildArticleNoCount(lbltp1NodeCode.Text); if (childArticleNoCount == 0) { if (this.articleHierarchyManager.DeleteNode(lbltp1NodeCode.Text)) { MessageBox.Show(CommonFunc.getResourceString("IH004")); BindTree(); HideAllControls(); } } else { string message = string.Format(CommonFunc.getResourceString("IH005"), childArticleNoCount); MessageBox.Show(message); } break; } TreeNode node = treeView1.Nodes[0]; // vipin treeView1.SelectedNode = node; } catch (Exception ex) { MessageBox.Show(ex.Message); Logger.Log(ex, Logger.LogingLevel.Error); } }
private void btnSave_Click(object sender, System.EventArgs e) { try { if ((IsFormValidate())) { SiteDALModel siteDalModel = new SiteDALModel(); siteDalModel.SiteModel = FillSiteModel(); siteDalModel.MstFinYearModel = FillFinYearModel(); bool Status = false; if (flagAddEdit == true) { Status = this.siteManager.UpdateSite(siteDalModel.SiteModel, siteDalModel.MstFinYearModel); if (Status == true) { CommonFunc.ShowMessage("Site " + txtSiteCode.Text.Trim() + " Updated Successfully", MessageType.Information); } else { CommonFunc.ShowMessage("Error!!!", MessageType.Information); } } else { siteDalModel.MstAreaCodeModel = FillAreaCodeModel(); siteDalModel.MstCurrencySiteModel = FillCurrencyModel(); siteDalModel.MstSiteCurrancyMapModel = FillSiteCurrancyMapModel(); Status = this.siteManager.SaveSite(siteDalModel); if (Status == true) { CommonFunc.ShowMessage("Site " + txtSiteCode.Text.Trim() + " Added Successfully", MessageType.Information); } else { CommonFunc.ShowMessage("Error!!!", MessageType.Information); } } clearForm(); } } catch (System.Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void btnClear_Click(object sender, System.EventArgs e) { try { if (CommonFunc.ShowMessage("Are You Sure? All entered data will be clear", Models.Enums.MessageType.OKCancel) == DialogResult.OK) { clearForm(); } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void btnClear_Click(object sender, System.EventArgs e) { try { if (CommonFunc.ShowMessage("All the data entered by you shall be cleared. Do You wish to proceed?", Models.Enums.MessageType.OKCancel) == DialogResult.OK) { clearForm(); } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void chkAll_CheckedChanged(object sender, EventArgs e) { try { var chk = chkAll.Checked; for (int rowArticleCode = 1; rowArticleCode < dgTender.Rows.Count; rowArticleCode++) { dgTender.Rows[rowArticleCode][(int)enumTenderGrid.Select] = chk; } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void btnCancel_Click(object sender, System.EventArgs e) { try { if (CommonFunc.ShowMessage("All the data entered will be lost. Do you wish to proceed?", Models.Enums.MessageType.OKCancel) == DialogResult.OK) { this.Dispose(); this.Close(); } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void btnCancel_Click(object sender, EventArgs e) { try { if (CommonFunc.ShowMessage("Are You Sure? All the changes will be lost", Models.Enums.MessageType.OKCancel) == DialogResult.OK) { this.Dispose(); this.Close(); } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddArticle_Click(object sender, EventArgs e) { try { string supplierCode = (cmbSupplierName.SelectedValue != null) ? cmbSupplierName.SelectedValue.ToString() : string.Empty; var articleList = this.articleManager.GetArticlePurchaseList(supplierCode, new List <string>()); if (articleList.Count > 0) { frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid(multipleSelect: true, defaultFilter: false); DataTable dtItems = CommonFunc.ConvertListToDataTable(articleList); objSearch.Text = "Item Search"; objSearch.boolWildSearch = true; objSearch.dtcommonSearch = dtItems; DataTable dtSelectedItems = new DataTable(); if (objSearch.ShowDialog() == DialogResult.OK) { dtSelectedItems = objSearch.dtSelectedList; // List<ArticlePurchaseModel> selectedIArticleList = DataTableToList.ConvertDataTableToList<ArticlePurchaseModel>(dtSelectedItems); if (dtSelectedItems != null) { List <ArticlePurchaseModel> selectedIArticleList = DataTableToList.ToList <ArticlePurchaseModel>(dtSelectedItems); AddSelectedArticlesIntoGrid(selectedIArticleList); } } objSearch.Dispose(); } else { CommonFunc.ShowMessage("Article not exist", MessageType.Information); } //frmCommonSearch objSearch = new frmCommonSearch(true); //objSearch.DataList = articleList; } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridScanArticle_AfterEdit(object sender, RowColEventArgs e) { try { if (e.Row > 0 && (e.Col == 5 || e.Col == 6 || e.Col == 7)) { Int64 intqty = Convert.ToInt64(gridScanArticle.Rows[e.Row][(int)GridColumnArticles.Quantity]); //code added by vipul for issue id 2834 decimal Qty = Convert.ToDecimal(gridScanArticle.Rows[e.Row][(int)GridColumnArticles.Quantity]); if (gridScanArticle.Rows[e.Row][(int)GridColumnArticles.UOM].ToString().Equals("NOS")) { decimal d = (decimal)Qty; if ((d % 1) > 0) { CommonFunc.ShowMessage("Quantity cannot be in decimal for NOS article", MessageType.Information); return; } } if (intqty < 0) { CommonFunc.ShowMessage("Quantity should be more than 0", MessageType.Information); return; } Decimal intcost = (gridScanArticle.Rows[e.Row][(int)GridColumnArticles.CostPrice] == null) ? 0 : Convert.ToInt64(gridScanArticle.Rows[e.Row][(int)GridColumnArticles.CostPrice]); if (intcost < 0) { CommonFunc.ShowMessage("Cost Price should be more than 0", MessageType.Information); return; } Decimal inttax = (gridScanArticle.Rows[e.Row][(int)GridColumnArticles.TaxAmount] == null) ? 0 : Convert.ToInt64(gridScanArticle.Rows[e.Row][(int)GridColumnArticles.TaxAmount]); if (inttax < 0) { CommonFunc.ShowMessage("Tax Amount should be more than 0", MessageType.Information); return; } gridScanArticle.Rows[e.Row][(int)GridColumnArticles.NetAmount] = Convert.ToDecimal(string.Format("{0:0.00}", (intqty * Convert.ToDecimal(string.Format("{0:0.00}", intcost))) + Convert.ToDecimal(string.Format("{0:0.00}", inttax)))); } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void treeView1_DoubleClick(object sender, EventArgs e) { selectedItemNode = new List <ItemHierarchy>(); try { selectedItemNode.Add(this.itemHierarchyList.Where(a => (a.Nodecode ?? "") == (string)treeView1.SelectedNode.Tag).ToList().FirstOrDefault()); if (AllowedOnlyLastNodeSelection && !(bool)selectedItemNode[0].ISThisLastNode) { CommonFunc.ShowMessage(" Please select the Last Node which has no child nodes associated ", MessageType.Information); return; } DialogResult = System.Windows.Forms.DialogResult.OK; } catch (Exception ex) { throw ex; } }
private void btnClear_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(txtSupplierCode.Text) || !string.IsNullOrEmpty(txtName.Text) || !string.IsNullOrEmpty(txtContactPerson.Text)) { if (CommonFunc.ShowMessage(" All the data entered will be lost. Do you wish to proceed?", Models.Enums.MessageType.OKCancel) == DialogResult.Cancel) { return; } } clearForm(); } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); //MessageBox.Show(ex.Message); } }
private void btnArticleDelete_Click(object sender, EventArgs e) { try { bool rowDeleted = false; for (int rowBarCode = 1; rowBarCode < dgTender.Rows.Count; rowBarCode++) { if (Convert.ToBoolean(dgTender.Rows[rowBarCode][(int)enumTenderGrid.Select]) == true) { rowDeleted = true; break; } } if (rowDeleted == false) { CommonFunc.ShowMessage("Please select at least one item", Models.Enums.MessageType.Information); return; } if (CommonFunc.ShowMessage("Are you sure you wish to delete the selected items", Models.Enums.MessageType.OKCancel) == DialogResult.OK) { int ArticleCodeRowCount = dgTender.Rows.Count; var deleteArticleCodeRow = new List <C1.Win.C1FlexGrid.Row>(); bool status = false; for (int row = 1; row < ArticleCodeRowCount; row++) { if (Convert.ToBoolean(dgTender.Rows[row][(int)enumTenderGrid.Select]) == true) { status = this.tenderManager.DeleteByID(dgTender.Rows[row][(int)enumTenderGrid.TenderCode].ToString(), CommonModel.SiteCode); } } Fillgrid(); chkAll.Checked = false; } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void frmItemHierarchy_Load(object sender, EventArgs e) { try { if (CommonFunc.Themeselect == "Theme 1") { ThemeChange(); } BindTree(); HideAllControls(); setInitialFormsValidations(); //CommonFunc.WriteResourceFile(this); CommonFunc.SetCultureFromResource(this); } catch (Exception ex) { MessageBox.Show(ex.Message); Logger.Log(ex, Logger.LogingLevel.Error); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdateStock_Click(object sender, EventArgs e) { try { if (ValidateArticleStock()) { if (CommonFunc.ShowMessage("Are you sure? The stock Quantity will be updated in the system.", MessageType.OKCancel) == DialogResult.OK) { bool status = false; DateTime dt = DateTime.Now; string stryear = dt.ToString("yy"); finYear = dt.ToString("yyyy"); string sitecodenew = CommonModel.SiteCode.ToString(); sitecodenew = sitecodenew.Substring(sitecodenew.Length - 3); int grnNextNo = commonManager.GetNextID(CommonModel.SiteCode, "GR"); grnNextNo = grnNextNo + 1; string strlastcode = string.Format("{0}", grnNextNo.ToString().PadLeft(7, '0')); grnNumber = "GRS" + sitecodenew + stryear + strlastcode; documentNumber = grnNumber; invoiceNumber = "INVS" + sitecodenew + stryear + strlastcode; articleStockInOutModel = new ArticleStockInModel(); articleStockInOutModel.OrderDtlModels = FillOrderDtlDataToModel(); articleStockInOutModel.OrderHdrModel = FillOrderHdrDataToModel(); articleStockInOutModel.ArticleStockBalanceModels = FillArticleStockBalanceDataToModel(); articleStockInOutModel.InvoiceModel = FillInvoiceDataToModel(); this.articleStockManager.SaveArticleStockInData(articleStockInOutModel); CommonFunc.ShowMessage("Stock Quantity has been updated", MessageType.Information); ResetArticleStockInData(); } } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void DeleteAllCharacteristic_Click(object sender, EventArgs e) { try { IList <CharacteristicModel> charList; GetControlID((sender as Spectrum.Controls.Button).Name.ToLower()); FlexGrid grdCharacteristicTemp = grdCharacteristic; charList = CharacteristicValues.Where(c => c.CharCode == CharCode && c.Select == true).ToList(); if (charList.Count == 0) { CommonFunc.ShowMessage("Please select at least 1 record to delete.", MessageType.Information); return; } if (CommonFunc.ShowMessage("The selected record(s) will be deleted. Are you sure?", MessageType.OKCancel) == DialogResult.OK) { for (int rowIndex = 0; rowIndex < charList.Count(); rowIndex++) { var isValueAssociate = this.characteristicManager.IsProductAssociate(charList[rowIndex].CharValue); if (isValueAssociate == false) { charList[rowIndex].CharStatus = "Deleted"; } else { CommonFunc.ShowMessage(charList[rowIndex].CharValue + " value is associated with Active Products in the system. First remove the Product association.", MessageType.Information); LoadDefaultCharacteristics(); return; } } DefaultGridSetting(ref grdCharacteristicTemp, CharCode); chkCharacteristic.Checked = false; } } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); } }
private void cboTenderType_SelectedValueChanged(object sender, EventArgs e) { if (cboTenderType.SelectedValue != null) { if (cboTenderType.SelectedValue.ToString() == "CreditVouc(I)" || cboTenderType.SelectedValue.ToString() == "GiftVoucher(I)") { cboProgramCode.Enabled = true; this.programCodes = (from result in this.commonManager.GetVouchers(cboTenderType.SelectedValue.ToString()) select new DropDownModel { Code = result.VoucherCode, Description = result.VoucherDesc }).ToList(); //"ExtendRightColumn=true" tendertypes.Insert(0, new DropDownModel { Code = null, Description = "Select" }); //cboProgramCode.DataSource = programCodes; //cboProgramCode.DisplayMember = "Description"; //cboProgramCode.ValueMember = "Code"; CommonFunc.PopulateComboBoxDataForWindowsForm(ref cboProgramCode, this.programCodes); cboProgramCode.SelectedText = ""; } //else if (cboTenderType.SelectedValue.ToString() == "CLPPoint") //{ // cboProgramCode.Enabled = true; // this.programCodes = (from result in this.commonManager.getclpprogram(CommonModel.SiteCode) // select new DropDownModel // { // Code = result.CLPProgramId, // Description = result.CLPProgramName // }).ToList(); // CommonFunc.PopulateComboBoxData(ref cboProgramCode, this.programCodes); //} else { cboProgramCode.SelectedIndex = -1; cboProgramCode.Enabled = false; } } }
private void frmTender_Load(object sender, System.EventArgs e) { try { if (CommonFunc.Themeselect == "Theme 1") { ThemeChange(); } this.tenderActionButton.btnSave.Click += new System.EventHandler(btnSave_Click); this.tenderActionButton.btnCancel.Click += new System.EventHandler(btnCancel_Click); this.tenderActionButton.btnClear.Click += new EventHandler(btnClear_Click); cboSite.Enabled = false; cboProgramCode.Enabled = false; this.tenderTypes = (from result in this.commonManager.GetTenderTypeList() select new DropDownModel { Code = result.TenderType, Description = result.Description }).ToList(); CommonFunc.PopulateComboBoxDataForWindowsForm(ref cboTenderType, this.tenderTypes); //cboTenderType.DataSource = tenderTypes; //cboTenderType.DisplayMember = "Description"; //cboTenderType.ValueMember = "Code"; setInitialFormsValidations(); Fillgrid(); setTabIndex(); // CommonFunc.WriteResourceFile(this); CommonFunc.SetCultureFromResource(this); } catch (System.Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } finally { } }
/// <summary> /// on search click it will open search box of all supplier ...and after selecting the supplier , fecth supplier details and bind to supplier model . /// </summary> private void btnSearch_Click(object sender, EventArgs e) { try { var supplierList = this.supplierManager.GetSupplierList().ToList(); frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid(multipleSelect: false); DataTable dtSupplier = CommonFunc.ConvertListToDataTable(supplierList); objSearch.Text = "Supplier Search"; objSearch.boolWildSearch = false; objSearch.dtcommonSearch = dtSupplier; DataTable dtSelectedSupplier = new DataTable(); if (objSearch.ShowDialog() == DialogResult.OK) { dtSelectedSupplier = objSearch.dtSelectedList; if (dtSelectedSupplier.Rows.Count > 0) { editSupplierCode = dtSelectedSupplier.Rows[0]["Code"].ToString(); this.supplierModel = this.supplierManager.GetSupplierByID(editSupplierCode); FillModelDataToSupplier(); //For Edit Supplier, all the fields except supplier code are editable. txtSupplierCode.ReadOnly = true; //code added by irfan on 14-7-2017 issue id 0002254 supplierErrorProvider.SetError(txtContactPerson, string.Empty); supplierErrorProvider.SetError(txtName, string.Empty); txtContactPerson.BorderColor = CommonFunc.DefaultBorderColor; txtName.BorderColor = CommonFunc.DefaultBorderColor; } } objSearch.Dispose(); } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lnkFailedArticles_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { if (faildArticlesList.ToList().Count > 0) { DataTable dtExport = CommonFunc.ConvertListToDataTable(faildArticlesList.ToList()); dtExport.Columns[0].ColumnName = "Article Code"; dtExport.Columns[1].ColumnName = "Quantity"; Cursor.Current = Cursors.WaitCursor; DialogResult resultShow = fbd.ShowDialog(); if (resultShow == DialogResult.OK) { string path = Path.Combine(fbd.SelectedPath, "FailedArticel" + DateTime.Now.ToString("dd-MM-yyyy-hhmm") + ".xls").ToString(); bool IsExported = ConvertListToExcel.DatatableToExcel(dtExport, path); System.Diagnostics.Process.Start(path); if (IsExported) { MessageBox.Show("Exported Successfully"); } } Cursor.Current = Cursors.Default; } else { CommonFunc.ShowMessage("Failed Articles does not exist", MessageType.Information); } } catch (Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); throw ex; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBrowseArticleFile_Click(object sender, EventArgs e) { try { if (openFileDialog.ShowDialog() == DialogResult.OK) { if (".xls,.xlsx".Contains(Path.GetExtension(openFileDialog.FileName))) { txtArticleFilePath.Value = openFileDialog.FileName; } else { CommonFunc.ShowMessage("Please Browse Excel File", MessageType.Information); return; } } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
/// <summary> /// on state change bind city list of that state .. /// </summary> private void cboState_SelectedValueChanged(object sender, EventArgs e) { try { cboCity.SelectedIndex = -1; if (cboState.SelectedValue != null) { var cityList = (from p in areaCodeList where p.AreaType == (int)MaterType.City && p.ParentCode == cboState.SelectedValue.ToString() select new DropDownModel { Code = p.AreaCode, Description = p.Description }).ToList(); CommonFunc.PopulateComboBoxDataForWindowsForm(ref cboCity, cityList); } } catch (Exception ex) { throw ex; } }
private void btnCancelItemHierarchy_Click(object sender, EventArgs e) { try { switch (SaveMode) { case (int)EnumSave.Tree: if (MessageBox.Show(CommonFunc.getResourceString("IH001"), "CNF", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } HideAllControls(); lblItemHierarchyDetails.Visible = true; btnNewTree.Visible = true; break; case (int)EnumSave.Node: if (MessageBox.Show(CommonFunc.getResourceString("IH001"), "CNF", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } lblItemHierarchyDetails2.Visible = false; tbllayoutPanelItemHierarchy2.Visible = false; panelDbAction.Visible = false; SaveMode = (int)EnumSave.None; break; } } catch (Exception ex) { MessageBox.Show(ex.Message); Logger.Log(ex, Logger.LogingLevel.Error); } }
/// <summary> /// Check all form controls have valid data if not display user to message and return fail /// </summary> /// <returns> form validation sucuss or Fail </returns> private bool IsFormvalidate() { try { bool validateResult = true; bool isControlFocused = true; Regex alphanumericpatt = new Regex("^[A-Za-z0-9!@#$%&*()-{}.,/ ]+$"); //--- Supplier code already exists --//-- if (!string.IsNullOrEmpty(txtSupplierCode.Text) && string.IsNullOrEmpty(editSupplierCode)) { var IssupplierModel = supplierManager.GetSupplierByID(txtSupplierCode.Text); if (IssupplierModel != null) { CommonFunc.SetErrorProvidertoControl(ref supplierErrorProvider, ref txtSupplierCode, "Supplier code already exists", true); txtSupplierCode.Focus(); validateResult = false; isControlFocused = false; } else { supplierErrorProvider.SetError(txtSupplierCode, string.Empty); txtSupplierCode.BorderColor = CommonFunc.DefaultBorderColor; } } if (!CommonFunc.SetErrorProvidertoControl(ref supplierErrorProvider, ref txtName, "Supplier Name value required")) { if (isControlFocused) { this.txtName.Focus(); } validateResult = false; isControlFocused = false; } if (!CommonFunc.SetErrorProvidertoControl(ref supplierErrorProvider, ref txtContactPerson, "Contact Person value required")) { if (isControlFocused) { this.txtContactPerson.Focus(); } validateResult = false; isControlFocused = false; } if (!CommonFunc.validateEmailId(this.txtEmailAddress.Text.ToString()) && !string.IsNullOrEmpty(this.txtEmailAddress.Text.ToString())) { if (!CommonFunc.SetErrorProvidertoControl(ref supplierErrorProvider, ref txtEmailAddress, "E-mail should in standard E-mail format.", true)) { if (isControlFocused) { txtEmailAddress.Focus(); } validateResult = false; isControlFocused = false; } } else { supplierErrorProvider.SetError(txtEmailAddress, string.Empty); txtEmailAddress.BorderColor = CommonFunc.DefaultBorderColor; } if (!string.IsNullOrEmpty(txtVatTanNo.Text.Trim())) { if (alphanumericpatt.IsMatch(txtVatTanNo.Text) == false) { validateResult = false; if (!CommonFunc.SetCustomErrorProvidertoControl(ref supplierErrorProvider, ref txtVatTanNo, "Vat Tin No allows Alphanumeric Character", false)) { this.txtVatTanNo.Focus(); } } else { supplierErrorProvider.SetError(txtVatTanNo, string.Empty); txtVatTanNo.BorderColor = CommonFunc.DefaultBorderColor; } } if (!string.IsNullOrEmpty(txtCstTinNo.Text.Trim())) { if (alphanumericpatt.IsMatch(txtCstTinNo.Text) == false) { validateResult = false; if (!CommonFunc.SetCustomErrorProvidertoControl(ref supplierErrorProvider, ref txtCstTinNo, "CST Tin No allows Alphanumeric Character", false)) { this.txtCstTinNo.Focus(); } } else { supplierErrorProvider.SetError(txtCstTinNo, string.Empty); txtCstTinNo.BorderColor = CommonFunc.DefaultBorderColor; } } return(validateResult); } catch (Exception ex) { throw ex; } }
private void frmSupplier_Load(object sender, EventArgs e) { try { if (CommonFunc.Themeselect == "Theme 1") { ThemeChange(); } this.supplierActionButtons.btnSave.Click += new System.EventHandler(btnSave_Click); this.supplierActionButtons.btnCancel.Click += new System.EventHandler(btnCancel_Click); this.supplierActionButtons.btnClear.Click += new EventHandler(btnClear_Click); this.btnSearch.Click += new EventHandler(btnSearch_Click); txtSupplierCode.KeyPress += new KeyPressEventHandler(txtValidateSpecialCharSpace); this.setInitialFormsValidations(); this.areaCodeList = commonManager.GetAreaCodeList(); var countryList = (from p in areaCodeList where p.AreaType == (int)MaterType.Country select new DropDownModel { Code = p.AreaCode, Description = p.Description }).ToList(); masterTypeList = commonManager.GetMasterTypeList(); var paymentModesList = (from m in masterTypeList where m.CodeType == MaterType.VendorPaymentTerms.ToString() select new DropDownModel { Code = m.Code, Description = m.ShortDesc }).ToList(); var shipmentModesList = (from m in masterTypeList where m.CodeType == MaterType.VendorShipmentType.ToString() select new DropDownModel { Code = m.Code, Description = m.ShortDesc }).ToList(); CommonFunc.PopulateComboBoxDataForWindowsForm(ref cboCountry, countryList); CommonFunc.PopulateComboBoxDataForWindowsForm(ref cboPaymentMethods, paymentModesList); CommonFunc.PopulateComboBoxDataForWindowsForm(ref cboShipmentMethod, shipmentModesList); clearForm(); CommonFunc.SetCultureFromResource(this); //code added by roshan for issue id 2835 label3.Text = "Name"; lblVatTinNo.Text = "GSTNo."; lblVatTinDate.Visible = false; lblCstTinNo.Visible = false; lblCstTinDate.Visible = false; lblTinNo.Visible = false; lblServiceTaxNo.Visible = false; dtpVatTinDate.Visible = false; dtpCstTinDate.Visible = false; txtCstTinNo.Visible = false; txtTinNo.Visible = false; txtServiceTaxNo.Visible = false; } catch (System.Exception ex) { Logger.Log(ex, Logger.LogingLevel.Error); //MessageBox.Show(ex.Message); } finally { } }
private void btnSearch_Click(object sender, EventArgs e) { try { txtSiteCode.ReadOnly = false; finYearBeginDate.ReadOnly = false; finYearEndDate.ReadOnly = false; txtCountry.ReadOnly = false; txtCurrencyCode.ReadOnly = false; txtCurrencySymol.ReadOnly = false; clearForm(); var siteList = this.siteManager.GetSiteEditList().ToList(); frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid(); objSearch.Text = "Site Search"; DataTable dtSites = CommonFunc.ConvertListToDataTable(siteList); //dtUser.Columns[0].ColumnName = "s"; dtSites.Columns[0].ColumnName = "Site Code"; dtSites.Columns[1].ColumnName = "Site Name"; dtSites.Columns[2].ColumnName = "Contact Person"; dtSites.Columns[3].ColumnName = "Email Address"; objSearch.dtcommonSearch = dtSites; DataTable dtSelectedSite = new DataTable(); if (objSearch.ShowDialog() == DialogResult.OK) { dtSelectedSite = objSearch.dtSelectedList; } if (dtSelectedSite.Rows.Count > 0) { var siteDetail = this.siteManager.GetSiteByID(dtSelectedSite.Rows[0]["Site Code"].ToString()); var finYearDetails = this.siteManager.GetFinYearDetailsBySiteID(dtSelectedSite.Rows[0]["Site Code"].ToString()); var siteCurrencyDetails = this.siteManager.GetCurrencySymbol(siteDetail.LocalCurrancyCode); txtSiteCode.Text = siteDetail.SiteCode; txtSiteCode.ReadOnly = true; txtOfficialName.Text = (!string.IsNullOrEmpty(siteDetail.SiteShortName) ? siteDetail.SiteShortName : ""); txtCorporateName.Text = (!string.IsNullOrEmpty(siteDetail.SiteOfficialName) ? siteDetail.SiteOfficialName : ""); txtAddress1.Text = (!string.IsNullOrEmpty(siteDetail.SiteAddressLn1) ? siteDetail.SiteAddressLn1 : ""); txtAddress2.Text = (!string.IsNullOrEmpty(siteDetail.SiteAddressLn2) ? siteDetail.SiteAddressLn2 : ""); txtAddress3.Text = (!string.IsNullOrEmpty(siteDetail.SiteAddressLn3) ? siteDetail.SiteAddressLn3 : ""); txtEmail.Text = (!string.IsNullOrEmpty(siteDetail.EmailId) ? siteDetail.EmailId : ""); txtContactPerson.Text = (!string.IsNullOrEmpty(siteDetail.ContactPerson) ? siteDetail.ContactPerson : ""); txtContactNumber.Text = (!string.IsNullOrEmpty(siteDetail.SiteTelephone1) ? siteDetail.SiteTelephone1 : ""); if (siteDetail.FaxNo != "") { txtFaxNo.Text = siteDetail.FaxNo; } txtTaxNo.Text = (!string.IsNullOrEmpty(siteDetail.LocalSalesTaxNo) ? siteDetail.LocalSalesTaxNo : ""); txtLicenceNo.Text = (!string.IsNullOrEmpty(siteDetail.CentralSalesTaxNo) ? siteDetail.CentralSalesTaxNo : ""); // fillCountries(); txtCountry.Text = siteDetail.CountryCode; txtCurrencyCode.Text = siteDetail.LocalCurrancyCode; txtCurrencySymol.Text = siteCurrencyDetails.CurrencySymbol; txtCountry.ReadOnly = true; txtCurrencyCode.ReadOnly = true; txtCurrencySymol.ReadOnly = true; if (finYearDetails != null) { finYearBeginDate.SelectedText = (!string.IsNullOrEmpty(finYearDetails.ValidFromDt.ToString()) ? finYearDetails.ValidFromDt.ToString() : ""); finYearEndDate.SelectedText = (!string.IsNullOrEmpty(finYearDetails.ValidToDt.ToString()) ? finYearDetails.ValidToDt.ToString() : ""); finYearBeginDate.ReadOnly = true; finYearEndDate.ReadOnly = true; } lblInstallationDate.Visible = true; dtpInstallationDate.Visible = true; dtpInstallationDate.ReadOnly = false; dtpInstallationDate.SelectedText = (!string.IsNullOrEmpty(siteDetail.CreatedOn.ToString()) ? siteDetail.CreatedOn.ToString() : ""); dtpInstallationDate.ReadOnly = true; flagAddEdit = true; } objSearch.Dispose(); } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private void btnSave_Click(object sender, EventArgs e) { try { if ((IsFormValidate())) { PromotionModel promotionModel = new PromotionModel(); if (rdbFlatPrice.Checked == true) { fixedSelling = true; } else { fixedSelling = false; } if (rdoAmountOff.Checked == true) { fixedPriceOff = true; } else { fixedPriceOff = false; } if (rdoDiscountPer.Checked == true) { discPer = true; } else { discPer = false; } if (!string.IsNullOrEmpty(txtPromotionValue.Text.Trim())) { promoValue = Convert.ToDecimal(txtPromotionValue.Text.Trim()); } promotionModel.ManualPromotionModel = FillManualPromotionModel(); string prCode = ""; if (string.IsNullOrEmpty(txtPromotionId.Text.Trim())) { prCode = GetPRCode(); promotionModel.ManualPromotionModel.PromotionId = prCode; } else { prCode = txtPromotionId.Text.Trim(); } bool Status = false; if (flagAddEdit == true) { Status = this.promotionManager.UpdateManualPromotions(promotionModel); if (Status == true) { CommonFunc.ShowMessage("Promotion Updated Successfully.", MessageType.Information); } } else { promotionModel.PromotionSiteMapModel = FillPromotionSiteMapModel(); promotionModel.PromotionSiteMapModel.OfferNo = prCode; Status = this.promotionManager.AddManualPromotions(promotionModel); if (Status == true) { if (string.IsNullOrEmpty(txtPromotionId.Text.Trim())) { this.commonManager.UpdateNextID(CommonModel.SiteCode, "PR"); } CommonFunc.ShowMessage("Promotion " + prCode + " Added Successfully.", MessageType.Information); } } clearForm(); } } catch (System.Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
private bool IsFormValidate() { try { bool isValid = true; // Regex patt = new Regex("^[A-Za-z0-9]+$"); Regex alphanumericpatt = new Regex("^[A-Za-z0-9!@#$%&*()-{}.,/ ]+$"); if (!string.IsNullOrEmpty(txtPromotionId.Text.Trim())) { if (alphanumericpatt.IsMatch(txtPromotionId.Text) == false) { isValid = false; if (!CommonFunc.SetCustomErrorProvidertoControl(ref errorProvider, ref txtPromotionId, "Promotion Id allows Alphanumeric Character", false)) { this.txtPromotionId.Focus(); } } else { errorProvider.SetError(txtPromotionId, string.Empty); txtPromotionId.BorderColor = CommonFunc.DefaultBorderColor; } } if (!string.IsNullOrEmpty(txtPromotionName.Text.Trim())) { if (alphanumericpatt.IsMatch(txtPromotionName.Text) == false) { isValid = false; if (!CommonFunc.SetCustomErrorProvidertoControl(ref errorProvider, ref txtPromotionName, "Promotion Name allows Alphanumeric Character", false)) { this.txtPromotionName.Focus(); } } else { errorProvider.SetError(txtPromotionName, string.Empty); txtPromotionName.BorderColor = CommonFunc.DefaultBorderColor; } } if (string.IsNullOrEmpty(txtPromotionName.Text.Trim())) { if (!CommonFunc.SetErrorProvidertoControl(ref errorProvider, ref txtPromotionName, "Promotion name required")) { this.txtPromotionName.Focus(); isValid = false; } } else if (string.IsNullOrEmpty(txtPromotionValue.Text.Trim())) { string typeVale = "Discount Value "; if (rdbFlatPrice.Checked == true) { typeVale = "Flat Price "; } else if (rdoAmountOff.Checked == true) { typeVale = "Amount Off Value "; } if (!CommonFunc.SetErrorProvidertoControl(ref errorProvider, ref txtPromotionValue, typeVale + " required")) { this.txtPromotionValue.Focus(); isValid = false; } } else { if (rdoDiscountPer.Checked == true) { if (Convert.ToDecimal(txtPromotionValue.Value) <= Convert.ToDecimal("0")) { isValid = false; if (!CommonFunc.SetCustomErrorProvidertoControl(ref errorProvider, ref txtPromotionValue, "Promotion Value Should be Greater Than 0", false)) { this.txtPromotionValue.Focus(); return(isValid); } } if (Convert.ToDecimal(txtPromotionValue.Value) > Convert.ToDecimal("100.00")) { isValid = false; if (!CommonFunc.SetCustomErrorProvidertoControl(ref errorProvider, ref txtPromotionValue, "Promotion Value Not Greater Than 100", false)) { this.txtPromotionValue.Focus(); return(isValid); } } else { errorProvider.SetError(txtPromotionValue, string.Empty); txtPromotionValue.BorderColor = CommonFunc.DefaultBorderColor; } } else { if (Convert.ToDecimal(txtPromotionValue.Value) <= Convert.ToDecimal("0")) { isValid = false; if (!CommonFunc.SetCustomErrorProvidertoControl(ref errorProvider, ref txtPromotionValue, "Promotion Value Should be Greater Than 0", false)) { this.txtPromotionValue.Focus(); return(isValid); } } else { errorProvider.SetError(txtPromotionValue, string.Empty); txtPromotionValue.BorderColor = CommonFunc.DefaultBorderColor; } } } if (!string.IsNullOrEmpty(txtPromotionId.Text.Trim()) && flagAddEdit == false) { var promotionDetail = this.promotionManager.GetPromotionById(txtPromotionId.Text.Trim()); if (promotionDetail != null) { isValid = false; if (!CommonFunc.SetCustomErrorProvidertoControl(ref errorProvider, ref txtPromotionId, "Promotion already Exists", false)) { this.txtPromotionId.Focus(); } } else { errorProvider.SetError(txtPromotionId, string.Empty); txtPromotionId.BorderColor = CommonFunc.DefaultBorderColor; } } return(isValid); } catch (Exception ex) { throw (ex); } }
private void btnSearch_Click(object sender, EventArgs e) { try { txtPromotionId.ReadOnly = false; //AuthUserModelEdit userSelectedList = null; var promoList = this.promotionManager.GetManualPromotions(); if (promoList != null && promoList.Count > 0) { //frmCommonSearch objSearch = new frmCommonSearch(); //objSearch.DataList = userList; frmCommonSearchTrueGrid objSearch = new frmCommonSearchTrueGrid(); objSearch.Text = "Promotion Search"; DataTable dtPromotion = CommonFunc.ConvertListToDataTable(promoList); // dtPromotion.Columns[0].ColumnName = "All"; dtPromotion.Columns[0].ColumnName = "Promotion Id"; dtPromotion.Columns[1].ColumnName = "Promotion Name"; dtPromotion.Columns[2].ColumnName = "Promotion Value"; dtPromotion.Columns[0].Caption = "PromotionId"; dtPromotion.Columns[1].Caption = "PromotionName"; dtPromotion.Columns[2].Caption = "PromotionValue"; objSearch.dtcommonSearch = dtPromotion; DataTable dtSelectedPromotion = new DataTable(); if (objSearch.ShowDialog() == DialogResult.OK) { dtSelectedPromotion = objSearch.dtSelectedList; } //userSelectedList = (objSearch.neTbl).Cast<AuthUserModelEdit>().FirstOrDefault(); if (dtSelectedPromotion.Rows.Count > 0) { var promotionDetail = this.promotionManager.GetPromotionById(dtSelectedPromotion.Rows[0]["Promotion Id"].ToString()); txtPromotionId.Text = promotionDetail.PromotionId; txtPromotionId.ReadOnly = true; txtPromotionName.Text = promotionDetail.PromotionName; txtPromotionValue.Text = promotionDetail.PromotionValue.ToString(); if (promotionDetail.IsApproved == true) { chkPromoActive.Checked = true; } else { chkPromoActive.Checked = false; } if (promotionDetail.FixedSelling == true) { rdbFlatPrice.Checked = true; } else if (promotionDetail.FixedPriceOff == true) { rdoAmountOff.Checked = true; } else if (promotionDetail.DiscPer == true) { rdoDiscountPer.Checked = true; } flagAddEdit = true; } else { txtPromotionId.ReadOnly = true; } objSearch.Dispose(); } else { CommonFunc.ShowMessage("No Records to display.", MessageType.Information); } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }