Exemplo n.º 1
0
        /// <summary>
        /// 保存配置信息
        /// </summary>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            WeiXinPF.Model.wx_product_sys model = new WeiXinPF.Model.wx_product_sys();

            try
            {
                Model.wx_userweixin weixin = GetWeiXinCode();
                int    wId    = weixin.id;
                string strErr = "";
                if (this.txthdTitle.Text.Trim().Length == 0)
                {
                    strErr += "活动标题不能为空!\\n";
                }
                if (this.txtbgPic.Text.Trim().Length == 0)
                {
                    strErr += "图片不能为空!\\n";
                }

                if (strErr != "")
                {
                    JscriptMsg(strErr, "", "Error");
                    return;
                }
                int    id      = int.Parse(this.lblId.Text);
                string hdTitle = this.txthdTitle.Text;
                string banner  = this.txtbgPic.Text;

                bool isAdd = false;
                if (id == 0)
                {
                    isAdd = true;
                }
                else
                {
                    model = bll.GetModel(id);
                }
                model.title   = hdTitle;
                model.banner  = banner;
                model.wid     = weixin.id;
                model.remark  = txtwBrief.Text.Trim();
                model.sort_id = MyCommFun.Str2Int(txtSortId.Text);
                if (isAdd)
                {
                    bll.Add(model);
                }
                else
                {
                    bll.Update(model);
                }

                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "产品库设置成功"); //记录日志
                JscriptMsg("产品库设置成功!", "product_Sys.aspx", "Success");
            }
            catch
            {
                JscriptMsg("产品库设置失败!", "", "Error");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WeiXinPF.Model.wx_product_sys model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_product_sys set ");
            strSql.Append("wid=@wid,");
            strSql.Append("title=@title,");
            strSql.Append("banner=@banner,");
            strSql.Append("extStr=@extStr,");
            strSql.Append("extStr2=@extStr2,");
            strSql.Append("extStr3=@extStr3,");
            strSql.Append("remark=@remark,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("link_url=@link_url");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@title",      SqlDbType.VarChar,    100),
                new SqlParameter("@banner",     SqlDbType.VarChar,    800),
                new SqlParameter("@extStr",     SqlDbType.VarChar,    500),
                new SqlParameter("@extStr2",    SqlDbType.VarChar,    800),
                new SqlParameter("@extStr3",    SqlDbType.VarChar,   2000),
                new SqlParameter("@remark",     SqlDbType.VarChar,   1000),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@sort_id",    SqlDbType.Int,          4),
                new SqlParameter("@link_url",   SqlDbType.VarChar,    800),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.title;
            parameters[2].Value  = model.banner;
            parameters[3].Value  = model.extStr;
            parameters[4].Value  = model.extStr2;
            parameters[5].Value  = model.extStr3;
            parameters[6].Value  = model.remark;
            parameters[7].Value  = model.createDate;
            parameters[8].Value  = model.sort_id;
            parameters[9].Value  = model.link_url;
            parameters[10].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WeiXinPF.Model.wx_product_sys DataRowToModel(DataRow row)
 {
     WeiXinPF.Model.wx_product_sys model = new WeiXinPF.Model.wx_product_sys();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["title"] != null)
         {
             model.title = row["title"].ToString();
         }
         if (row["banner"] != null)
         {
             model.banner = row["banner"].ToString();
         }
         if (row["extStr"] != null)
         {
             model.extStr = row["extStr"].ToString();
         }
         if (row["extStr2"] != null)
         {
             model.extStr2 = row["extStr2"].ToString();
         }
         if (row["extStr3"] != null)
         {
             model.extStr3 = row["extStr3"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["sort_id"] != null && row["sort_id"].ToString() != "")
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (row["link_url"] != null)
         {
             model.link_url = row["link_url"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        private void ShowInfo(int id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            lblweixinUrl.Text = MyCommFun.getWebSite() + "/weixin/product/all.aspx?wid=" + weixin.id + "&pid=" + id;


            WeiXinPF.Model.wx_product_sys model = bll.GetModel(id);
            this.lblId.Text      = model.id.ToString();
            this.txthdTitle.Text = model.title;
            this.txtbgPic.Text   = model.banner;
            imgBanner.ImageUrl   = model.banner;
            txtwBrief.Text       = model.remark;
            lblId.Text           = id.ToString();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WeiXinPF.Model.wx_product_sys model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_product_sys(");
            strSql.Append("wid,title,banner,extStr,extStr2,extStr3,remark,createDate,sort_id,link_url)");
            strSql.Append(" values (");
            strSql.Append("@wid,@title,@banner,@extStr,@extStr2,@extStr3,@remark,@createDate,@sort_id,@link_url)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@title",      SqlDbType.VarChar,    100),
                new SqlParameter("@banner",     SqlDbType.VarChar,    800),
                new SqlParameter("@extStr",     SqlDbType.VarChar,    500),
                new SqlParameter("@extStr2",    SqlDbType.VarChar,    800),
                new SqlParameter("@extStr3",    SqlDbType.VarChar,   2000),
                new SqlParameter("@remark",     SqlDbType.VarChar,   1000),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@sort_id",    SqlDbType.Int,          4),
                new SqlParameter("@link_url",   SqlDbType.VarChar, 800)
            };
            parameters[0].Value = model.wid;
            parameters[1].Value = model.title;
            parameters[2].Value = model.banner;
            parameters[3].Value = model.extStr;
            parameters[4].Value = model.extStr2;
            parameters[5].Value = model.extStr3;
            parameters[6].Value = model.remark;
            parameters[7].Value = model.createDate;
            parameters[8].Value = model.sort_id;
            parameters[9].Value = model.link_url;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WeiXinPF.Model.wx_product_sys GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,wid,title,banner,extStr,extStr2,extStr3,remark,createDate,sort_id,link_url from wx_product_sys ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }