Пример #1
0
        public List <TaxType> GetAllTaxType(TaxTypeAdvanceSearch taxTypeAdvanceSearch)
        {
            List <TaxType> taxTypeList = null;

            try
            {
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[PSA].[GetAllTaxType]";
                        cmd.Parameters.Add("@SearchValue", SqlDbType.NVarChar, -1).Value = string.IsNullOrEmpty(taxTypeAdvanceSearch.SearchTerm) ? "" : taxTypeAdvanceSearch.SearchTerm.Trim();
                        cmd.Parameters.Add("@RowStart", SqlDbType.Int).Value             = taxTypeAdvanceSearch.DataTablePaging.Start;
                        if (taxTypeAdvanceSearch.DataTablePaging.Length == -1)
                        {
                            cmd.Parameters.AddWithValue("@Length", DBNull.Value);
                        }
                        else
                        {
                            cmd.Parameters.Add("@Length", SqlDbType.Int).Value = taxTypeAdvanceSearch.DataTablePaging.Length;
                        }
                        cmd.CommandType = CommandType.StoredProcedure;
                        using (SqlDataReader sdr = cmd.ExecuteReader())
                        {
                            if ((sdr != null) && (sdr.HasRows))
                            {
                                taxTypeList = new List <TaxType>();
                                while (sdr.Read())
                                {
                                    TaxType taxType = new TaxType();
                                    {
                                        taxType.Code           = (sdr["Code"].ToString() != "" ? int.Parse(sdr["Code"].ToString()) : taxType.Code);
                                        taxType.Description    = (sdr["Description"].ToString() != "" ? sdr["Description"].ToString() : taxType.Description);
                                        taxType.CGSTPercentage = (sdr["CGSTPercentage"].ToString() != "" ? decimal.Parse(sdr["CGSTPercentage"].ToString()) : taxType.CGSTPercentage);
                                        taxType.SGSTPercentage = (sdr["SGSTPercentage"].ToString() != "" ? decimal.Parse(sdr["SGSTPercentage"].ToString()) : taxType.SGSTPercentage);
                                        taxType.IGSTPercentage = (sdr["IGSTPercentage"].ToString() != "" ? decimal.Parse(sdr["IGSTPercentage"].ToString()) : taxType.IGSTPercentage);
                                        taxType.TotalCount     = (sdr["TotalCount"].ToString() != "" ? int.Parse(sdr["TotalCount"].ToString()) : taxType.TotalCount);
                                        taxType.FilteredCount  = (sdr["FilteredCount"].ToString() != "" ? int.Parse(sdr["FilteredCount"].ToString()) : taxType.FilteredCount);
                                    }
                                    taxTypeList.Add(taxType);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(taxTypeList);
        }
Пример #2
0
 public List <TaxType> GetAllTaxType(TaxTypeAdvanceSearch taxTypeAdvanceSearch)
 {
     return(_taxTypeRepository.GetAllTaxType(taxTypeAdvanceSearch));
 }