private void btnAddArticle_Click(object sender, EventArgs e) { try { bool isValid = true; if (!CommonFunc.SetErrorProvidertoControlForWindowsForm(ref Itemerrorprovider, ref cmbStockOutReason, "Stock Out Reason required")) { this.cmbStockOutReason.Focus(); isValid = false; } if ((string)cmbStockOutReason.SelectedValue == "SupplierReturn" || (string)cmbStockOutReason.SelectedValue == "WriteOff") { if (!CommonFunc.SetErrorProvidertoControlForWindowsForm(ref Itemerrorprovider, ref cmbFromLocation, "From Location Reason required")) { this.cmbFromLocation.Focus(); isValid = false; } } if (!isValid) { return; } string supplierCode = ""; if (cmbSupplierName.SelectedValue != null) { supplierCode = (cmbSupplierName.SelectedValue != "Select") ? cmbSupplierName.SelectedValue.ToString() : string.Empty; } var articleList = this.articleManager.GetArticlePurchaseList(supplierCode); 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); List <ArticlePurchaseStockoutModel> selectedIArticleList = DataTableToList.ToList <ArticlePurchaseStockoutModel>(dtSelectedItems); AddSelectedArticlesIntoGrid(selectedIArticleList); } objSearch.Dispose(); } 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> /// 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); } }
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); } }
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); } }