Ejemplo n.º 1
0
        public void AddSellerToCache(SellerDetails ObjSellerDetails, List <PriceGroupDetails> ListPriceGroups)
        {
            try
            {
                Int32 SellerIndex = ListSellerDetails.BinarySearch(ObjSellerDetails, ObjSellerDetails);
                if (SellerIndex < 0)
                {
                    ListSellerDetails.Insert(~SellerIndex, ObjSellerDetails);

                    ObjSellerDetails.LineIndex          = CommonFunctions.ListSellerLines.FindIndex(e => e.Equals(ObjSellerDetails.Line, StringComparison.InvariantCultureIgnoreCase));
                    ObjSellerDetails.PriceGroupIndex    = ListPriceGroups.FindIndex(e => e.Name.Equals(ObjSellerDetails.PriceGroup, StringComparison.InvariantCultureIgnoreCase));
                    ObjSellerDetails.DiscountGroupIndex = ListDiscountGroups.FindIndex(e => e.Name.Equals(ObjSellerDetails.DiscountGroup, StringComparison.InvariantCultureIgnoreCase));
                }
            }
            catch (Exception ex)
            {
                CommonFunctions.ShowErrorDialog("SellerMaster.AddSellerToCache()", ex);
            }
        }
Ejemplo n.º 2
0
        public SellerDetails GetSellerDetails(String SellerName)
        {
            try
            {
                SellerDetails ObjSellerDetails = new SellerDetails();
                ObjSellerDetails.Name = SellerName.Trim();

                Int32 Index = ListSellerDetails.BinarySearch(ObjSellerDetails, ObjSellerDetails);
                if (Index < 0)
                {
                    return(null);
                }
                return(ListSellerDetails[Index]);
            }
            catch (Exception ex)
            {
                CommonFunctions.ShowErrorDialog("SellerMaster.GetSellerDetails()", ex);
            }
            return(null);
        }
Ejemplo n.º 3
0
        public DiscountGroupDetails GetSellerDiscount(String SellerName)
        {
            try
            {
                SellerDetails ObjSellerDetails = GetSellerDetails(SellerName);
                if (ObjSellerDetails == null)
                {
                    return(null);
                }
                Int32 DiscountGroupIndex = ObjSellerDetails.DiscountGroupIndex;
                if (DiscountGroupIndex < 0)
                {
                    DiscountGroupIndex = DefaultDiscountGroupIndex;
                }

                return(ListDiscountGroups[DiscountGroupIndex]);
            }
            catch (Exception ex)
            {
                CommonFunctions.ShowErrorDialog("SellerMaster.GetSellerDiscount()", ex);
            }
            return(null);
        }
Ejemplo n.º 4
0
        public void LoadSellerMaster(DataTable dtSellerMaster, DataTable dtDiscountGroupMaster)
        {
            try
            {
                ObjSellerMaster = new SellerMaster();
                ObjSellerMaster.Initialize();

                #region Load Line from Seller Master
                CommonFunctions.ListSellerLines = new List <String>();
                Boolean ContainsBlanks = false;
                for (int i = 0; i < dtSellerMaster.Rows.Count; i++)
                {
                    DataRow dtRow = dtSellerMaster.Rows[i];
                    String  Line  = dtRow["Line"].ToString().Replace("<", "").Replace(">", "").ToUpper();
                    if (Line.Trim().Length == 0)
                    {
                        ContainsBlanks = true;
                    }
                    else if (!CommonFunctions.ListSellerLines.Contains(Line))
                    {
                        CommonFunctions.ListSellerLines.Add(Line);
                    }
                }

                CommonFunctions.ListSellerLines.Sort();
                CommonFunctions.ListSellerLines.Insert(0, "<All>");
                if (ContainsBlanks)
                {
                    CommonFunctions.ListSellerLines.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();

                    ObjSellerMaster.AddDiscountGroupToCache(ObjDiscountGroupDetails);
                }
                #endregion

                #region Load Sellers Details
                for (int i = 0; i < dtSellerMaster.Rows.Count; i++)
                {
                    DataRow dtRow = dtSellerMaster.Rows[i];
                    //SlNo	SellerName	Address	TINNumber	Phone	Line	OldBalance	PriceGroup	DiscountGroup

                    SellerDetails ObjSellerDetails = new SellerDetails();
                    ObjSellerDetails.Name          = dtRow["SellerName"].ToString().Trim();
                    ObjSellerDetails.Address       = dtRow["Address"].ToString().Trim();
                    ObjSellerDetails.TINNumber     = dtRow["TINNumber"].ToString().Trim();
                    ObjSellerDetails.Phone         = dtRow["Phone"].ToString().Trim();
                    ObjSellerDetails.Line          = dtRow["Line"].ToString().Trim();
                    ObjSellerDetails.OldBalance    = 0;
                    ObjSellerDetails.PriceGroup    = "";
                    ObjSellerDetails.DiscountGroup = "";
                    ObjSellerDetails.State         = "";
                    ObjSellerDetails.StateCode     = "";
                    ObjSellerDetails.GSTIN         = "";

                    if (dtRow["OldBalance"] != DBNull.Value && dtRow["OldBalance"].ToString().Trim().Length > 0)
                    {
                        ObjSellerDetails.OldBalance = Double.Parse(dtRow["OldBalance"].ToString().ToString());
                    }
                    if (dtRow["PriceGroup"] != DBNull.Value && dtRow["PriceGroup"].ToString().Trim().Length > 0)
                    {
                        ObjSellerDetails.PriceGroup = dtRow["PriceGroup"].ToString().Trim();
                    }
                    if (dtRow["DiscountGroup"] != DBNull.Value && dtRow["DiscountGroup"].ToString().Trim().Length > 0)
                    {
                        ObjSellerDetails.DiscountGroup = dtRow["DiscountGroup"].ToString().Trim();
                    }
                    if (dtRow["State"] != DBNull.Value && dtRow["State"].ToString().Trim().Length > 0)
                    {
                        ObjSellerDetails.State = dtRow["State"].ToString().Trim();
                    }
                    if (dtRow["StateCode"] != DBNull.Value && dtRow["StateCode"].ToString().Trim().Length > 0)
                    {
                        ObjSellerDetails.StateCode = dtRow["StateCode"].ToString().Trim();
                    }
                    if (dtRow["GSTIN"] != DBNull.Value && dtRow["GSTIN"].ToString().Trim().Length > 0)
                    {
                        ObjSellerDetails.GSTIN = dtRow["GSTIN"].ToString().Trim();
                    }

                    ObjSellerMaster.AddSellerToCache(ObjSellerDetails, ObjProductMaster.ListPriceGroups);
                }
                #endregion
            }
            catch (Exception ex)
            {
                CommonFunctions.ShowErrorDialog("ProductLine.LoadSellerMaster()", ex);
            }
        }