Beispiel #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(BWJS.Model.CompanyNetLoan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo.[CompanyNetLoan](");
            strSql.Append("CompanyId,IsDeleted,CreateId,CreateDate,EditId,EditDate,HighestLoan,IsHaveGuarantee,IsMortgage,MaxMonthlyInterest,LoanPrescription,DescriptionHtml,Remark");
            strSql.Append(") values (");
            strSql.Append("@CompanyId,@IsDeleted,@CreateId,@CreateDate,@EditId,@EditDate,@HighestLoan,@IsHaveGuarantee,@IsMortgage,@MaxMonthlyInterest,@LoanPrescription,@DescriptionHtml,@Remark");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyId",          model.CompanyId),
                new SqlParameter("@IsDeleted",          model.IsDeleted),
                new SqlParameter("@CreateId",           model.CreateId),
                new SqlParameter("@CreateDate",         model.CreateDate),
                new SqlParameter("@EditId",             model.EditId),
                new SqlParameter("@EditDate",           model.EditDate),
                new SqlParameter("@HighestLoan",        model.HighestLoan),
                new SqlParameter("@IsHaveGuarantee",    model.IsHaveGuarantee),
                new SqlParameter("@IsMortgage",         model.IsMortgage),
                new SqlParameter("@MaxMonthlyInterest", model.MaxMonthlyInterest),
                new SqlParameter("@LoanPrescription",   model.LoanPrescription),
                new SqlParameter("@DescriptionHtml",    model.DescriptionHtml),
                new SqlParameter("@Remark",             model.Remark)
            };

            BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Beispiel #2
0
        /// <summary>
        /// datarow转成对象实体
        /// </summary>
        public BWJS.Model.CompanyNetLoan DataRowToModel(DataRow row)
        {
            BWJS.Model.CompanyNetLoan model = new BWJS.Model.CompanyNetLoan();

            if (row != null)
            {
                if (row["CompanyId"].ToString() != "")
                {
                    model.CompanyId = int.Parse(row["CompanyId"].ToString());
                }
                if (row["IsDeleted"].ToString() != "")
                {
                    model.IsDeleted = int.Parse(row["IsDeleted"].ToString());
                }
                if (row["CreateId"].ToString() != "")
                {
                    model.CreateId = int.Parse(row["CreateId"].ToString());
                }
                if (row["CreateDate"].ToString() != "")
                {
                    model.CreateDate = DateTime.Parse(row["CreateDate"].ToString());
                }
                if (row["EditId"].ToString() != "")
                {
                    model.EditId = int.Parse(row["EditId"].ToString());
                }
                if (row["EditDate"].ToString() != "")
                {
                    model.EditDate = DateTime.Parse(row["EditDate"].ToString());
                }
                if (row["HighestLoan"].ToString() != "")
                {
                    model.HighestLoan = decimal.Parse(row["HighestLoan"].ToString());
                }
                if (row["IsHaveGuarantee"].ToString() != "")
                {
                    model.IsHaveGuarantee = int.Parse(row["IsHaveGuarantee"].ToString());
                }
                if (row["IsMortgage"].ToString() != "")
                {
                    model.IsMortgage = int.Parse(row["IsMortgage"].ToString());
                }
                if (row["MaxMonthlyInterest"].ToString() != "")
                {
                    model.MaxMonthlyInterest = decimal.Parse(row["MaxMonthlyInterest"].ToString());
                }
                if (row["LoanPrescription"].ToString() != "")
                {
                    model.LoanPrescription = int.Parse(row["LoanPrescription"].ToString());
                }
                model.DescriptionHtml = row["DescriptionHtml"].ToString();
                model.Remark          = row["Remark"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BWJS.Model.CompanyNetLoan GetModel(int CompanyId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select CompanyId, IsDeleted, CreateId, CreateDate, EditId, EditDate, HighestLoan, IsHaveGuarantee, IsMortgage, MaxMonthlyInterest, LoanPrescription, DescriptionHtml, Remark  ");
            strSql.Append("  from dbo.[CompanyNetLoan] ");
            strSql.Append(" where CompanyId=@CompanyId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyId", SqlDbType.Int, 4)
            };
            parameters[0].Value = CompanyId;


            BWJS.Model.CompanyNetLoan model = new BWJS.Model.CompanyNetLoan();
            DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BWJS.Model.CompanyNetLoan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo.[CompanyNetLoan] set ");

            strSql.Append(" CompanyId = @CompanyId , ");
            strSql.Append(" IsDeleted = @IsDeleted , ");
            strSql.Append(" CreateId = @CreateId , ");
            strSql.Append(" CreateDate = @CreateDate , ");
            strSql.Append(" EditId = @EditId , ");
            strSql.Append(" EditDate = @EditDate , ");
            strSql.Append(" HighestLoan = @HighestLoan , ");
            strSql.Append(" IsHaveGuarantee = @IsHaveGuarantee , ");
            strSql.Append(" IsMortgage = @IsMortgage , ");
            strSql.Append(" MaxMonthlyInterest = @MaxMonthlyInterest , ");
            strSql.Append(" LoanPrescription = @LoanPrescription , ");
            strSql.Append(" DescriptionHtml = @DescriptionHtml , ");
            strSql.Append(" Remark = @Remark  ");
            strSql.Append(" where CompanyId=@CompanyId  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyId",          model.CompanyId),
                new SqlParameter("@IsDeleted",          model.IsDeleted),
                new SqlParameter("@CreateId",           model.CreateId),
                new SqlParameter("@CreateDate",         model.CreateDate),
                new SqlParameter("@EditId",             model.EditId),
                new SqlParameter("@EditDate",           model.EditDate),
                new SqlParameter("@HighestLoan",        model.HighestLoan),
                new SqlParameter("@IsHaveGuarantee",    model.IsHaveGuarantee),
                new SqlParameter("@IsMortgage",         model.IsMortgage),
                new SqlParameter("@MaxMonthlyInterest", model.MaxMonthlyInterest),
                new SqlParameter("@LoanPrescription",   model.LoanPrescription),
                new SqlParameter("@DescriptionHtml",    model.DescriptionHtml),
                new SqlParameter("@Remark",             model.Remark)
            };

            int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BWJS.Model.CompanyNetLoan model)
 {
     return(dal.Update(model));
 }
Beispiel #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(BWJS.Model.CompanyNetLoan model)
 {
     dal.Add(model);
 }