示例#1
0
        /// <summary>
        /// 通过数据读取器生成实体类
        /// </summary>
        /// <param name="rdr"></param>
        /// <returns></returns>
        private static RepaymentEntity GetEntityFromrdr(NullableDataReader rdr)
        {
            RepaymentEntity info = new RepaymentEntity();

            info.ID               = rdr.GetInt32("ID");
            info.OrderID          = rdr.GetInt32("OrderID");
            info.OrderItemID      = rdr.GetInt32("OrderItemID");
            info.UserID           = rdr.GetInt32("UserID");
            info.Deadline         = rdr.GetInt32("Deadline");
            info.CurrentDeadline  = rdr.GetInt32("CurrentDeadline");
            info.RePayDate        = rdr.GetNullableDateTime("RePayDate");
            info.RePayMoney       = rdr.GetDecimal("RePayMoney");
            info.Principal        = rdr.GetDecimal("Principal");
            info.Interest         = rdr.GetDecimal("Interest");
            info.MonthFeeMoney    = rdr.GetDecimal("MonthFeeMoney");
            info.VIPMoney         = rdr.GetDecimal("VIPMoney");
            info.InsuranceMoney   = rdr.GetDecimal("InsuranceMoney");
            info.RePayMoneySub    = rdr.GetDecimal("RePayMoneySub");
            info.RepaymentType    = rdr.GetInt32("RepaymentType");
            info.RepaymentStatus  = rdr.GetInt32("RepaymentStatus");
            info.TrueRePayDate    = rdr.GetNullableDateTime("TrueRePayDate");
            info.TrueRePayMoney   = rdr.GetDecimal("TrueRePayMoney");
            info.OverdueDays      = rdr.GetInt32("OverdueDays");
            info.LateFee          = rdr.GetDecimal("LateFee");
            info.PressMoneyStatus = rdr.GetInt32("PressMoneyStatus");
            info.PressMoneyStaff  = rdr.GetString("PressMoneyStaff");
            info.Remark           = rdr.GetString("Remark");
            info.Remark1          = rdr.GetString("Remark1");
            info.Remark2          = rdr.GetString("Remark2");
            return(info);
        }
示例#2
0
 /// <summary>
 /// 把实体类转换成键/值对集合
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="dict"></param>
 private static void GetParameters(RepaymentEntity entity, Dictionary <string, object> dict)
 {
     dict.Add("ID", entity.ID);
     dict.Add("OrderID", entity.OrderID);
     dict.Add("OrderItemID", entity.OrderItemID);
     dict.Add("UserID", entity.UserID);
     dict.Add("Deadline", entity.Deadline);
     dict.Add("CurrentDeadline", entity.CurrentDeadline);
     dict.Add("RePayDate", entity.RePayDate);
     dict.Add("RePayMoney", entity.RePayMoney);
     dict.Add("Principal", entity.Principal);
     dict.Add("Interest", entity.Interest);
     dict.Add("MonthFeeMoney", entity.MonthFeeMoney);
     dict.Add("VIPMoney", entity.VIPMoney);
     dict.Add("InsuranceMoney", entity.InsuranceMoney);
     dict.Add("RePayMoneySub", entity.RePayMoneySub);
     dict.Add("RepaymentType", entity.RepaymentType);
     dict.Add("RepaymentStatus", entity.RepaymentStatus);
     dict.Add("TrueRePayDate", entity.TrueRePayDate);
     dict.Add("TrueRePayMoney", entity.TrueRePayMoney);
     dict.Add("OverdueDays", entity.OverdueDays);
     dict.Add("LateFee", entity.LateFee);
     dict.Add("PressMoneyStatus", entity.PressMoneyStatus);
     dict.Add("PressMoneyStaff", entity.PressMoneyStaff);
     dict.Add("Remark", entity.Remark);
     dict.Add("Remark1", entity.Remark1);
     dict.Add("Remark2", entity.Remark2);
 }
示例#3
0
        /// <summary>
        /// 增加一条记录,返回新的ID号。需要有一个单一主键,并且开启有标识符属性(异步方式)
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        public virtual async Task <int> InsertAsync(RepaymentEntity entity)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            GetParameters(entity, dict);

            string strSQL = "insert into Repayment (" +
                            "OrderID," +
                            "OrderItemID," +
                            "UserID," +
                            "Deadline," +
                            "CurrentDeadline," +
                            "RePayDate," +
                            "RePayMoney," +
                            "Principal," +
                            "Interest," +
                            "MonthFeeMoney," +
                            "VIPMoney," +
                            "InsuranceMoney," +
                            "RePayMoneySub," +
                            "RepaymentType," +
                            "RepaymentStatus," +
                            "TrueRePayDate," +
                            "TrueRePayMoney," +
                            "OverdueDays," +
                            "LateFee," +
                            "PressMoneyStatus," +
                            "PressMoneyStaff," +
                            "Remark," +
                            "Remark1," +
                            "Remark2) " +
                            "values(" +
                            "@OrderID," +
                            "@OrderItemID," +
                            "@UserID," +
                            "@Deadline," +
                            "@CurrentDeadline," +
                            "@RePayDate," +
                            "@RePayMoney," +
                            "@Principal," +
                            "@Interest," +
                            "@MonthFeeMoney," +
                            "@VIPMoney," +
                            "@InsuranceMoney," +
                            "@RePayMoneySub," +
                            "@RepaymentType," +
                            "@RepaymentStatus," +
                            "@TrueRePayDate," +
                            "@TrueRePayMoney," +
                            "@OverdueDays," +
                            "@LateFee," +
                            "@PressMoneyStatus," +
                            "@PressMoneyStaff," +
                            "@Remark," +
                            "@Remark1," +
                            "@Remark2)";

            return(await Task.Run(() => _DB.ReturnID(strSQL, dict)));
        }
示例#4
0
        /// <summary>
        /// 获取实体(异步方式)
        /// </summary>
        /// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
        /// <param name="dict">参数的名/值集合</param>
        /// <returns></returns>
        public virtual async Task <RepaymentEntity> GetEntityAsync(string strWhere, Dictionary <string, object> dict = null)
        {
            RepaymentEntity obj    = null;
            string          strSQL = "select top 1 * from Repayment where 1=1 " + strWhere;

            using (NullableDataReader reader = await Task.Run(() => _DB.GetDataReader(strSQL, dict)))
            {
                if (reader.Read())
                {
                    obj = GetEntityFromrdr(reader);
                }
            }
            return(obj);
        }
示例#5
0
        /// <summary>
        /// 更新一条记录(异步方式)
        /// </summary>
        /// <param name="entity">实体模型</param>
        /// <returns></returns>
        public virtual async Task <bool> UpdateAsync(RepaymentEntity entity)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();

            GetParameters(entity, dict);
            string strSQL = "Update Repayment SET " +
                            "OrderID = @OrderID," +
                            "OrderItemID = @OrderItemID," +
                            "UserID = @UserID," +
                            "Deadline = @Deadline," +
                            "CurrentDeadline = @CurrentDeadline," +
                            "RePayDate = @RePayDate," +
                            "RePayMoney = @RePayMoney," +
                            "Principal = @Principal," +
                            "Interest = @Interest," +
                            "MonthFeeMoney = @MonthFeeMoney," +
                            "VIPMoney = @VIPMoney," +
                            "InsuranceMoney = @InsuranceMoney," +
                            "RePayMoneySub = @RePayMoneySub," +
                            "RepaymentType = @RepaymentType," +
                            "RepaymentStatus = @RepaymentStatus," +
                            "TrueRePayDate = @TrueRePayDate," +
                            "TrueRePayMoney = @TrueRePayMoney," +
                            "OverdueDays = @OverdueDays," +
                            "LateFee = @LateFee," +
                            "PressMoneyStatus = @PressMoneyStatus," +
                            "PressMoneyStaff = @PressMoneyStaff," +
                            "Remark = @Remark," +
                            "Remark1 = @Remark1," +
                            "Remark2 = @Remark2" +
                            " WHERE " +

                            "ID = @ID";

            return(await Task.Run(() => _DB.ExeSQLResult(strSQL, dict)));
        }
示例#6
0
 /// <summary>
 /// 增加或更新一条记录(异步方式)
 /// </summary>
 /// <param name="entity">实体模型</param>
 /// <param name="IsSave">是否增加</param>
 /// <returns></returns>
 public virtual async Task <bool> AddOrUpdateAsync(RepaymentEntity entity, bool IsSave)
 {
     return(IsSave ? await AddAsync(entity) : await UpdateAsync(entity));
 }
示例#7
0
 /// <summary>
 /// 增加或更新一条记录
 /// </summary>
 /// <param name="entity">实体模型</param>
 /// <param name="IsSave">是否增加</param>
 /// <returns></returns>
 public virtual bool AddOrUpdate(RepaymentEntity entity, bool IsSave)
 {
     return(IsSave ? Add(entity) : Update(entity));
 }