Ejemplo n.º 1
0
        private void ShowInfo()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            lblWSiteUrl.Text = MyCommFun.getWebSite() + "/shop/index.aspx?wid=" + weixin.id;

            IList <XCWeiXin.Model.wx_shop_setting> modellist = bll.GetModelList("wId=" + weixin.id);

            if (modellist == null || modellist.Count <= 0)
            {
                return;
            }
            XCWeiXin.Model.wx_shop_setting model = modellist[0];
            this.lblId.Text        = model.id.ToString();
            this.txtshopName.Text  = model.shopName;
            this.txtcopyright.Text = model.copyright;
            this.txtlogo.Text      = model.logo;
            this.txtbgPic.Text     = model.bgPic;
            this.txttel.Text       = model.tel;
            this.txtaddr.Text      = model.addr;


            //微支付配置信息
            lblzfsqml.Text = MyCommFun.getWebSite() + "/api/payment/";
            lblzfqqsl.Text = "paypage.aspx";
            lblwqtz.Text   = MyCommFun.getWebSite() + "/api/payment/wxpay/feedback.aspx";
            lbljjtz.Text   = MyCommFun.getWebSite() + "/api/payment/wxpay/warning.aspx";

            model.albums            = new wx_shop_albums().GetModelList("shopsettingId=" + model.id);
            rptAlbumList.DataSource = model.albums;
            rptAlbumList.DataBind();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XCWeiXin.Model.wx_shop_setting DataRowToModel(DataRow row)
 {
     XCWeiXin.Model.wx_shop_setting model = new XCWeiXin.Model.wx_shop_setting();
     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["shopName"] != null)
         {
             model.shopName = row["shopName"].ToString();
         }
         if (row["copyright"] != null)
         {
             model.copyright = row["copyright"].ToString();
         }
         if (row["logo"] != null)
         {
             model.logo = row["logo"].ToString();
         }
         if (row["bgPic"] != null)
         {
             model.bgPic = row["bgPic"].ToString();
         }
         if (row["tel"] != null)
         {
             model.tel = row["tel"].ToString();
         }
         if (row["addr"] != null)
         {
             model.addr = row["addr"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["extInt"] != null && row["extInt"].ToString() != "")
         {
             model.extInt = int.Parse(row["extInt"].ToString());
         }
         if (row["extStr"] != null)
         {
             model.extStr = row["extStr"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XCWeiXin.Model.wx_shop_setting GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,wid,shopName,copyright,logo,bgPic,tel,addr,createDate,extInt,extStr from wx_shop_setting ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(XCWeiXin.Model.wx_shop_setting model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_shop_setting(");
            strSql.Append("wid,shopName,copyright,logo,bgPic,tel,addr,createDate,extInt,extStr)");
            strSql.Append(" values (");
            strSql.Append("@wid,@shopName,@copyright,@logo,@bgPic,@tel,@addr,@createDate,@extInt,@extStr)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,         4),
                new SqlParameter("@shopName",   SqlDbType.VarChar,   200),
                new SqlParameter("@copyright",  SqlDbType.VarChar,   200),
                new SqlParameter("@logo",       SqlDbType.VarChar,   500),
                new SqlParameter("@bgPic",      SqlDbType.VarChar,   500),
                new SqlParameter("@tel",        SqlDbType.VarChar,    30),
                new SqlParameter("@addr",       SqlDbType.VarChar,   300),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@extInt",     SqlDbType.Int,         4),
                new SqlParameter("@extStr",     SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.wid;
            parameters[1].Value = model.shopName;
            parameters[2].Value = model.copyright;
            parameters[3].Value = model.logo;
            parameters[4].Value = model.bgPic;
            parameters[5].Value = model.tel;
            parameters[6].Value = model.addr;
            parameters[7].Value = model.createDate;
            parameters[8].Value = model.extInt;
            parameters[9].Value = model.extStr;

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


            #region  //图片相册
            if (model.albums != null)
            {
                StringBuilder strSql2;
                foreach (Model.wx_shop_albums modelt in model.albums)
                {
                    strSql2 = new StringBuilder();
                    strSql2.Append("insert into  wx_shop_albums(");
                    strSql2.Append("shopsettingId,thumb_path,original_path,remark,add_time,wid)");
                    strSql2.Append(" values (");
                    strSql2.Append("@shopsettingId,@thumb_path,@original_path,@remark,@add_time,@wid)");
                    SqlParameter[] parameters2 =
                    {
                        new SqlParameter("@shopsettingId", 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("@add_time",      SqlDbType.DateTime,  30),
                        new SqlParameter("@wid",           SqlDbType.Int, 4)
                    };
                    parameters2[0].Value = model.id;
                    parameters2[1].Value = modelt.thumb_path;
                    parameters2[2].Value = modelt.original_path;
                    parameters2[3].Value = modelt.remark;
                    parameters2[4].Value = DateTime.Now.ToString();
                    parameters2[5].Value = model.wid;
                    DbHelperSQL.GetSingle(strSql2.ToString(), parameters2);
                }
            }
            #endregion

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XCWeiXin.Model.wx_shop_setting model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_shop_setting set ");
            strSql.Append("wid=@wid,");
            strSql.Append("shopName=@shopName,");
            strSql.Append("copyright=@copyright,");
            strSql.Append("logo=@logo,");
            strSql.Append("bgPic=@bgPic,");
            strSql.Append("tel=@tel,");
            strSql.Append("addr=@addr,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("extInt=@extInt,");
            strSql.Append("extStr=@extStr");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,         4),
                new SqlParameter("@shopName",   SqlDbType.VarChar,   200),
                new SqlParameter("@copyright",  SqlDbType.VarChar,   200),
                new SqlParameter("@logo",       SqlDbType.VarChar,   500),
                new SqlParameter("@bgPic",      SqlDbType.VarChar,   500),
                new SqlParameter("@tel",        SqlDbType.VarChar,    30),
                new SqlParameter("@addr",       SqlDbType.VarChar,   300),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@extInt",     SqlDbType.Int,         4),
                new SqlParameter("@extStr",     SqlDbType.VarChar,   200),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.shopName;
            parameters[2].Value  = model.copyright;
            parameters[3].Value  = model.logo;
            parameters[4].Value  = model.bgPic;
            parameters[5].Value  = model.tel;
            parameters[6].Value  = model.addr;
            parameters[7].Value  = model.createDate;
            parameters[8].Value  = model.extInt;
            parameters[9].Value  = model.extStr;
            parameters[10].Value = model.id;


            #region  //添加/修改相册

            new wx_shop_albums().DeleteshopSetting(model.albums, model.id);
            if (model.albums != null)
            {
                StringBuilder strSql3;
                foreach (Model.wx_shop_albums modelt in model.albums)
                {
                    strSql3 = new StringBuilder();
                    if (modelt.id > 0)
                    {
                        strSql3.Append("update  wx_shop_albums set ");
                        strSql3.Append("shopsettingId=@shopsettingId,");
                        strSql3.Append("thumb_path=@thumb_path,");
                        strSql3.Append("original_path=@original_path,");
                        strSql3.Append("remark=@remark,");
                        strSql3.Append("add_time=@add_time,");
                        strSql3.Append("wid=@wid");
                        strSql3.Append(" where id=@id");
                        SqlParameter[] parameters3 =
                        {
                            new SqlParameter("@shopsettingId", 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("@add_time",      SqlDbType.DateTime,  20),
                            new SqlParameter("@wid",           SqlDbType.Int,        4),
                            new SqlParameter("@id",            SqlDbType.Int, 4)
                        };
                        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 = DateTime.Now.ToString();
                        parameters3[5].Value = model.wid;
                        parameters3[6].Value = modelt.id;
                        DbHelperSQL.GetSingle(strSql3.ToString(), parameters3);
                    }
                    else
                    {
                        strSql3.Append("insert into wx_shop_albums(");
                        strSql3.Append("shopsettingId,thumb_path,original_path,remark,add_time,wid)");
                        strSql3.Append(" values (");
                        strSql3.Append("@shopsettingId,@thumb_path,@original_path,@remark,@add_time,@wid)");
                        SqlParameter[] parameters3 =
                        {
                            new SqlParameter("@shopsettingId", 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("@add_time",      SqlDbType.DateTime,  30),
                            new SqlParameter("@wid",           SqlDbType.Int, 4)
                        };

                        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 = DateTime.Now.ToString();
                        parameters3[5].Value = model.wid;
                        DbHelperSQL.GetSingle(strSql3.ToString(), parameters3);
                    }
                }
            }

            #endregion


            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获得图片=焦点图片
        /// </summary>
        /// <returns></returns>
        public void getalbums()
        {
            Tag where = null;
            where     = this.Document.GetChildTagById("mwhere");
            string whereStr = "";

            if (where != null)
            {
                whereStr = where.Attributes["value"].Value.ToString();
                int mwid = MyCommFun.RequestInt("wid");
                int mcid = MyCommFun.RequestInt("cid");
                int mpic = MyCommFun.RequestInt("pid");
                int sid  = 0;
                //取settingID
                DAL.wx_shop_setting shopset = new DAL.wx_shop_setting();
                StringBuilder       strSql  = new StringBuilder();
                strSql.Append("select  top 1 id from wx_shop_setting ");
                strSql.Append(" where wid=@wid");
                SqlParameter[] parameters = { new SqlParameter("@wid", SqlDbType.Int, 4) };
                parameters[0].Value = mwid;
                XCWeiXin.Model.wx_shop_setting model = new XCWeiXin.Model.wx_shop_setting();
                DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    sid = int.Parse(ds.Tables[0].Rows[0][0].ToString());
                }



                string sqlwhere = "";
                switch (whereStr)
                {
                case "shopsettingId":
                    sqlwhere = " shopsettingId=" + sid;
                    break;

                case "classid":
                    sqlwhere = " classId=" + mcid;
                    break;

                case "productId":
                    sqlwhere = " productId=" + mpic;
                    break;

                default:
                    break;
                }

                DAL.wx_shop_albums cateBll    = new DAL.wx_shop_albums();
                DataSet            albumslist = cateBll.GetList(sqlwhere);
                if (albumslist != null && albumslist.Tables.Count > 0 && albumslist.Tables[0].Rows.Count > 0)
                {
                    DataRow dr;
                    for (int i = 0; i < albumslist.Tables.Count; i++)
                    {
                        dr = albumslist.Tables[0].Rows[i];
                        albumslist.AcceptChanges();
                    }
                }

                this.Document.SetValue("albumslist", albumslist);//文章列表
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 保存配置信息
        /// </summary>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            XCWeiXin.Model.wx_shop_setting model = new XCWeiXin.Model.wx_shop_setting();
            try
            {
                Model.wx_userweixin weixin = GetWeiXinCode();
                int      wId        = weixin.id;
                string   shopName   = this.txtshopName.Text;
                string   copyright  = this.txtcopyright.Text;
                string   logo       = this.txtlogo.Text;
                string   bgPic      = this.txtbgPic.Text;
                string   tel        = this.txttel.Text;
                string   addr       = this.txtaddr.Text;
                DateTime createDate = DateTime.Now;

                int id = int.Parse(lblId.Text.Trim());
                if (id != 0)
                {
                    //修改
                    model = bll.GetModel(id);
                }
                else
                {
                    //添加
                    model.wid        = wId;
                    model.createDate = createDate;
                }

                model.shopName  = shopName;
                model.copyright = copyright;
                model.logo      = logo;
                model.bgPic     = bgPic;
                model.tel       = tel;
                model.addr      = addr;


                #region 保存相册====================
                //检查是否有自定义图片
                if (model.albums != null)
                {
                    model.albums.Clear();
                }
                string[] albumArr  = Request.Form.GetValues("hid_photo_name");
                string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
                if (albumArr != null)
                {
                    List <Model.wx_shop_albums> ls = new List <Model.wx_shop_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 (!string.IsNullOrEmpty(remarkArr[i]))
                            {
                                ls.Add(new Model.wx_shop_albums {
                                    id = img_id, productId = id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i]
                                });
                            }
                            else
                            {
                                ls.Add(new Model.wx_shop_albums {
                                    id = img_id, productId = id, original_path = imgArr[1], thumb_path = imgArr[2]
                                });
                            }
                        }
                    }
                    model.albums = ls;
                }

                #endregion


                if (id != 0)
                {
                    bll.Update(model);
                }
                else
                {
                    id = bll.Add(model);
                }

                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改商城设置"); //记录日志
                JscriptMsg("修改商城设置成功!", "shop_setting.aspx", "Success");
            }
            catch
            {
                JscriptMsg("微网站设置失败!", "", "Error");
            }
        }