Пример #1
0
 private void ShowInfo(int _id)
 {
     BLL.daikuan   bll       = new BLL.daikuan();
     BLL.member    memberBll = new BLL.member();
     Model.daikuan model     = bll.GetModel(_id);
     txtName.Text = model.name;
     if (!string.IsNullOrWhiteSpace(model.gender))
     {
         txtGender.Text = model.gender == "0" ? "男" : "女";
     }
     txtLevelName.Text       = new BLL.member_level().GetName(Utils.StrToInt(model.level, 0));
     txtIdCard.Text          = model.id_card;
     txtLevel.Text           = model.level;
     txtTel.Text             = model.tel;
     txtMember.Text          = model.member_no;
     txtCanAmount.Text       = Utils.StrToDecimal(Utils.ObjectToStr(model.can_amount), 0).ToString();
     txtAmount.Text          = Utils.StrToDecimal(Utils.ObjectToStr(model.amount), 0).ToString();
     txtMemberAmount.Text    = Utils.StrToDecimal(Utils.ObjectToStr(model.member_amount), 0).ToString();
     txtPurpose.Text         = model.purpose;
     txtAddTime.Text         = model.add_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
     txtMemberId.Text        = model.member_id.ToString();
     txtMonth.Text           = model.month.ToString();
     ddlChanYe.SelectedValue = model.chanye;
     txtRemark.Text          = model.remark;
     if (!string.IsNullOrEmpty(model.lb_person))
     {
         txtLbIds.Text   = model.lb_person;
         txtLbNames.Text = model.lb_person_names;
     }
     //绑定图片相册
     rptAlbumList.DataSource = model.albums;
     rptAlbumList.DataBind();
 }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.keywords = DTRequest.GetQueryString("keywords");
     this.id       = Utils.StrToInt(DTRequest.GetQueryString("id"), 0);
     if (!Page.IsPostBack)
     {
         BLL.daikuan   bll   = new BLL.daikuan();
         Model.daikuan model = bll.GetModel(this.id);
         //绑定图片相册
         rptList2.DataSource = model.albums;
         rptList2.DataBind();
         var lbIds = model.lb_person;
         RptBind("id>0 and id in(" + lbIds + ")", "add_time asc,id desc");
     }
 }
Пример #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.daikuan GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from daikuan");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.daikuan model = new Model.daikuan();
            DataSet       ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.daikuan   bll   = new BLL.daikuan();
            Model.daikuan model = bll.GetModel(_id);
            model.member_id = Utils.StrToInt(txtMemberId.Text, 0);
            model.name      = txtName.Text.Trim();
            model.level     = txtLevel.Text.Trim();
            if (!string.IsNullOrWhiteSpace(txtGender.Text.Trim()))
            {
                model.gender = txtGender.Text.Trim() == "男" ? "0" : "1";
            }
            model.id_card         = txtIdCard.Text.Trim();
            model.tel             = txtTel.Text.Trim();
            model.member_no       = txtMember.Text.Trim();
            model.can_amount      = Utils.StrToDecimal(txtCanAmount.Text, 0);
            model.amount          = Utils.StrToDecimal(txtAmount.Text, 0);
            model.member_amount   = Utils.StrToDecimal(txtMemberAmount.Text, 0);
            model.purpose         = txtPurpose.Text.Trim();
            model.add_time        = Utils.StrToDateTime(txtAddTime.Text.Trim());
            model.lb_person       = txtLbIds.Text.ToString();
            model.lb_person_names = txtLbNames.Text.ToString();
            model.month           = Utils.StrToInt(txtMonth.Text, 0);
            model.chanye          = ddlChanYe.SelectedValue;
            model.remark          = txtRemark.Text.Trim().ToString();

            #region 保存相册====================
            //检查是否有自定义图片
            if (model.albums != null)
            {
                model.albums.Clear();
            }
            string[] albumArr   = Request.Form.GetValues("hid_photo_name");
            string[] remarkArr  = Request.Form.GetValues("hid_photo_remark");
            string[] linkUrlArr = Request.Form.GetValues("hid_photo_link_url");
            if (albumArr != null)
            {
                List <Model.daikuan_albums> ls = new List <Model.daikuan_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int      img_id = Utils.StrToInt(imgArr[0], 0);
                    if (imgArr.Length == 3)
                    {
                        if (linkUrlArr != null && !string.IsNullOrEmpty(linkUrlArr[i]) && !string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.daikuan_albums {
                                id = img_id, daikuan_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i], link_url = linkUrlArr[i]
                            });
                        }
                        else if (linkUrlArr != null && !string.IsNullOrEmpty(remarkArr[i]) && string.IsNullOrEmpty(linkUrlArr[i]))
                        {
                            ls.Add(new Model.daikuan_albums {
                                id = img_id, daikuan_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i]
                            });
                        }
                        else if (linkUrlArr != null && !string.IsNullOrEmpty(linkUrlArr[i]) && string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.daikuan_albums {
                                id = img_id, daikuan_id = _id, original_path = imgArr[1], thumb_path = imgArr[2], link_url = linkUrlArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.daikuan_albums {
                                id = img_id, daikuan_id = _id, original_path = imgArr[1], thumb_path = imgArr[2]
                            });
                        }
                    }
                }
                model.albums = ls;
            }
            #endregion

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改借款信息:" + model.name); //记录日志
                result = true;
            }

            return(result);
        }
Пример #5
0
        private bool DoAdd()
        {
            Model.daikuan model = new Model.daikuan();
            BLL.daikuan   bll   = new BLL.daikuan();
            model.member_id = Utils.StrToInt(txtMemberId.Text, 0);
            model.name      = txtName.Text.Trim();
            if (!string.IsNullOrWhiteSpace(txtGender.Text.Trim()))
            {
                model.gender = txtGender.Text.Trim() == "男" ? "0" : "1";
            }
            model.id_card         = txtIdCard.Text.Trim();
            model.tel             = txtTel.Text.Trim();
            model.level           = txtLevel.Text.Trim();
            model.member_no       = txtMember.Text.Trim();
            model.can_amount      = Utils.StrToDecimal(txtCanAmount.Text, 0);
            model.amount          = Utils.StrToDecimal(txtAmount.Text, 0);
            model.purpose         = txtPurpose.Text.Trim();
            model.add_time        = Utils.StrToDateTime(txtAddTime.Text.Trim());
            model.lb_person       = txtLbIds.Text.ToString();
            model.lb_person_names = txtLbNames.Text.ToString();
            model.month           = Utils.StrToInt(txtMonth.Text, 0);
            model.member_amount   = Utils.StrToDecimal(txtMemberAmount.Text, 0);
            model.chanye          = ddlChanYe.SelectedValue;
            model.remark          = txtRemark.Text.Trim().ToString();

            BLL.daikuan_set setBll  = new BLL.daikuan_set();
            var             isExsit = setBll.Exists(1);

            Model.daikuan_set setModel = new Model.daikuan_set();
            if (isExsit)
            {
                setModel        = setBll.GetModel(1);
                model.zy_amount = model.amount * (setModel.rate * 0.01m);

                model.wh_amount = model.amount + model.zy_amount;
            }

            #region 保存相册====================
            string[] albumArr    = Request.Form.GetValues("hid_photo_name");
            string[] remarkArr   = Request.Form.GetValues("hid_photo_remark");
            string[] link_urlArr = Request.Form.GetValues("hid_photo_link_url");
            if (albumArr != null && albumArr.Length > 0)
            {
                List <Model.daikuan_albums> ls = new List <Model.daikuan_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(link_urlArr[i]))
                        {
                            ls.Add(new Model.daikuan_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2], link_url = link_urlArr[i]
                            });
                        }
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.daikuan_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.daikuan_albums {
                                original_path = imgArr[1], thumb_path = imgArr[2]
                            });
                        }
                    }
                }
                model.albums = ls;
            }
            #endregion
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加借款信息:" + model.name); //记录日志
                return(true);
            }
            return(false);
        }
Пример #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.daikuan model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        #region 添加主表数据====================
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("insert into daikuan(");
                        strSql.Append("name,level,gender,tel,id_card,member_no,amount,purpose,lb_person,add_time,audit_time,member_id,lb_person_names,status,reason,hk_status,yh_amount,wh_amount,zy_amount,cq_amount,can_amount,month,member_amount,chanye,remark)");
                        strSql.Append(" values (");
                        strSql.Append("@name,@level,@gender,@tel,@id_card,@member_no,@amount,@purpose,@lb_person,@add_time,@audit_time,@member_id,@lb_person_names,@status,@reason,@hk_status,@yh_amount,@wh_amount,@zy_amount,@cq_amount,@can_amount,@month,@member_amount,@chanye,@remark)");
                        strSql.Append(";select @@IDENTITY");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@name",            SqlDbType.NVarChar,   50),
                            new SqlParameter("@level",           SqlDbType.NVarChar,   50),
                            new SqlParameter("@gender",          SqlDbType.NVarChar,   50),
                            new SqlParameter("@tel",             SqlDbType.NVarChar,   50),
                            new SqlParameter("@id_card",         SqlDbType.NVarChar,   50),
                            new SqlParameter("@member_no",       SqlDbType.NVarChar,   50),
                            new SqlParameter("@amount",          SqlDbType.Decimal,     9),
                            new SqlParameter("@purpose",         SqlDbType.NVarChar,   50),
                            new SqlParameter("@lb_person",       SqlDbType.NVarChar,   50),
                            new SqlParameter("@add_time",        SqlDbType.DateTime),
                            new SqlParameter("@audit_time",      SqlDbType.DateTime),
                            new SqlParameter("@member_id",       SqlDbType.Int),
                            new SqlParameter("@lb_person_names", SqlDbType.NVarChar,   50),
                            new SqlParameter("@status",          SqlDbType.TinyInt,     1),
                            new SqlParameter("@reason",          SqlDbType.NVarChar,  200),
                            new SqlParameter("@hk_status",       SqlDbType.TinyInt,     1),
                            new SqlParameter("@yh_amount",       SqlDbType.Decimal),
                            new SqlParameter("@wh_amount",       SqlDbType.Decimal),
                            new SqlParameter("@zy_amount",       SqlDbType.Decimal),
                            new SqlParameter("@cq_amount",       SqlDbType.Decimal),
                            new SqlParameter("@can_amount",      SqlDbType.Decimal),
                            new SqlParameter("@month",           SqlDbType.Decimal),
                            new SqlParameter("@member_amount",   SqlDbType.Decimal),
                            new SqlParameter("@chanye",          SqlDbType.NVarChar,   50),
                            new SqlParameter("@remark",          SqlDbType.NVarChar)
                        };
                        parameters[0].Value  = model.name;
                        parameters[1].Value  = model.level;
                        parameters[2].Value  = model.gender;
                        parameters[3].Value  = model.tel;
                        parameters[4].Value  = model.id_card;
                        parameters[5].Value  = model.member_no;
                        parameters[6].Value  = model.amount;
                        parameters[7].Value  = model.purpose;
                        parameters[8].Value  = model.lb_person;
                        parameters[9].Value  = model.add_time;
                        parameters[10].Value = model.audit_time;
                        parameters[11].Value = model.member_id;
                        parameters[12].Value = model.lb_person_names;
                        parameters[13].Value = model.status;
                        parameters[14].Value = model.reason;
                        parameters[15].Value = model.hk_status;
                        parameters[16].Value = model.yh_amount;
                        parameters[17].Value = model.wh_amount;
                        parameters[18].Value = model.zy_amount;
                        parameters[19].Value = model.cq_amount;
                        parameters[20].Value = model.can_amount;
                        parameters[21].Value = model.month;
                        parameters[22].Value = model.member_amount;
                        parameters[23].Value = model.chanye;
                        parameters[24].Value = model.remark;
                        //添加主表数据
                        object obj = DbHelperSQL.GetSingle(conn, trans, strSql.ToString(), parameters); //带事务
                        model.id = Convert.ToInt32(obj);
                        #endregion

                        #region 添加图片相册====================
                        if (model.albums != null)
                        {
                            StringBuilder strSql3;
                            foreach (Model.daikuan_albums modelt in model.albums)
                            {
                                strSql3 = new StringBuilder();
                                strSql3.Append("insert into daikuan_albums(");
                                strSql3.Append("daikuan_id,thumb_path,original_path,remark,link_url)");
                                strSql3.Append(" values (");
                                strSql3.Append("@daikuan_id,@thumb_path,@original_path,@remark,@link_url)");
                                SqlParameter[] parameters3 =
                                {
                                    new SqlParameter("@daikuan_id",    SqlDbType.Int,        4),
                                    new SqlParameter("@thumb_path",    SqlDbType.NVarChar, 255),
                                    new SqlParameter("@original_path", SqlDbType.NVarChar, 255),
                                    new SqlParameter("@remark",        SqlDbType.NVarChar, 500),
                                    new SqlParameter("@link_url",      SqlDbType.NVarChar, 200)
                                };
                                parameters3[0].Value = model.id;
                                parameters3[1].Value = modelt.thumb_path;
                                parameters3[2].Value = modelt.original_path;
                                parameters3[3].Value = modelt.remark;
                                parameters3[4].Value = modelt.link_url;
                                DbHelperSQL.GetSingle(conn, trans, strSql3.ToString(), parameters3); //带事务
                            }
                        }
                        #endregion

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(0);
                    }
                }
            }
            return(model.id);
        }
Пример #7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.daikuan DataRowToModel(DataRow row)
 {
     Model.daikuan model = new Model.daikuan();
     if (row != null)
     {
         if (row["status"] != null && row["status"].ToString() != "")
         {
             model.status = int.Parse(row["status"].ToString());
         }
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["member_id"] != null && row["member_id"].ToString() != "")
         {
             model.member_id = int.Parse(row["member_id"].ToString());
         }
         if (row["name"] != null)
         {
             model.name = row["name"].ToString();
         }
         if (row["level"] != null)
         {
             model.level = row["level"].ToString();
         }
         if (row["gender"] != null)
         {
             model.gender = row["gender"].ToString();
         }
         if (row["tel"] != null)
         {
             model.tel = row["tel"].ToString();
         }
         if (row["id_card"] != null)
         {
             model.id_card = row["id_card"].ToString();
         }
         if (row["member_no"] != null)
         {
             model.member_no = row["member_no"].ToString();
         }
         if (row["amount"] != null && row["amount"].ToString() != "")
         {
             model.amount = decimal.Parse(row["amount"].ToString());
         }
         if (row["member_amount"] != null && row["member_amount"].ToString() != "")
         {
             model.member_amount = decimal.Parse(row["member_amount"].ToString());
         }
         if (row["month"] != null && row["month"].ToString() != "")
         {
             model.month = int.Parse(row["month"].ToString());
         }
         if (row["can_amount"] != null && row["can_amount"].ToString() != "")
         {
             model.can_amount = decimal.Parse(row["can_amount"].ToString());
         }
         if (row["purpose"] != null)
         {
             model.purpose = row["purpose"].ToString();
         }
         if (row["lb_person"] != null)
         {
             model.lb_person = row["lb_person"].ToString();
         }
         if (row["lb_person_names"] != null)
         {
             model.lb_person_names = row["lb_person_names"].ToString();
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             model.add_time = DateTime.Parse(row["add_time"].ToString());
         }
         if (row["audit_time"] != null && row["audit_time"].ToString() != "")
         {
             model.audit_time = DateTime.Parse(row["audit_time"].ToString());
         }
         if (row["reason"] != null)
         {
             model.reason = row["reason"].ToString();
         }
         if (row["hk_status"] != null && row["hk_status"].ToString() != "")
         {
             model.hk_status = int.Parse(row["hk_status"].ToString());
         }
         if (row["yh_amount"] != null)
         {
             model.yh_amount = Utils.StrToDecimal(row["yh_amount"].ToString(), 0);
         }
         if (row["wh_amount"] != null)
         {
             model.wh_amount = Utils.StrToDecimal(row["wh_amount"].ToString(), 0);
         }
         if (row["zy_amount"] != null)
         {
             model.zy_amount = Utils.StrToDecimal(row["zy_amount"].ToString(), 0);
         }
         if (row["cq_amount"] != null)
         {
             model.cq_amount = Utils.StrToDecimal(row["cq_amount"].ToString(), 0);
         }
         if (row["chanye"] != null)
         {
             model.chanye = row["chanye"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         //相册信息
         model.albums = new daikuan_albums().GetList(model.id, 0);
     }
     return(model);
 }
Пример #8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.daikuan model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        #region 修改主表数据==========================
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("update daikuan set ");
                        strSql.Append("name=@name,");
                        strSql.Append("level=@level,");
                        strSql.Append("gender=@gender,");
                        strSql.Append("tel=@tel,");
                        strSql.Append("id_card=@id_card,");
                        strSql.Append("member_no=@member_no,");
                        strSql.Append("amount=@amount,");
                        strSql.Append("purpose=@purpose,");
                        strSql.Append("lb_person=@lb_person,");
                        strSql.Append("add_time=@add_time,");
                        strSql.Append("audit_time=@audit_time,");
                        strSql.Append("member_id=@member_id,");
                        strSql.Append("lb_person_names=@lb_person_names,");
                        strSql.Append("status=@status,");
                        strSql.Append("reason=@reason,");
                        strSql.Append("hk_status=@hk_status,");
                        strSql.Append("yh_amount=@yh_amount,");
                        strSql.Append("wh_amount=@wh_amount,");
                        strSql.Append("zy_amount=@zy_amount,");
                        strSql.Append("cq_amount=@cq_amount,");
                        strSql.Append("can_amount=@can_amount,");
                        strSql.Append("month=@month,");
                        strSql.Append("member_amount=@member_amount,");
                        strSql.Append("chanye=@chanye,");
                        strSql.Append("remark=@remark");
                        strSql.Append(" where id=@id ");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@name",            SqlDbType.NVarChar,   50),
                            new SqlParameter("@level",           SqlDbType.NVarChar,   50),
                            new SqlParameter("@gender",          SqlDbType.NVarChar,   50),
                            new SqlParameter("@tel",             SqlDbType.NVarChar,   50),
                            new SqlParameter("@id_card",         SqlDbType.NVarChar,   50),
                            new SqlParameter("@member_no",       SqlDbType.NVarChar,   50),
                            new SqlParameter("@amount",          SqlDbType.Decimal,     9),
                            new SqlParameter("@purpose",         SqlDbType.NVarChar,   50),
                            new SqlParameter("@lb_person",       SqlDbType.NVarChar,   50),
                            new SqlParameter("@add_time",        SqlDbType.DateTime),
                            new SqlParameter("@audit_time",      SqlDbType.DateTime),
                            new SqlParameter("@member_id",       SqlDbType.Int),
                            new SqlParameter("@lb_person_names", SqlDbType.NVarChar,   50),
                            new SqlParameter("@status",          SqlDbType.TinyInt,     1),
                            new SqlParameter("@hk_status",       SqlDbType.TinyInt,     1),
                            new SqlParameter("@reason",          SqlDbType.NVarChar,  200),
                            new SqlParameter("@yh_amount",       SqlDbType.Decimal),
                            new SqlParameter("@wh_amount",       SqlDbType.Decimal),
                            new SqlParameter("@zy_amount",       SqlDbType.Decimal),
                            new SqlParameter("@cq_amount",       SqlDbType.Decimal),
                            new SqlParameter("@can_amount",      SqlDbType.Decimal),
                            new SqlParameter("@month",           SqlDbType.Int,         4),
                            new SqlParameter("@member_amount",   SqlDbType.Decimal),
                            new SqlParameter("@chanye",          SqlDbType.NVarChar,   50),
                            new SqlParameter("@remark",          SqlDbType.NVarChar),
                            new SqlParameter("@id",              SqlDbType.Int, 4)
                        };
                        parameters[0].Value  = model.name;
                        parameters[1].Value  = model.level;
                        parameters[2].Value  = model.gender;
                        parameters[3].Value  = model.tel;
                        parameters[4].Value  = model.id_card;
                        parameters[5].Value  = model.member_no;
                        parameters[6].Value  = model.amount;
                        parameters[7].Value  = model.purpose;
                        parameters[8].Value  = model.lb_person;
                        parameters[9].Value  = model.add_time;
                        parameters[10].Value = model.audit_time;
                        parameters[11].Value = model.member_id;
                        parameters[12].Value = model.lb_person_names;
                        parameters[13].Value = model.status;
                        parameters[14].Value = model.hk_status;
                        parameters[15].Value = model.reason;
                        parameters[16].Value = model.yh_amount;
                        parameters[17].Value = model.wh_amount;
                        parameters[18].Value = model.zy_amount;
                        parameters[19].Value = model.cq_amount;
                        parameters[20].Value = model.can_amount;
                        parameters[21].Value = model.month;
                        parameters[22].Value = model.member_amount;
                        parameters[23].Value = model.chanye;
                        parameters[24].Value = model.remark;
                        parameters[25].Value = model.id;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);
                        #endregion

                        #region 修改图片相册==========================
                        //删除已删除的图片
                        new daikuan_albums().DeleteList(conn, trans, model.albums, model.id);
                        //添加/修改相册
                        if (model.albums != null)
                        {
                            StringBuilder strSql3;
                            foreach (Model.daikuan_albums modelt in model.albums)
                            {
                                strSql3 = new StringBuilder();
                                if (modelt.id > 0)
                                {
                                    strSql3.Append("update daikuan_albums set ");
                                    strSql3.Append("daikuan_id=@daikuan_id,");
                                    strSql3.Append("thumb_path=@thumb_path,");
                                    strSql3.Append("original_path=@original_path,");
                                    strSql3.Append("remark=@remark,");
                                    strSql3.Append("link_url=@link_url");
                                    strSql3.Append(" where id=@id");
                                    SqlParameter[] parameters3 =
                                    {
                                        new SqlParameter("@daikuan_id",    SqlDbType.Int,        4),
                                        new SqlParameter("@thumb_path",    SqlDbType.NVarChar, 255),
                                        new SqlParameter("@original_path", SqlDbType.NVarChar, 255),
                                        new SqlParameter("@remark",        SqlDbType.NVarChar, 500),
                                        new SqlParameter("@link_url",      SqlDbType.NVarChar, 200),
                                        new SqlParameter("@id",            SqlDbType.Int, 4)
                                    };
                                    parameters3[0].Value = modelt.daikuan_id;
                                    parameters3[1].Value = modelt.thumb_path;
                                    parameters3[2].Value = modelt.original_path;
                                    parameters3[3].Value = modelt.remark;
                                    parameters3[4].Value = modelt.link_url;
                                    parameters3[5].Value = modelt.id;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql3.ToString(), parameters3);
                                }
                                else
                                {
                                    strSql3.Append("insert into daikuan_albums(");
                                    strSql3.Append("daikuan_id,thumb_path,original_path,remark,link_url)");
                                    strSql3.Append(" values (");
                                    strSql3.Append("@daikuan_id,@thumb_path,@original_path,@remark,@link_url)");
                                    SqlParameter[] parameters3 =
                                    {
                                        new SqlParameter("@daikuan_id",    SqlDbType.Int,        4),
                                        new SqlParameter("@thumb_path",    SqlDbType.NVarChar, 255),
                                        new SqlParameter("@original_path", SqlDbType.NVarChar, 255),
                                        new SqlParameter("@remark",        SqlDbType.NVarChar, 500),
                                        new SqlParameter("@link_url",      SqlDbType.NVarChar, 200)
                                    };
                                    parameters3[0].Value = modelt.daikuan_id;
                                    parameters3[1].Value = modelt.thumb_path;
                                    parameters3[2].Value = modelt.original_path;
                                    parameters3[3].Value = modelt.remark;
                                    parameters3[4].Value = modelt.link_url;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql3.ToString(), parameters3);
                                }
                            }
                        }
                        #endregion

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(false);
                    }
                }
            }
            return(true);
        }
Пример #9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.daikuan model)
 {
     return(dal.Update(model));
 }
Пример #10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.daikuan model)
 {
     return(dal.Add(model));
 }