public static void SelectProductLine(Int32 Index, Boolean Temporary = false) { try { ProductLine CurrProductLine; if (Temporary) { CurrProductLine = ListProductLines[Index]; } else { SelectedProductLineIndex = Index; CurrProductLine = ListProductLines[SelectedProductLineIndex]; } ObjGeneralSettings = CurrProductLine.ObjSettings.GeneralSettings; ObjInvoiceSettings = CurrProductLine.ObjSettings.InvoiceSettings; ObjQuotationSettings = CurrProductLine.ObjSettings.QuotationSettings; ObjPurchaseOrderSettings = CurrProductLine.ObjSettings.PurchaseOrderSettings; ObjProductMaster = CurrProductLine.ObjProductMaster; ObjSellerMaster = CurrProductLine.ObjSellerMaster; ObjVendorMaster = CurrProductLine.ObjVendorMaster; } catch (Exception ex) { ShowErrorDialog("CommonFunctions.SelectProductLine()", ex); throw; } }
public void LoadVendorMaster(DataTable dtVendorMaster, DataTable dtDiscountGroupMaster) { try { ObjVendorMaster = new VendorMaster(); ObjVendorMaster.Initialize(); #region Load Line from Vendor Master CommonFunctions.ListVendorLines = new List <String>(); Boolean ContainsBlanks = false; for (int i = 0; i < dtVendorMaster.Rows.Count; i++) { DataRow dtRow = dtVendorMaster.Rows[i]; String Line = dtRow["Line"].ToString().Replace("<", "").Replace(">", "").ToUpper(); if (Line.Trim().Length == 0) { ContainsBlanks = true; } else if (!CommonFunctions.ListVendorLines.Contains(Line)) { CommonFunctions.ListVendorLines.Add(Line); } } CommonFunctions.ListVendorLines.Sort(); CommonFunctions.ListVendorLines.Insert(0, "<All>"); if (ContainsBlanks) { CommonFunctions.ListVendorLines.Add("<Blanks>"); } #endregion #region Load Discount Groups for (int i = 0; i < dtDiscountGroupMaster.Rows.Count; i++) { DataRow dtRow = dtDiscountGroupMaster.Rows[i]; //DiscountGroup Discount DiscountType Default Description DiscountGroupDetails ObjDiscountGroupDetails = new DiscountGroupDetails(); ObjDiscountGroupDetails.Name = dtRow["DiscountGroup"].ToString().Trim(); ObjDiscountGroupDetails.Discount = Double.Parse(dtRow["Discount"].ToString().Trim()); ObjDiscountGroupDetails.DiscountType = PriceGroupDetails.GetDiscountType(dtRow["DiscountType"].ToString().Trim()); ObjDiscountGroupDetails.IsDefault = (Int32.Parse(dtRow["Default"].ToString().Trim()) == 1); ObjDiscountGroupDetails.Description = dtRow["Description"].ToString().Trim(); ObjVendorMaster.AddDiscountGroupToCache(ObjDiscountGroupDetails); } #endregion #region Load Vendor Details for (int i = 0; i < dtVendorMaster.Rows.Count; i++) { DataRow dtRow = dtVendorMaster.Rows[i]; //SlNo VendorName Address TINNumber Phone Line OldBalance PriceGroup DiscountGroup VendorDetails ObjVendorDetails = new VendorDetails(); ObjVendorDetails.VendorName = dtRow["VendorName"].ToString().Trim(); ObjVendorDetails.Address = dtRow["Address"].ToString().Trim(); ObjVendorDetails.TINNumber = dtRow["TINNumber"].ToString().Trim(); ObjVendorDetails.Phone = dtRow["Phone"].ToString().Trim(); ObjVendorDetails.Line = dtRow["Line"].ToString().Trim(); ObjVendorDetails.PriceGroup = ""; ObjVendorDetails.DiscountGroup = ""; if (dtRow["PriceGroup"] != DBNull.Value && dtRow["PriceGroup"].ToString().Trim().Length > 0) { ObjVendorDetails.PriceGroup = dtRow["PriceGroup"].ToString().Trim(); } if (dtRow["DiscountGroup"] != DBNull.Value && dtRow["DiscountGroup"].ToString().Trim().Length > 0) { ObjVendorDetails.DiscountGroup = dtRow["DiscountGroup"].ToString().Trim(); } ObjVendorMaster.AddVendorToCache(ObjVendorDetails, ObjProductMaster.ListPriceGroups); } #endregion } catch (Exception ex) { CommonFunctions.ShowErrorDialog("ProductLine.LoadVendorMaster()", ex); } }