Ejemplo n.º 1
0
        public static UserHistory UpdateItem(UserHistory model)
        {
            String result = String.Empty;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "tblUserHistory_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (String)reader[0];
                }
            }
            return(GetItemByID(result));
        }
Ejemplo n.º 2
0
        public static UserHistoryCollection GetAllItem()
        {
            UserHistoryCollection collection = new UserHistoryCollection();

            using (var reader = SqlHelper.ExecuteReader("tblUserHistory_GetAll", null))
            {
                while (reader.Read())
                {
                    UserHistory obj = new UserHistory();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Ejemplo n.º 3
0
        public static UserHistory GetItemByID(String userName)
        {
            UserHistory item      = new UserHistory();
            var         sqlParams = new SqlParameter[1];

            sqlParams[0] = new SqlParameter("@UserName", userName);
            using (var reader = SqlHelper.ExecuteReader("tblUserHistory_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
Ejemplo n.º 4
0
        public static UserHistory AddItem(UserHistory model)
        {
            String result = String.Empty;

            try
            {
                using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "tblUserHistory_Add", CreateSqlParameter(model)))
                {
                    while (reader.Read())
                    {
                        result = (String)reader[0];
                    }
                }
            }
            catch (Exception objEx)
            {
                result = objEx.Message;
            }
            return(GetItemByID(result));
        }
Ejemplo n.º 5
0
        private static UserHistory GetItemFromReader(IDataReader dataReader)
        {
            UserHistory objItem = new UserHistory();

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

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

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

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

            objItem.Payment = SqlHelper.GetDecimal(dataReader, "Payment");

            objItem.CuryPayment = SqlHelper.GetDecimal(dataReader, "CuryPayment");

            objItem.ReceiveAmt = SqlHelper.GetDecimal(dataReader, "ReceiveAmt");

            objItem.CuryReceiveAmt = SqlHelper.GetDecimal(dataReader, "CuryReceiveAmt");

            objItem.SaleAmt = SqlHelper.GetDecimal(dataReader, "SaleAmt");

            objItem.CurySaleAmt = SqlHelper.GetDecimal(dataReader, "CurySaleAmt");

            objItem.PurchaseAmt = SqlHelper.GetDecimal(dataReader, "PurchaseAmt");

            objItem.CuryPurchaseAmt = SqlHelper.GetDecimal(dataReader, "CuryPurchaseAmt");

            objItem.BalanceAmt = SqlHelper.GetDecimal(dataReader, "BalanceAmt");

            objItem.CuryBalanceAmt = SqlHelper.GetDecimal(dataReader, "CuryBalanceAmt");

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

            objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate");

            objItem.UpdatedDate = SqlHelper.GetDateTime(dataReader, "UpdatedDate");
            return(objItem);
        }
Ejemplo n.º 6
0
 private static SqlParameter[] CreateSqlParameter(UserHistory model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@UserName", model.UserName),
         new SqlParameter("@CuryId", model.CuryId),
         new SqlParameter("@ToCuryId", model.ToCuryId),
         new SqlParameter("@FinPeriod", model.FinPeriod),
         new SqlParameter("@Payment", model.Payment),
         new SqlParameter("@CuryPayment", model.CuryPayment),
         new SqlParameter("@ReceiveAmt", model.ReceiveAmt),
         new SqlParameter("@CuryReceiveAmt", model.CuryReceiveAmt),
         new SqlParameter("@SaleAmt", model.SaleAmt),
         new SqlParameter("@CurySaleAmt", model.CurySaleAmt),
         new SqlParameter("@PurchaseAmt", model.PurchaseAmt),
         new SqlParameter("@CuryPurchaseAmt", model.CuryPurchaseAmt),
         new SqlParameter("@BalanceAmt", model.BalanceAmt),
         new SqlParameter("@CuryBalanceAmt", model.CuryBalanceAmt),
         new SqlParameter("@CreatedUser", model.CreatedUser),
         new SqlParameter("@CreatedDate", model.CreatedDate),
         new SqlParameter("@UpdatedDate", model.UpdatedDate),
     });
 }