private void GetItemListDropDown() { try { DropDownItemName.Refresh(); DcItemList.Clear(); DtItemList = CmC.GetMasterNamesAndCodes("", 0, 1); if (DtItemList.Rows.Count > 0) { DcItemList.Add("0", CmC.FirstElementInSelect); foreach (DataRow DtCol in DtItemList.Rows) { DcItemList.Add(DtCol[0].ToString(), DtCol[1].ToString()); } DropDownItemName.DataSource = new BindingSource(DcItemList, null); DropDownItemName.DisplayMember = "Value"; DropDownItemName.ValueMember = "Key"; } } catch (Exception _exception) { CmC.InsertException(_exception); messageShow.singlemsgtext(CmC.ExceptionErrorMessage); } }
private void ResetControlles() { BtnInsertUpdate.Text = "Save"; GetProductMasterList(""); TxtProductName.Text = ""; TxtSearchItem._TextBox.Text = ""; GetItemListDropDown(); DropDownItemName.Focus(); }
private string ValidateLineControlles() { string ValidateMessage = string.Empty; if (DropDownItemName.SelectedIndex <= 0) { DropDownItemName.Focus(); return("Please select the Item Name."); } if (DropDownProductName.SelectedIndex <= 0) { DropDownProductName.Focus(); return("Please select the Product Name."); } if (DropDownBrandName.SelectedIndex <= 0) { DropDownBrandName.Focus(); return("Please select the Brand Name."); } if (DropDownColorName.SelectedIndex <= 0) { DropDownColorName.Focus(); return("Please select the Color"); } if (string.IsNullOrEmpty(TxtNoItems.Text.ToString())) { TxtNoItems.Focus(); return("Please enter the number of Items"); } if (DropDownUnit.SelectedIndex <= 0) { DropDownUnit.Focus(); return("Please select the Unit."); } if (string.IsNullOrEmpty(TxtPurchasePrice.Text.ToString())) { TxtPurchasePrice.Focus(); return("Please enter the purchase price"); } if (string.IsNullOrEmpty(TxtSalesPrice.Text.ToString())) { TxtSalesPrice.Focus(); return("Please enter the sales price"); } if (string.IsNullOrEmpty(TxtCgstPer.Text.ToString())) { TxtCgstPer.Focus(); return("Please enter the Cgst percentage"); } if (string.IsNullOrEmpty(TxtSgstPer.Text.ToString())) { TxtSgstPer.Focus(); return("Please enter the Sgst percentage"); } return(ValidateMessage); }
private void ResetAllControls() { BtnInsertUpdate.Text = "Save"; GetBrandMasterList(""); TxtBrandName.Text = ""; TxtSearchItem._TextBox.Text = ""; EmptyItemListDropDown(); GetItemList(); DropDownItemName.Focus(); }
private void Product_Load(object sender, EventArgs e) { LblHeaderText.BackColor = Color.FromName(CmC.LblBackColor); LblHeaderText.Font = new Font(CmC.LblFontStyle, CmC.LblFontSize); //, 17pt, style=Bold LblHeaderText.Font = new Font(LblHeaderText.Font, FontStyle.Bold); LblHeaderText.ForeColor = Color.FromName(CmC.LblFontColor); DropDownItemName.Focus(); this.AcceptButton = BtnInsertUpdate; GetItemListDropDown(); GetProductMasterList(""); }
private void BtnInsertUpdate_Click(object sender, EventArgs e) { try { if (DropDownItemName.SelectedIndex <= 0) { messageShow.singlemsgtext("Please select the Item Name."); DropDownItemName.Focus(); return; } if (DropDownProductName.SelectedIndex <= 0) { messageShow.singlemsgtext("Please select the Product Name."); DropDownProductName.Focus(); return; } if (string.IsNullOrEmpty(TxtBrandName.Text.ToString())) { messageShow.singlemsgtext("Brand name should not be empty"); TxtBrandName.Focus(); return; } SelectedProductCode = Convert.ToInt32(((KeyValuePair <string, string>)DropDownProductName.SelectedItem).Key.ToString()); var brand_master = new BrandMaster { BrandName = TxtBrandName.Text.ToString(), ProductCode = SelectedProductCode, BrandCode = BrandCode, OperationType = BtnInsertUpdate.Text.ToString() == "Save" ? 1 : 2 }; int id = _instanceRepository.InsertUpdateDeleteBrandMaster(brand_master); if (id >= 1) { messageShow.singlemsgtext(brand_master.OperationType == 1 ? "New Brand added successfully" : "Brand updated successfully"); brand_master.BrandName = ""; ResetAllControls(); } else if (id == -1) { messageShow.singlemsgtext("The brand name already exists, please try another name!"); } else { messageShow.singlemsgtext("Error in Brand insert/update"); } } catch (Exception _exception) { CmC.InsertException(_exception); messageShow.singlemsgtext(CmC.ExceptionErrorMessage); } }
private void Purchase_Load(object sender, EventArgs e) { LblHeaderText.BackColor = Color.FromName(CmC.LblBackColor); LblHeaderText.Font = new Font(CmC.LblFontStyle, CmC.LblFontSize); //, 17pt, style=Bold LblHeaderText.Font = new Font(LblHeaderText.Font, FontStyle.Bold); LblHeaderText.ForeColor = Color.FromName(CmC.LblFontColor); DropDownItemName.Focus(); datagriddesign(); GetItemList(); GetSupplierNameList(); GetUnitAndPaymentTypeDropDown(); }
public void GetItemList() { try { DtItemList.Clear(); DcItemList.Clear(); DropDownItemName.Refresh(); DtItemList = CmC.GetMasterNamesAndCodes("", 0, 1); if (DtItemList.Rows.Count > 0) { DropDownItemName.DataSource = new BindingSource(CmC.ConvertDataTableToDictionary(DtItemList), null); DropDownItemName.DisplayMember = "Value"; DropDownItemName.ValueMember = "Key"; } } catch (Exception _exception) { CmC.InsertException(_exception); messageShow.singlemsgtext(CmC.ExceptionErrorMessage); } }
private string ValidateLineControlles() { string ValidateMessage = string.Empty; if (DropDownItemName.SelectedIndex <= 0) { DropDownItemName.Focus(); return("Please select the Item Name."); } if (DropDownProductName.SelectedIndex <= 0) { DropDownProductName.Focus(); return("Please select the Product Name."); } if (DropDownBrandName.SelectedIndex <= 0) { DropDownBrandName.Focus(); return("Please select the Brand Name."); } if (DropDownColorName.SelectedIndex <= 0) { DropDownColorName.Focus(); return("Please select the Color"); } if (string.IsNullOrEmpty(TxtNoOfItems.Text.ToString())) { TxtNoOfItems.Focus(); return("Please enter the number of Items"); } if (string.IsNullOrEmpty(TxtDiscountHeader.Text.ToString())) { TxtDiscountHeader.Focus(); return("Please enter the discount price"); } return(ValidateMessage); }
private void BtnInsertUpdate_Click(object sender, EventArgs e) { try { if (DropDownItemName.SelectedIndex <= 0) { messageShow.singlemsgtext("Please select the Item Name"); DropDownItemName.Focus(); return; } if (string.IsNullOrEmpty(TxtProductName.Text.ToString())) { messageShow.singlemsgtext("Product name should not be empty"); TxtProductName.Focus(); return; } if (string.IsNullOrEmpty(TxtMinimumStockNotify.Text.ToString())) { messageShow.singlemsgtext("Minimum stock notification should not be empty"); TxtMinimumStockNotify.Focus(); return; } else { if (Convert.ToInt32(TxtMinimumStockNotify.Text.ToString()) < 0) { messageShow.singlemsgtext("Minimum stock notification should be greater than zero"); TxtMinimumStockNotify.Focus(); return; } } var product_master = new ProductMaster { ProductName = TxtProductName.Text.ToString(), MinimumStockNotification = Convert.ToInt32(TxtMinimumStockNotify.Text.ToString()), ItemCode = Convert.ToInt32(((KeyValuePair <string, string>)DropDownItemName.SelectedItem).Key.ToString()), ProductCode = ProductCode, OperationType = BtnInsertUpdate.Text.ToString() == "Save" ? 1 : 2 }; int id = _instanceRepository.InsertUpdateDeleteProductMaster(product_master); if (id >= 1) { messageShow.singlemsgtext(product_master.OperationType == 1 ? "New Product added successfully" : "Product updated successfully"); product_master.ProductName = ""; ResetControlles(); } else if (id == -1) { messageShow.singlemsgtext("The product name already exists, please try another name!"); } else { messageShow.singlemsgtext("Error in Product insert/update"); } } catch (Exception _exception) { CmC.InsertException(_exception); messageShow.singlemsgtext(CmC.ExceptionErrorMessage); } }