Ejemplo n.º 1
0
        void LoadHSNMasterData(DataTable dtHSNMaster)
        {
            try
            {
                List <TaxGroupDetails> ListTaxGroupDetails = ObjProductMaster.ListTaxGroupDetails;
                ListTaxGroupDetails.Clear();

                String[] ArrTaxName = new String[] { "CGST", "SGST", "IGST" };
                String[] ArrTaxDesc = new String[] { "Central Goods and Service Tax", "State Goods and Service Tax", "Inter Goods and Service Tax" };
                for (int i = 0; i < ArrTaxName.Length; i++)
                {
                    TaxGroupDetails ObjTaxGroupDetails = new TaxGroupDetails();
                    ObjTaxGroupDetails.Name    = ArrTaxName[i]; ObjTaxGroupDetails.Description = ArrTaxDesc[i];
                    ObjTaxGroupDetails.TaxRate = 0;
                    ListTaxGroupDetails.Add(ObjTaxGroupDetails);
                }

                Int32[] TaxColIndexes = new Int32[ListTaxGroupDetails.Count];
                for (int i = 0; i < TaxColIndexes.Length; i++)
                {
                    for (int j = 0; j < dtHSNMaster.Columns.Count; j++)
                    {
                        if (dtHSNMaster.Columns[j].ColumnName.Equals(ListTaxGroupDetails[i].Name, StringComparison.InvariantCultureIgnoreCase))
                        {
                            TaxColIndexes[i] = j;
                            break;
                        }
                    }
                }

                for (int i = 0; i < dtHSNMaster.Rows.Count; i++)
                {
                    DataRow dr = dtHSNMaster.Rows[i];

                    if (dr["HSNCode"] == DBNull.Value || String.IsNullOrEmpty(dr["HSNCode"].ToString()))
                    {
                        continue;
                    }

                    HSNCodeDetails ObjHSNCodeDetails = new HSNCodeDetails();
                    ObjHSNCodeDetails.HSNCode      = dr["HSNCode"].ToString();
                    ObjHSNCodeDetails.ListTaxRates = new Double[TaxColIndexes.Length];
                    for (int j = 0; j < TaxColIndexes.Length; j++)
                    {
                        ObjHSNCodeDetails.ListTaxRates[j] = Double.Parse(dr[ListTaxGroupDetails[j].Name].ToString());
                    }

                    ObjProductMaster.AddHSNCode(ObjHSNCodeDetails);
                }
            }
            catch (Exception ex)
            {
                CommonFunctions.ShowErrorDialog("ProductLine.LoadHSNMasterData()", ex);
            }
        }
Ejemplo n.º 2
0
 public void AddHSNCode(HSNCodeDetails ObjHSNCodeDetails)
 {
     try
     {
         //Add HSNCode to ListHSNCodeDetails
         Int32 HSNCodeIndex = ListHSNCodeDetails.BinarySearch(ObjHSNCodeDetails, ObjHSNCodeDetails);
         if (HSNCodeIndex < 0)
         {
             ListHSNCodeDetails.Insert(~HSNCodeIndex, ObjHSNCodeDetails);
         }
     }
     catch (Exception ex)
     {
         CommonFunctions.ShowErrorDialog("ProductMaster.AddHSNCode()", ex);
     }
 }
Ejemplo n.º 3
0
        public void UpdateHSNProductIndexes()
        {
            try
            {
                for (int i = 0; i < ListProducts.Count; i++)
                {
                    HSNCodeDetails ObjHSNCodeDetails = new HSNCodeDetails();
                    ObjHSNCodeDetails.HSNCode = ListProducts[i].HSNCode;

                    Int32 HSNCodeIndex = ListHSNCodeDetails.BinarySearch(ObjHSNCodeDetails, ObjHSNCodeDetails);
                    if (HSNCodeIndex >= 0)
                    {
                        ListProducts[i].HSNCodeIndex = HSNCodeIndex;
                    }
                }
            }
            catch (Exception ex)
            {
                CommonFunctions.ShowErrorDialog("ProductMaster.UpdateHSNProductIndexes()", ex);
            }
        }
Ejemplo n.º 4
0
        HSNCodeDetails GetHSNCodeDetails(String HSNCode)
        {
            try
            {
                HSNCodeDetails ObjHSNCodeDetails = new HSNCodeDetails();
                ObjHSNCodeDetails.HSNCode = HSNCode;
                Int32 HSNCodeIndex = ListHSNCodeDetails.BinarySearch(ObjHSNCodeDetails, ObjHSNCodeDetails);

                if (HSNCodeIndex < 0)
                {
                    return(null);
                }

                return(ListHSNCodeDetails[HSNCodeIndex]);
            }
            catch (Exception ex)
            {
                CommonFunctions.ShowErrorDialog("ProductMaster.GetHSNCodeDetails()", ex);
            }
            return(null);
        }