Esempio n. 1
0
 private static SqlParameter[] CreateSqlParameter(ARAgentRate model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@CompanyID", model.CompanyID),
         new SqlParameter("@ProviderID", model.ProviderID),
         new SqlParameter("@RateID", model.RateID),
         new SqlParameter("@CustomerID", model.CustomerID),
         new SqlParameter("@BalanceAmt", model.BalanceAmt),
         new SqlParameter("@CuryBalanceAmt", model.CuryBalanceAmt),
         new SqlParameter("@WinLossSumAmt", model.WinLossSumAmt),
     });
 }
Esempio n. 2
0
        public static ARAgentRate UpdateItem(ARAgentRate model)
        {
            String result = String.Empty;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "ARAgentRate_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (String)reader[0];
                }
            }
            return(GetItemByID(model.CustomerID, model.CompanyID, model.ProviderID));
        }
Esempio n. 3
0
        public static ARAgentRateCollection Search(SearchFilter SearchKey)
        {
            ARAgentRateCollection collection = new ARAgentRateCollection();

            using (var reader = SqlHelper.ExecuteReader("ARAgentRate_Search", SearchFilterManager.SqlSearchParam(SearchKey)))
            {
                while (reader.Read())
                {
                    ARAgentRate obj = new ARAgentRate();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Esempio n. 4
0
        private static ARAgentRate GetItemFromReader(IDataReader dataReader)
        {
            ARAgentRate objItem = new ARAgentRate();

            objItem.CompanyID = SqlHelper.GetInt(dataReader, "CompanyID");

            objItem.ProviderID = SqlHelper.GetInt(dataReader, "ProviderID");

            objItem.RateID = SqlHelper.GetInt(dataReader, "RateID");

            objItem.CustomerID = SqlHelper.GetString(dataReader, "CustomerID");



            if (SqlHelper.ColumnExists(dataReader, "TotalRecord"))
            {
                objItem.TotalRecord = SqlHelper.GetInt(dataReader, "TotalRecord");
            }

            if (SqlHelper.ColumnExists(dataReader, "SharingPer"))
            {
                objItem.Sharing = SqlHelper.GetInt(dataReader, "SharingPer");
            }
            if (SqlHelper.ColumnExists(dataReader, "Name"))
            {
                objItem.Name = SqlHelper.GetString(dataReader, "Name");
            }
            if (SqlHelper.ColumnExists(dataReader, "Rate"))
            {
                objItem.Rate = SqlHelper.GetDecimal(dataReader, "Rate");
            }
            if (SqlHelper.ColumnExists(dataReader, "BalanceAmt"))
            {
                objItem.BalanceAmt = SqlHelper.GetDecimal(dataReader, "BalanceAmt");
            }
            if (SqlHelper.ColumnExists(dataReader, "CuryBalanceAmt"))
            {
                objItem.CuryBalanceAmt = SqlHelper.GetDecimal(dataReader, "CuryBalanceAmt");
            }
            if (SqlHelper.ColumnExists(dataReader, "WinLossSumAmt"))
            {
                objItem.WinLossSumAmt = SqlHelper.GetDecimal(dataReader, "WinLossSumAmt");
            }
            return(objItem);
        }
Esempio n. 5
0
        public static ARAgentRate AddItem(ARAgentRate model)
        {
            String result = String.Empty;

            try
            {
                using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "ARAgentRate_Add", CreateSqlParameter(model)))
                {
                    while (reader.Read())
                    {
                        result = (String)reader[0];
                    }
                }
            }
            catch (Exception ObjEx)
            {
            }
            return(GetItemByID(result, model.CompanyID, model.ProviderID));
        }
Esempio n. 6
0
        public static ARAgentRate GetItemByID(string CustomerID, int CompanyID, int ProviderID)
        {
            ARAgentRate item      = new ARAgentRate();
            var         sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CustomerID", CustomerID),
                new SqlParameter("@CompanyID", CompanyID),
                new SqlParameter("@ProviderID", ProviderID),
            };

            using (var reader = SqlHelper.ExecuteReader("ARAgentRate_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
Esempio n. 7
0
        public static ARAgentRateCollection GetAllItem(int CompanyID, string CustomerID)
        {
            ARAgentRateCollection collection = new ARAgentRateCollection();

            var sqlParams = new SqlParameter[]
            {
                new SqlParameter("@CompanyID", CompanyID),
                new SqlParameter("@CustomerID", CustomerID),
            };

            using (var reader = SqlHelper.ExecuteReader("ARAgentRate_GetAll", sqlParams))
            {
                while (reader.Read())
                {
                    ARAgentRate obj = new ARAgentRate();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }