Esempio n. 1
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.article bll = new BLL.article();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!"));
         return;
     }
     model = bll.GetGoodsModel(id);
     //浏览数+1
     bll.UpdateField(id, "click=click+1");
     //跳转URL
     if (model.link_url != null)
         model.link_url = model.link_url.Trim();
     if (!string.IsNullOrEmpty(model.link_url))
     {
         HttpContext.Current.Response.Redirect(model.link_url);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Model.article_goods> GetList(int channel_id, int article_id)
        {
            List <Model.article_goods> modelList = new List <Model.article_goods>();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * FROM " + databaseprefix + "article_goods");
            strSql.Append(" where channel_id=" + channel_id + " and article_id=" + article_id);
            DataTable dt = DbHelperSQL.Query(strSql.ToString()).Tables[0];

            if (dt.Rows.Count > 0)
            {
                Model.article_goods model;
                for (int n = 0; n < dt.Rows.Count; n++)
                {
                    #region 主表数据========================
                    model = new Model.article_goods();
                    //利用反射获得属性的所有公共属性
                    Type modelType = model.GetType();
                    for (int i = 0; i < dt.Rows[n].Table.Columns.Count; i++)
                    {
                        //查找实体是否存在列表相同的公共属性
                        PropertyInfo proInfo = modelType.GetProperty(dt.Rows[n].Table.Columns[i].ColumnName);
                        if (proInfo != null && dt.Rows[n][i] != DBNull.Value)
                        {
                            proInfo.SetValue(model, dt.Rows[n][i], null);//用索引值设置属性值
                        }
                    }
                    #endregion

                    #region 用户组价格数据==================
                    StringBuilder strSql2 = new StringBuilder();
                    strSql2.Append("select * FROM " + databaseprefix + "user_group_price");
                    strSql2.Append(" where goods_id=" + model.id);
                    DataTable dt2 = DbHelperSQL.Query(strSql2.ToString()).Tables[0];
                    if (dt2.Rows.Count > 0)
                    {
                        List <Model.user_group_price> ls = new List <Model.user_group_price>();
                        Model.user_group_price        gpModel;
                        for (int j = 0; j < dt2.Rows.Count; j++)
                        {
                            gpModel = new Model.user_group_price();
                            //利用反射获得属性的所有公共属性
                            Type gpType = gpModel.GetType();
                            for (int i = 0; i < dt2.Rows[j].Table.Columns.Count; i++)
                            {
                                //查找实体是否存在列表相同的公共属性
                                PropertyInfo proInfo = gpType.GetProperty(dt2.Rows[j].Table.Columns[i].ColumnName);
                                if (proInfo != null && dt.Rows[j][i] != DBNull.Value)
                                {
                                    proInfo.SetValue(gpModel, dt2.Rows[j][i], null);//用索引值设置属性值
                                }
                            }
                            ls.Add(gpModel);
                        }
                        model.group_prices = ls;
                    }
                    #endregion

                    modelList.Add(model);
                }
            }
            return(modelList);
        }
        public void PublishUsedGood_Andriod2(string title, string type, string quantity, string price, string description, string userId, string mobilephone, string imgarr1, string imgarr2, string imgarr3, string imgarr4, string version, string equType, string equName)
        {
            byte[] byte_img1 = Encoding.UTF8.GetBytes(imgarr1.Replace(" ", "").Replace("<", "").Replace(">", "") + "");//imgdata.Replace(" ", "").Replace("<", "").Replace(">", "")
            byte[] byte_img2 = Encoding.UTF8.GetBytes(imgarr2.Replace(" ", "").Replace("<", "").Replace(">", "") + "");
            byte[] byte_img3 = Encoding.UTF8.GetBytes(imgarr3.Replace(" ", "").Replace("<", "").Replace(">", "") + "");
            byte[] byte_img4 = Encoding.UTF8.GetBytes(imgarr4.Replace(" ", "").Replace("<", "").Replace(">", "") + "");

            string json_result = string.Empty;
            if (string.IsNullOrEmpty(title))
            {
                json_result = "{\"status\":\"false\",\"data\":\"title参数不能为空!\"}";
                Context.Response.Write(json_result);
                Context.Response.End();
                return;
            }
            //变量处理
            int _type = 0, _userId = 0, _quantity = 0;
            decimal _price = 0;

            int.TryParse(type, out _type);
            int.TryParse(quantity, out _quantity);
            int.TryParse(userId, out _userId);
            decimal.TryParse(price, out _price);

            try
            {

                bool result = true;
                Model.article_goods model = new Model.article_goods();
                model.channel_id = (int)DTEnums.ChannelEnum.goods;
                model.title = title;
                model.category_id = _type;
                model.stock_quantity = _quantity;
                model.market_price = _price;
                model.sell_price = _price;
                model.content = description;
                model.user_id = _userId;
                model.add_time = DateTime.Now;
                model.goods_no = mobilephone;
                model.img_url = "";
                //处理图片组

                //定义一个字节数组
                List<byte[]> lst_img = new List<byte[]>();

                if (byte_img1.Length > 0)
                {
                    lst_img.Add(byte_img1);
                }
                if (byte_img2.Length > 0)
                {
                    lst_img.Add(byte_img2);
                }
                if (byte_img3.Length > 0)
                {
                    lst_img.Add(byte_img3);

                }
                if (byte_img4.Length > 0)
                {
                    lst_img.Add(byte_img4);
                }

                if (lst_img.Count > 0)
                {
                    UpLoad _uploadHelper = new UpLoad();
                    List<Model.article_albums> _ls_albums = new List<Model.article_albums>();

                    string _temp = string.Empty;
                    for (int i = 0; i < lst_img.Count; i++)
                    {
                        _temp = _uploadHelper.BytesToImg(lst_img[i]);
                        if (_temp == null)
                        {
                            Context.Response.Write("{\"status\":\"false\",\"data\":\"上传图片过程中发生意外!\"}");
                            Context.Response.End();
                            return;
                        }
                        //图片上传处理(存入相册中)
                        _ls_albums.Add(new Model.article_albums
                        {
                            big_img = _temp,
                            small_img = _temp,
                            remark = ""
                        });
                        model.img_url = _temp;
                    }
                    model.albums = _ls_albums;

                }

                model.link_url = "";
                model.is_red = 0;
                model.is_slide = 0;
                model.is_top = 0;
                model.sort_id = 99;
                model.add_time = DateTime.Now;

                if (bll_article.Add(model) < 1)
                {
                    json_result = "{\"status\":\"false\",\"data\":\"添加失败!\"}";
                }
                else
                {
                    json_result = "{\"status\":\"true\",\"data\":\"添加成功!\"}";
                }

            }
            catch (Exception ex)
            {
                json_result = "{\"status\":\"false\",\"data\":\"" + ex.Message + "\"}";
            }
            WriteWebServiceLog(version, equType, equName, "PublishUsedGood_Andriod2", "");
            Context.Response.Write(json_result);
            Context.Response.End();
        }
Esempio n. 4
0
        private bool DoAdd()
        {
            bool result = true;
            Model.article_goods model = new Model.article_goods();
            BLL.article bll = new BLL.article();

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.goods_no =  txtPhone.Text.Trim();
            model.stock_quantity = int.Parse(txtStockQuantity.Text);
            model.market_price = decimal.Parse(txtSellPrice.Text);
            model.sell_price = decimal.Parse(txtSellPrice.Text);
            model.point = 00;
            model.link_url = "";
            model.img_url = focus_photo.Value;
            model.content = txtContent.Text;
            model.seo_title = "";
            model.seo_keywords = "";
            model.seo_description = "";
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.click = 0;
            model.digg_good = 0;
            model.digg_bad = 0;
            model.is_msg = 0;
            model.is_top = 0;
            model.is_red = 0;
            model.is_hot = 0;
            model.is_slide = 0;
            model.is_lock = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[3].Selected == true)
            {
                model.is_hot = 1;
            }
            if (cblItem.Items[4].Selected == true)
            {
                model.is_slide = 1;
            }
            if (cblItem.Items[5].Selected == true)
            {
                model.is_lock = 1;
            }
            //保存相册
            string[] albumArr = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null && albumArr.Length > 0)
            {
                List<Model.article_albums> ls = new List<Model.article_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.article_albums { big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] });
                        }
                        else
                        {
                            ls.Add(new Model.article_albums { big_img = imgArr[1], small_img = imgArr[2] });
                        }
                    }
                }
                model.albums = ls;
            }
            model.user_id = 1;
            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return result;
        }
Esempio n. 5
0
        /// <summary>
        /// 增加一条数据,及其子表数据
        /// </summary>
        public int Add(Model.article_goods model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dt_article(");
            strSql.Append("channel_id,category_id,title,link_url,img_url,seo_title,seo_keywords,seo_description,content,sort_id,click,is_lock,user_id,add_time)");
            strSql.Append(" values (");
            strSql.Append("@channel_id,@category_id,@title,@link_url,@img_url,@seo_title,@seo_keywords,@seo_description,@content,@sort_id,@click,@is_lock,@user_id,@add_time)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@channel_id",      SqlDbType.Int,         4),
                new SqlParameter("@category_id",     SqlDbType.Int,         4),
                new SqlParameter("@title",           SqlDbType.NVarChar,  100),
                new SqlParameter("@link_url",        SqlDbType.NVarChar,  255),
                new SqlParameter("@img_url",         SqlDbType.NVarChar,  255),
                new SqlParameter("@seo_title",       SqlDbType.NVarChar,  255),
                new SqlParameter("@seo_keywords",    SqlDbType.NVarChar,  255),
                new SqlParameter("@seo_description", SqlDbType.NVarChar,  255),
                new SqlParameter("@content",         SqlDbType.NText),
                new SqlParameter("@sort_id",         SqlDbType.Int,         4),
                new SqlParameter("@click",           SqlDbType.Int,         4),
                new SqlParameter("@is_lock",         SqlDbType.TinyInt,     1),
                new SqlParameter("@user_id",         SqlDbType.Int,         4),
                new SqlParameter("@add_time",        SqlDbType.DateTime),
                new SqlParameter("@ReturnValue",     SqlDbType.Int)
            };
            parameters[0].Value      = model.channel_id;
            parameters[1].Value      = model.category_id;
            parameters[2].Value      = model.title;
            parameters[3].Value      = model.link_url;
            parameters[4].Value      = model.img_url;
            parameters[5].Value      = model.seo_title;
            parameters[6].Value      = model.seo_keywords;
            parameters[7].Value      = model.seo_description;
            parameters[8].Value      = model.content;
            parameters[9].Value      = model.sort_id;
            parameters[10].Value     = model.click;
            parameters[11].Value     = model.is_lock;
            parameters[12].Value     = model.user_id;
            parameters[13].Value     = model.add_time;
            parameters[14].Direction = ParameterDirection.Output;
            List <CommandInfo> sqllist = new List <CommandInfo>();
            CommandInfo        cmd     = new CommandInfo(strSql.ToString(), parameters);

            sqllist.Add(cmd);

            //副表信息
            StringBuilder strSql2 = new StringBuilder();

            strSql2.Append("insert into dt_article_goods(");
            strSql2.Append("id,goods_no,stock_quantity,market_price,sell_price,point,is_msg,is_top,is_red,is_hot,is_slide)");
            strSql2.Append(" values (");
            strSql2.Append("@id,@goods_no,@stock_quantity,@market_price,@sell_price,@point,@is_msg,@is_top,@is_red,@is_hot,@is_slide)");
            SqlParameter[] parameters2 =
            {
                new SqlParameter("@id",             SqlDbType.Int,        4),
                new SqlParameter("@goods_no",       SqlDbType.NVarChar, 100),
                new SqlParameter("@stock_quantity", SqlDbType.Int,        4),
                new SqlParameter("@market_price",   SqlDbType.Decimal,    5),
                new SqlParameter("@sell_price",     SqlDbType.Decimal,    5),
                new SqlParameter("@point",          SqlDbType.Int,        4),
                new SqlParameter("@is_msg",         SqlDbType.TinyInt,    1),
                new SqlParameter("@is_top",         SqlDbType.TinyInt,    1),
                new SqlParameter("@is_red",         SqlDbType.TinyInt,    1),
                new SqlParameter("@is_hot",         SqlDbType.TinyInt,    1),
                new SqlParameter("@is_slide",       SqlDbType.TinyInt, 1)
            };
            parameters2[0].Direction = ParameterDirection.InputOutput;
            parameters2[1].Value     = model.goods_no;
            parameters2[2].Value     = model.stock_quantity;
            parameters2[3].Value     = model.market_price;
            parameters2[4].Value     = model.sell_price;
            parameters2[5].Value     = model.point;
            parameters2[6].Value     = model.is_msg;
            parameters2[7].Value     = model.is_top;
            parameters2[8].Value     = model.is_red;
            parameters2[9].Value     = model.is_hot;
            parameters2[10].Value    = model.is_slide;
            cmd = new CommandInfo(strSql2.ToString(), parameters2);
            sqllist.Add(cmd);

            //顶和踩
            StringBuilder strSql3 = new StringBuilder();

            strSql3.Append("insert into dt_article_diggs(");
            strSql3.Append("id,digg_good,digg_bad)");
            strSql3.Append(" values (");
            strSql3.Append("@id,@digg_good,@digg_bad)");
            SqlParameter[] parameters3 =
            {
                new SqlParameter("@id",        SqlDbType.Int, 4),
                new SqlParameter("@digg_good", SqlDbType.Int, 4),
                new SqlParameter("@digg_bad",  SqlDbType.Int, 4)
            };
            parameters3[0].Direction = ParameterDirection.InputOutput;
            parameters3[1].Value     = model.digg_good;
            parameters3[2].Value     = model.digg_bad;
            cmd = new CommandInfo(strSql3.ToString(), parameters3);
            sqllist.Add(cmd);

            //图片相册
            if (model.albums != null)
            {
                StringBuilder strSql4;
                foreach (Model.article_albums models in model.albums)
                {
                    strSql4 = new StringBuilder();
                    strSql4.Append("insert into dt_article_albums(");
                    strSql4.Append("article_id,big_img,small_img,remark)");
                    strSql4.Append(" values (");
                    strSql4.Append("@article_id,@big_img,@small_img,@remark)");
                    SqlParameter[] parameters4 =
                    {
                        new SqlParameter("@article_id", SqlDbType.Int,        4),
                        new SqlParameter("@big_img",    SqlDbType.NVarChar, 255),
                        new SqlParameter("@small_img",  SqlDbType.NVarChar, 255),
                        new SqlParameter("@remark",     SqlDbType.NVarChar, 500)
                    };
                    parameters4[0].Direction = ParameterDirection.InputOutput;
                    parameters4[1].Value     = models.big_img;
                    parameters4[2].Value     = models.small_img;
                    parameters4[3].Value     = models.remark;

                    cmd = new CommandInfo(strSql4.ToString(), parameters4);
                    sqllist.Add(cmd);
                }
            }
            //扩展属性
            if (model.attribute_values != null)
            {
                StringBuilder strSql5;
                foreach (Model.attribute_value models in model.attribute_values)
                {
                    strSql5 = new StringBuilder();
                    strSql5.Append("insert into dt_attribute_value(");
                    strSql5.Append("article_id,attribute_id,title,content)");
                    strSql5.Append(" values (");
                    strSql5.Append("@article_id,@attribute_id,@title,@content)");
                    SqlParameter[] parameters5 =
                    {
                        new SqlParameter("@article_id",   SqlDbType.Int,        4),
                        new SqlParameter("@attribute_id", SqlDbType.Int,        4),
                        new SqlParameter("@title",        SqlDbType.NVarChar, 100),
                        new SqlParameter("@content",      SqlDbType.NText)
                    };
                    parameters5[0].Direction = ParameterDirection.InputOutput;
                    parameters5[1].Value     = models.attribute_id;
                    parameters5[2].Value     = models.title;
                    parameters5[3].Value     = models.content;
                    cmd = new CommandInfo(strSql5.ToString(), parameters5);
                    sqllist.Add(cmd);
                }
            }

            //用户组价格
            if (model.goods_group_prices != null)
            {
                StringBuilder strSql6;
                foreach (Model.goods_group_price models in model.goods_group_prices)
                {
                    strSql6 = new StringBuilder();
                    strSql6.Append("insert into dt_goods_group_price(");
                    strSql6.Append("article_id,group_id,price)");
                    strSql6.Append(" values (");
                    strSql6.Append("@article_id,@group_id,@price)");
                    SqlParameter[] parameters6 =
                    {
                        new SqlParameter("@article_id", SqlDbType.Int,     4),
                        new SqlParameter("@group_id",   SqlDbType.Int,     4),
                        new SqlParameter("@price",      SqlDbType.Decimal, 5)
                    };
                    parameters6[0].Direction = ParameterDirection.InputOutput;
                    parameters6[1].Value     = models.group_id;
                    parameters6[2].Value     = models.price;
                    cmd = new CommandInfo(strSql6.ToString(), parameters6);
                    sqllist.Add(cmd);
                }
            }

            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return((int)parameters[14].Value);
        }
Esempio n. 6
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            BLL.article         bll   = new BLL.article();
            Model.article_goods model = bll.GetGoodsModel(_id);

            model.channel_id  = this.channel_id;
            model.title       = txtTitle.Text.Trim();
            model.category_id = Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            model.goods_no    = txtY.Text;
            //model.stock_quantity = Utils.StrToInt(txtStockQuantity.Text);
            model.sell_price = Utils.StrToDecimal(txtMarketPrice.Text, 0);
            //model.sell_price = decimal.Parse(txtSellPrice.Text);
            model.point = Utils.StrToInt(txtPoint.Text, 0);
            //model.link_url = txtLinkUrl.Text.Trim();
            model.img_url         = DTRequest.GetFormString("focus_photo");
            model.content         = txtContent.Value;
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keywords    = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            //model.sort_id = Utils.StrToInt(txtSortId.Text.Trim());
            //model.click = Utils.StrToInt(txtClick.Text.Trim());
            model.digg_good = Utils.StrToInt(txtDiggGood.Text.Trim(), 0);
            //model.digg_bad = Utils.StrToInt(txtDiggBad.Text.Trim());
            model.add_time  = Utils.StrToDateTime(txtTime.Text.ToString(), DateTime.Now);
            model.is_msg    = 0;
            model.is_top    = 0;
            model.is_red    = 0;
            model.is_hot    = 0;
            model.is_slide  = 0;
            model.is_lock   = 0;
            model.lianxiren = txtuser.Text;
            //model.shangpinType = txtshangpintype.Text;
            //if (cblItem.Items[0].Selected == true)
            //{
            //    model.is_msg = 1;
            //}
            //if (cblItem.Items[1].Selected == true)
            //{
            //    model.is_top = 1;
            //}
            //if (cblItem.Items[2].Selected == true)
            //{
            //    model.is_red = 1;
            //}
            //if (cblItem.Items[3].Selected == true)
            //{
            //    model.is_hot = 1;
            //}
            //if (cblItem.Items[4].Selected == true)
            //{
            //    model.is_slide = 1;
            //}
            //if (cblItem.Items[5].Selected == true)
            //{
            //    model.is_lock = 1;
            //}
            //用戶組價格
            List <Model.goods_group_price> priceList = new List <Model.goods_group_price>();

            for (int i = 0; i < rptPrice.Items.Count; i++)
            {
                int hidPriceId = 0;
                if (!string.IsNullOrEmpty(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value))
                {
                    hidPriceId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hidePriceId")).Value);
                }
                int     hidGroupId = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value);
                decimal _price     = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim());
                priceList.Add(new Model.goods_group_price {
                    id = hidPriceId, article_id = _id, group_id = hidGroupId, price = _price
                });
            }
            model.goods_group_prices = priceList;
            //儲存相冊
            if (model.albums != null)
            {
                model.albums.Clear();
            }
            string[] albumArr  = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null)
            {
                List <Model.article_albums> ls = new List <Model.article_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.article_albums {
                                id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.article_albums {
                                id = img_id, article_id = _id, big_img = imgArr[1], small_img = imgArr[2]
                            });
                        }
                    }
                }
                model.albums = ls;
            }

            //擴展屬性
            BLL.attributes bll2 = new BLL.attributes();
            DataSet        ds2  = bll2.GetList("channel_id=" + this.channel_id);

            List <Model.attribute_value> attrls = new List <Model.attribute_value>();

            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                int    attr_id            = Utils.StrToInt(dr["id"].ToString(), 0);
                string attr_title         = dr["title"].ToString();
                string attr_value_id      = Request.Form["value_" + attr_id];
                string attr_value_content = Request.Form["content_" + attr_id];
                if (!string.IsNullOrEmpty(attr_value_id) && !string.IsNullOrEmpty(attr_value_content))
                {
                    attrls.Add(new Model.attribute_value {
                        id = Convert.ToInt32(attr_value_id), article_id = _id, attribute_id = attr_id, title = attr_title, content = attr_value_content
                    });
                }
            }
            model.attribute_values = attrls;



            model.Postid = CheckBoxList1.SelectedValue;
            model.Type   = Utils.StrToInt(cblItem.SelectedValue, 0);

            //if (!string.IsNullOrEmpty(ddlquyu.SelectedValue))
            //{
            //    model.quyu = Convert.ToInt32(ddlquyu.SelectedValue);
            //}
            //if (!string.IsNullOrEmpty(ddljiaqian.SelectedValue))
            //{
            //    model.jiaqianQJ = Convert.ToInt32(ddljiaqian.SelectedValue);
            //}
            model.mianji = Utils.StrToInt(txtMianJi.Text, 0);
            if (!string.IsNullOrEmpty(ddlhuxing.SelectedValue))
            {
                model.huxing = Utils.StrToInt(ddlhuxing.SelectedValue, 0);
            }
            //if (!string.IsNullOrEmpty(ddlfangshi.SelectedValue))
            //{
            //    model.fangshi = Convert.ToInt32(ddlfangshi.SelectedValue);
            //}
            if (!string.IsNullOrEmpty(ddlditie.SelectedValue))
            {
                model.xianlu = Utils.StrToInt(ddlditie.SelectedValue, 0);
            }

            model.yajin    = string.IsNullOrEmpty(txtyajin.Text) ? 0 : Utils.StrToInt(txtyajin.Text, 0);
            model.zuoxiang = txtzuoxiang.Text;
            model.louceng  = txtlouceng.Text;
            model.xingneng = txtxingneng.Text;
            model.yongtu   = txtSinglePrice.Text;
            model.chewei   = chkPort.Checked == true ? "有" : "無";
            model.shequ    = txtshequ.Text;
            model.dizhi    = txtdizhi.Text;
            model.gongsi   = txtgongsi.Text;
            //model.fuwuxiangju = txtfuwxiangmu.Text;
            model.dianhua = txtdianhua.Text;

            model.Areaid = Utils.StrToInt(ddlAreaid.SelectedValue, 0);

            model.Status      = 1;
            model.xiajialiyou = xiajiatext.Value;


            #region 宴會廳參數
            model.link_url       = txtZhuoShu.Text.Trim();             //桌數
            model.fuwuxiangju    = txtSize.Text;                       //尺寸
            model.stock_quantity = chkKitchen.Checked == true ? 1 : 0; //廚房
            model.fangshi        = chkStage.Checked == true ? 1 : 0;   //舞台
            model.quyu           = chkSound.Checked == true ? 1 : 0;   //音響
            model.jiaqianQJ      = chkScreen.Checked == true ? 1 : 0;  //投螢幕;
            model.shangpinType   = ddlForm.Text.Trim();                //形式
            #endregion

            if (!bll.Update(model))
            {
                result = false;
            }
            return(result);
        }
Esempio n. 7
0
        private void ShowInfo(int _id)
        {
            BLL.article         bll   = new BLL.article();
            Model.article_goods model = bll.GetGoodsModel(_id);

            #region 土地參數
            txtDImu.Text         = model.link_url;             //地目
            txtChiFen.Text       = model.fuwuxiangju;          //持分
            txtRongyiLv.Text     = model.jiaqianQJ.ToString(); //容積率
            txtNowPrice.Text     = model.shangpinType;         //公告現值
            txtJianBiLv.Text     = model.quyu.ToString();      //建蔽率
            chkDiShangWu.Checked = false;
            if (model.stock_quantity == 1)
            {
                chkDiShangWu.Checked = true;    //地上物
            }
            //ddlForm.SelectedValue = model.fangshi.ToString(); //形式
            txtUserTo.Text     = model.xingneng;          //現況用途
            txtRoadsWidth.Text = model.huxing.ToString(); //路宽
            #endregion


            txtPrice.Text = model.market_price.ToString();

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            ddlArea.SelectedValue       = model.point.ToString();
            txtTitle.Text = model.title;
            txtY.Text     = model.goods_no;
            //txtStockQuantity.Text = model.stock_quantity.ToString();
            txtMarketPrice.Text = model.sell_price.ToString();
            //txtSellPrice.Text = model.sell_price.ToString();
            txtSinglePrice.Text = model.single_price.ToString();
            model.point         = Utils.StringToNum(ddlArea.SelectedValue); //使用分區
            //txtLinkUrl.Text = model.link_url;
            txtTime.Text = model.add_time.ToString();
            txtuser.Text = model.lianxiren;
            // txtshangpintype.Text = model.shangpinType;
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }
            if (model.is_lock == 1)
            {
                cblItem.Items[5].Selected = true;
            }
            //txtSortId.Text = model.sort_id.ToString();
            //txtClick.Text = model.click.ToString();
            //txtDiggGood.Text = model.digg_good.ToString();
            //txtDiggBad.Text = model.digg_bad.ToString();
            txtContent.Value       = model.content;
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            //賦值用戶組價格
            //if (model.goods_group_prices != null)
            //{
            //    for (int i = 0; i < this.rptPrice.Items.Count; i++)
            //    {
            //        int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value);
            //        foreach (Model.goods_group_price modelt in model.goods_group_prices)
            //        {
            //            if (hideId == modelt.group_id)
            //            {
            //                ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString();
            //                ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString();
            //            }
            //        }
            //    }
            //}
            //賦值上傳的相冊
            focus_photo.Value = model.img_url; //封面圖片
            LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url);
            //賦值屬性清單
            LitAttributeList.Text       = GetAttributeHtml(model.attribute_values, this.channel_id, _id);
            cblItem.SelectedValue       = model.Type.ToString();
            CheckBoxList1.SelectedValue = model.Postid;

            //ddlquyu.SelectedValue = model.quyu.ToString();
            //ddljiaqian.SelectedValue = model.jiaqianQJ.ToString();
            txtMianJi.Text = model.mianji.ToString();
            //ddlhuxing.SelectedValue = model.huxing.ToString();
            //ddlfangshi.SelectedValue = model.fangshi.ToString();
            ddlditie.SelectedValue = model.xianlu.ToString();

            txtyajin.Text = model.yajin.ToString();
            //txtzuoxiang.Text = model.zuoxiang;
            //txtlouceng.Text = model.louceng;
            //txtxingneng.Text = model.xingneng;
            txtyongtu.Text      = model.yongtu;
            txtSinglePrice.Text = model.single_price.ToString();
            chkPort.Checked     = model.chewei == "有" ? true : false;
            txtNo.Text          = model.shequ;
            txtdizhi.Text       = model.dizhi;

            txtgongsi.Text = model.gongsi;
            //txtfuwxiangmu.Text = model.fuwuxiangju;
            txtdianhua.Text         = model.dianhua;
            ddlAreaid.SelectedValue = model.Areaid.ToString();
            xiajiacheck.Checked     = model.Status == 1 ? false : true;
            xiajiatext.Value        = model.xiajialiyou;
        }
Esempio n. 8
0
 /// <summary>
 /// 转换成List
 /// </summary>
 public static List <Model.cart_items> ToList(List <Model.cart_keys> ls, int group_id)
 {
     if (ls != null)
     {
         List <Model.cart_items> iList = new List <Model.cart_items>();
         foreach (Model.cart_keys item in ls)
         {
             //查询文章的信息
             Model.article articleModel = new BLL.article().GetModel(item.channel_id, item.article_id);
             if (articleModel == null || !articleModel.fields.ContainsKey("sell_price"))
             {
                 continue;
             }
             //查询商品信息
             Model.article_goods goodsModel = articleModel.goods.Find(p => p.id == item.goods_id);
             if (articleModel.goods != null && articleModel.goods.Count > 0 && goodsModel == null)
             {
                 continue;
             }
             //开始赋值
             Model.cart_items modelt = new Model.cart_items();
             modelt.channel_id = articleModel.channel_id;
             modelt.article_id = articleModel.id;
             if (articleModel.fields.ContainsKey("goods_no"))
             {
                 modelt.goods_no = articleModel.fields["goods_no"];
             }
             modelt.title      = articleModel.title;
             modelt.img_url    = articleModel.img_url;
             modelt.sell_price = Utils.StrToDecimal(articleModel.fields["sell_price"], 0);
             modelt.user_price = Utils.StrToDecimal(articleModel.fields["sell_price"], 0);
             if (articleModel.fields.ContainsKey("point"))
             {
                 modelt.point = Utils.StrToInt(articleModel.fields["point"], 0);
             }
             if (articleModel.fields.ContainsKey("stock_quantity"))
             {
                 modelt.stock_quantity = Utils.StrToInt(articleModel.fields["stock_quantity"], 0);
             }
             bool setStatus = false; //会员组价格赋值状态
             if (goodsModel != null)
             {
                 modelt.stock_quantity = goodsModel.stock_quantity; //库存
                 modelt.sell_price     = goodsModel.sell_price;     //商品价格
                 modelt.user_price     = goodsModel.sell_price;     //会员组价格
                 modelt.goods_id       = goodsModel.id;
                 modelt.goods_no       = goodsModel.goods_no;
                 modelt.spec_text      = goodsModel.spec_text;
                 //会员组价格
                 if (group_id > 0 && goodsModel.group_prices != null)
                 {
                     Model.user_group_price userPriceModel = goodsModel.group_prices.Find(p => p.group_id == group_id);
                     if (userPriceModel != null)
                     {
                         setStatus         = true; //已赋值
                         modelt.user_price = userPriceModel.price;
                     }
                 }
             }
             //如果未曾有会员组价格则使用折扣价格
             if (group_id > 0 && !setStatus)
             {
                 int discount = new BLL.user_groups().GetDiscount(group_id);
                 if (discount > 0)
                 {
                     modelt.user_price = modelt.sell_price * discount / 100;
                 }
             }
             modelt.quantity = item.quantity;
             //添加入列表
             iList.Add(modelt);
         }
         return(iList);
     }
     return(null);
 }
Esempio n. 9
0
        /// <summary>
        /// 根据规格列表查询商品实体
        /// </summary>
        public Model.article_goods GetModel(int article_id, string spec_ids)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1 id,article_id,goods_no,spec_ids,spec_text,stock_quantity,market_price,sell_price from " + databaseprefix + "article_goods");
            strSql.Append(" where article_id=@article_id and spec_ids=@spec_ids");
            SqlParameter[] parameters = {
                    new SqlParameter("@article_id", SqlDbType.Int,4),
                    new SqlParameter("@spec_ids", SqlDbType.NVarChar,500)};
            parameters[0].Value = article_id;
            parameters[1].Value = spec_ids;

            Model.article_goods model = new Model.article_goods();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Esempio n. 10
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.article_goods DataRowToModel(DataRow row)
 {
     Model.article_goods model = new Model.article_goods();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["article_id"] != null && row["article_id"].ToString() != "")
         {
             model.article_id = int.Parse(row["article_id"].ToString());
         }
         if (row["goods_no"] != null)
         {
             model.goods_no = row["goods_no"].ToString();
         }
         if (row["spec_ids"] != null)
         {
             model.spec_ids = row["spec_ids"].ToString();
         }
         if (row["spec_text"] != null)
         {
             model.spec_text = row["spec_text"].ToString();
         }
         if (row["stock_quantity"] != null && row["stock_quantity"].ToString() != "")
         {
             model.stock_quantity = int.Parse(row["stock_quantity"].ToString());
         }
         if (row["market_price"] != null && row["market_price"].ToString() != "")
         {
             model.market_price = decimal.Parse(row["market_price"].ToString());
         }
         if (row["sell_price"] != null && row["sell_price"].ToString() != "")
         {
             model.sell_price = decimal.Parse(row["sell_price"].ToString());
         }
     }
     return model;
 }
Esempio n. 11
0
        /// <summary>
        /// 得到一个商品价格列表
        /// </summary>
        public List<Model.article_goods> GetList(int article_id)
        {
            List<Model.article_goods> modelList = new List<Model.article_goods>();
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,article_id,goods_no,spec_ids,spec_text,stock_quantity,market_price,sell_price");
            strSql.Append(" FROM " + databaseprefix + "article_goods");
            strSql.Append(" where article_id=" + article_id);
            DataTable dt = DbHelperSQL.Query(strSql.ToString()).Tables[0];

            if (dt.Rows.Count > 0)
            {
                Model.article_goods model;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    model = new Model.article_goods();
                    #region 主表数据========================
                    if (dt.Rows[i]["id"] != null && dt.Rows[i]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[i]["id"].ToString());
                    }
                    if (dt.Rows[i]["article_id"] != null && dt.Rows[i]["article_id"].ToString() != "")
                    {
                        model.article_id = int.Parse(dt.Rows[i]["article_id"].ToString());
                    }
                    if (dt.Rows[i]["goods_no"] != null)
                    {
                        model.goods_no = dt.Rows[i]["goods_no"].ToString();
                    }
                    if (dt.Rows[i]["spec_ids"] != null)
                    {
                        model.spec_ids = dt.Rows[i]["spec_ids"].ToString();
                    }
                    if (dt.Rows[i]["spec_text"] != null)
                    {
                        model.spec_text = dt.Rows[i]["spec_text"].ToString();
                    }
                    if (dt.Rows[i]["stock_quantity"] != null && dt.Rows[i]["stock_quantity"].ToString() != "")
                    {
                        model.stock_quantity = int.Parse(dt.Rows[i]["stock_quantity"].ToString());
                    }
                    if (dt.Rows[i]["market_price"] != null && dt.Rows[i]["market_price"].ToString() != "")
                    {
                        model.market_price = decimal.Parse(dt.Rows[i]["market_price"].ToString());
                    }
                    if (dt.Rows[i]["sell_price"] != null && dt.Rows[i]["sell_price"].ToString() != "")
                    {
                        model.sell_price = decimal.Parse(dt.Rows[i]["sell_price"].ToString());
                    }
                    #endregion

                    #region 用户组价格数据==================
                    StringBuilder strSql2 = new StringBuilder();
                    strSql2.Append("select id,article_id,goods_id,group_id,price");
                    strSql2.Append(" FROM " + databaseprefix + "user_group_price");
                    strSql2.Append(" where goods_id=" + model.id);
                    DataTable dt2 = DbHelperSQL.Query(strSql2.ToString()).Tables[0];
                    if (dt2.Rows.Count > 0)
                    {
                        List<Model.user_group_price> ls = new List<Model.user_group_price>();
                        for (int j = 0; j < dt2.Rows.Count; j++)
                        {
                            Model.user_group_price gpModel = new Model.user_group_price();
                            if (dt2.Rows[j]["id"] != null && dt2.Rows[j]["id"].ToString() != "")
                            {
                                gpModel.id = int.Parse(dt2.Rows[j]["id"].ToString());
                            }
                            if (dt2.Rows[j]["article_id"] != null && dt2.Rows[j]["article_id"].ToString() != "")
                            {
                                gpModel.article_id = int.Parse(dt2.Rows[j]["article_id"].ToString());
                            }
                            if (dt2.Rows[j]["goods_id"] != null && dt2.Rows[j]["goods_id"].ToString() != "")
                            {
                                gpModel.goods_id = int.Parse(dt2.Rows[j]["goods_id"].ToString());
                            }
                            if (dt2.Rows[j]["group_id"] != null && dt2.Rows[j]["group_id"].ToString() != "")
                            {
                                gpModel.group_id = int.Parse(dt2.Rows[j]["group_id"].ToString());
                            }
                            if (dt2.Rows[j]["price"] != null && dt2.Rows[j]["price"].ToString() != "")
                            {
                                gpModel.price = decimal.Parse(dt2.Rows[j]["price"].ToString());
                            }
                            ls.Add(gpModel);
                        }
                        model.group_prices = ls;
                    }
                    #endregion

                    modelList.Add(model);
                }
            }
            return modelList;
        }
Esempio n. 12
0
        private void Bind()
        {
            BLL.article         bll   = new BLL.article();
            Model.article_goods model = bll.GetGoodsModel(id);
            if (model != null)
            {
                p_1.Visible   = false;
                p_2_3.Visible = true;
                p_2.Visible   = false;
                if (model.category_id == 298)
                {
                    p_1.Visible   = true;
                    p_2_3.Visible = false;
                    p_2.Visible   = false;
                }
                if (model.category_id == 299)
                {
                    pingshu.Visible = false;
                    p_1.Visible     = false;
                    p_2_3.Visible   = false;
                    p_2.Visible     = true;
                }

                LabTel.Text       = model.dianhua;
                lblConnet.Text    = model.lianxiren;
                lblTitle.Text     = model.title;
                lblSingPrice.Text = model.yongtu;
                lblContent.Text   = model.content;
                Image1Url         = model.img_url;
                lblprice.Text     = model.sell_price.ToString();
                //lblyajin.Text = model.yajin.ToString();
                lblZjprice.Text  = model.sell_price.ToString();
                lblzuoxiang.Text = model.zuoxiang;
                lblpingshu.Text  = model.mianji.ToString();
                BLL.category   bllCata = new BLL.category();
                Model.category Cata    = bllCata.GetModel(model.xianlu);
                if (Cata != null)
                {
                    int    Pid         = Cata.parent_id;
                    string FirstStaton = bllCata.GetModel(Pid).title;
                    lblStation.Text = FirstStaton + "-" + Cata.title;
                }
                lblhuxing.Text   = GetTypleWhereTilte(model.huxing, null);
                Cata             = bllCata.GetModel(model.category_id);
                lblxingneng.Text = model.xingneng;
                lblAge.Text      = model.digg_good.ToString();
                if (!string.IsNullOrEmpty(model.louceng))
                {
                    lbllouceng.Text = model.louceng.ToString();
                }
                if (Cata != null)
                {
                    lblyongtu.Text = Cata.title;
                }

                lblchwei.Text = model.chewei;
                lblPort.Text  = model.chewei;
                lblshequ.Text = model.shequ;
                lbldizhi.Text = model.dizhi;
                string Adress = model.dizhi;
                string Values = model.goods_no;
                big5Address = System.Web.HttpUtility.UrlEncode(Adress, Encoding.GetEncoding("UTF-8"));
                if (!string.IsNullOrEmpty(Values))
                {
                    if (Values.IndexOf('|') > 0)
                    {
                        string[] ArrList = Values.Split('|');
                        X = ArrList[0];
                        Y = ArrList[1];
                    }
                }

                foreach (var item in model.albums)
                {
                    Images += " <li><a  href='" + item.small_img + "'><img src=\"" + item.small_img + "\" alt=\"" + item.remark + "\" width=\"68\" height=\"50\" rel=\"" + item.big_img + "\"/></a></li>";
                }

                #region 宴會廳
                lblDestTable.Text = model.link_url;  //桌數
                lblkictich.Text   = "無";
                if (model.stock_quantity == 1)
                {
                    lblkictich.Text = "有";   //廚房
                }
                lblStag.Text = "無";
                if (model.fangshi == 1)
                {
                    lblStag.Text = "有"; //舞台
                }
                lblMuisu.Text = "無";
                if (model.quyu == 1)
                {
                    lblMuisu.Text = "無";    //音響
                }
                lbllou1.Text = model.louceng;

                #endregion

                #region 戶外廣告
                lblForm.Text   = model.shangpinType;
                lblLou2.Text   = model.louceng;
                lblChiCun.Text = model.fuwuxiangju;

                #endregion

                repdateImgae.DataSource = model.albums;
                repdateImgae.DataBind();
            }
        }
Esempio n. 13
0
 public ShopItem(Model.article_goods shop, int Count)
 {
     this.Count    = Count;
     this.shopCart = shop;
 }
Esempio n. 14
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(SqlConnection conn, SqlTransaction trans, Model.article_goods model, int channel_id, int article_id)
        {
            #region 主表信息==========================
            StringBuilder strSql = new StringBuilder();
            StringBuilder str1   = new StringBuilder(); //数据字段
            StringBuilder str2   = new StringBuilder(); //数据参数
            //利用反射获得属性的所有公共属性
            PropertyInfo[]      pros  = model.GetType().GetProperties();
            List <SqlParameter> paras = new List <SqlParameter>();
            strSql.Append("insert into " + databaseprefix + "article_goods(");
            foreach (PropertyInfo pi in pros)
            {
                //如果不是主键则追加sql字符串
                if (!pi.Name.Equals("id") && !pi.Name.Equals("group_prices"))
                {
                    //判断属性值是否为空
                    if (pi.GetValue(model, null) != null)
                    {
                        str1.Append(pi.Name + ",");       //拼接字段
                        str2.Append("@" + pi.Name + ","); //声明参数
                        switch (pi.Name)
                        {
                        case "channel_id":
                            paras.Add(new SqlParameter("@" + pi.Name, channel_id));
                            break;

                        case "article_id":
                            paras.Add(new SqlParameter("@" + pi.Name, article_id));
                            break;

                        default:
                            paras.Add(new SqlParameter("@" + pi.Name, pi.GetValue(model, null)));    //对参数赋值
                            break;
                        }
                    }
                }
            }
            strSql.Append(str1.ToString().Trim(','));
            strSql.Append(") values (");
            strSql.Append(str2.ToString().Trim(','));
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY;");
            object obj = DbHelperSQL.GetSingle(conn, trans, strSql.ToString(), paras.ToArray());
            model.id = Convert.ToInt32(obj);
            #endregion

            #region 自定义会员组价格==================
            if (model.group_prices != null)
            {
                StringBuilder strSql2; //SQL字符串
                StringBuilder str21;   //数据库字段
                StringBuilder str22;   //声明参数
                foreach (Model.user_group_price modelt in model.group_prices)
                {
                    strSql2 = new StringBuilder();
                    str21   = new StringBuilder();
                    str22   = new StringBuilder();
                    PropertyInfo[]      pros2  = modelt.GetType().GetProperties();
                    List <SqlParameter> paras2 = new List <SqlParameter>();
                    strSql2.Append("insert into " + databaseprefix + "user_group_price(");
                    foreach (PropertyInfo pi in pros2)
                    {
                        if (!pi.Name.Equals("id"))
                        {
                            if (pi.GetValue(modelt, null) != null)
                            {
                                str21.Append(pi.Name + ",");
                                str22.Append("@" + pi.Name + ",");
                                switch (pi.Name)
                                {
                                case "channel_id":
                                    paras2.Add(new SqlParameter("@" + pi.Name, channel_id));
                                    break;

                                case "article_id":
                                    paras2.Add(new SqlParameter("@" + pi.Name, article_id));
                                    break;

                                case "goods_id":
                                    paras2.Add(new SqlParameter("@" + pi.Name, model.id));     //将刚插入的父ID赋值
                                    break;

                                default:
                                    paras2.Add(new SqlParameter("@" + pi.Name, pi.GetValue(modelt, null)));
                                    break;
                                }
                            }
                        }
                    }
                    strSql2.Append(str21.ToString().Trim(','));
                    strSql2.Append(") values (");
                    strSql2.Append(str22.ToString().Trim(','));
                    strSql.Append(")");
                    DbHelperSQL.ExecuteSql(conn, trans, strSql2.ToString(), paras2.ToArray());
                }
            }
            #endregion
        }
Esempio n. 15
0
        protected void btnlogin_Click(object sender, ImageClickEventArgs e)
        {
            IDictionary <string, string> dic = GetCart(DTKeys.COOKIE_SHOPPING_CART) as Dictionary <string, string>;

            cartModel = GetTotal(DTKeys.COOKIE_SHOPPING_CART);
            if (dic == null)
            {
                Response.Redirect("productJPlist.aspx");
            }
            Model.orders model = new Model.orders();
            model.order_no        = hideNo.Value;
            model.user_id         = WEBUserCurrent.UserID;
            model.user_name       = WEBUserCurrent.UserName;
            model.payment_id      = string.IsNullOrEmpty(ddlzhifu.SelectedValue) ? 0 : int.Parse(ddlzhifu.SelectedValue);     //付款類型
            model.distribution_id = string.IsNullOrEmpty(ddlpeisong.SelectedValue) ? 0 : int.Parse(ddlpeisong.SelectedValue); //配送類型
            model.accept_name     = txtusername.Value;
            model.post_code       = txtyoubian.Value;
            model.telphone        = txtlianxidianhua.Value;
            model.mobile          = txtphone.Value;
            model.address         = txtdizhi.Value;
            model.message         = txtliuyan.Value;



            model.payable_freight = decimal.Parse(Fee);             //應付運費
            model.real_freight    = decimal.Parse(Fee);             //實付運費

            model.payment_fee = 0;                                  //付款手續費
            model.point       = Utils.StringToNum(hidePoint.Value); //獲得的積分
            model.add_time    = DateTime.Now;
            model.order_goods = new List <order_goods>();
            decimal Price = 0m; decimal GoodsPrice = 0, GoodToablPrice = 0;

            if (dic != null)
            {
                IList <Model.cart_items> iList = new List <Model.cart_items>();
                foreach (var item in dic)
                {
                    try
                    {
                        Model.article_goods modelPro = bll.GetGoodsModel(Utils.StrToInt(item.Key, 0));
                        Model.cart_items    modelt   = new Model.cart_items();
                        if (model != null)
                        {
                            int ProductID  = modelPro.id;
                            int ShopNumber = Utils.StrToInt(item.Value, 0);
                            Model.article_goods modelpro = bll.GetGoodsModel(ProductID);
                            Price           = modelpro.sell_price;
                            GoodsPrice      = ShopNumber * Price;
                            GoodToablPrice += GoodsPrice;


                            Model.order_goods detail = new Model.order_goods();
                            detail.goods_id    = ProductID;
                            detail.goods_name  = modelPro.title;
                            detail.goods_price = modelPro.sell_price;
                            detail.point       = Utils.StringToNum(hidePoint.Value);
                            detail.quantity    = ShopNumber;
                            detail.real_price  = modelpro.market_price;
                            model.order_goods.Add(detail);
                        }
                    }
                    catch (Exception eee) { }
                }
            }
            #region 算折扣
            string  aa = Request.Form["chkPoint"];
            decimal PousePrice = 0, LastPrice = 0;
            if (!string.IsNullOrEmpty(aa))
            {
                PousePrice = GoodToablPrice - decimal.Parse(hidePoint.Value);
                //model.payable_amount = model.order_amount;
                //model.real_amount = model.order_amount;
            }
            else
            {
                PousePrice = GoodToablPrice;
            }
            #endregion

            #region 算运费
            if (hideFee.Value == "2")
            {
                decimal FeeLv = TwoTypeFee;
                if (PousePrice >= FeeLv)
                {
                    LastPrice             = PousePrice;
                    model.payable_freight = 0; //應付運費
                    model.real_freight    = 0; //實付運費
                }
                else
                {
                    LastPrice = PousePrice + decimal.Parse(Fee);  //訂單總金額
                }
            }
            else
            {
                LastPrice = PousePrice + decimal.Parse(Fee);  //訂單總金額
            }
            #endregion

            model.order_amount   = LastPrice; //訂單總金額
            model.payable_amount = LastPrice; //應付商品總金額
            model.real_amount    = LastPrice; //實付商品總金額


            #region 清空购物车
            Clear(DTKeys.COOKIE_SHOPPING_CART, "0");
            #endregion 清空购物车

            //普通訂單的情況下修改狀態
            if (!string.IsNullOrEmpty(Request.QueryString["cjid"]))
            {
                int                 id           = Convert.ToInt32(Request.QueryString["cjid"]);
                BLL.article         bll          = new BLL.article();
                Model.article_goods productmodel = bll.GetGoodsModel(id);
                bll.UpdateField(id, "Status=3");
                model.status = 6;
            }
            int    bk  = bllorder.Add(model);
            string Url = "pay.aspx?";
            Url += "paymenttype=" + ddlzhifu.SelectedValue + "";
            Url += "&id=" + bk + "";
            // string UserUrl = "userinfo.aspx";
            if (bk > 0)
            {
                //setEmail(model.order_no);
                UpUserPoint(PousePrice);
                int Uid = WEBUserCurrent.UserID;
                User.UpJianPoint(Uid, Utils.StringToNum(hidePoint.Value));
                AddAmount(LastPrice);
                this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('送出訂單成功,請牢記訂單號:" + model.order_no + "');window.location.href = '" + Url + "';</script>");
                // Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "pay", "window.open('" + Url + "');window.location.href='" + UserUrl + "';", true);

                //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "pay", "window.open('" + Url + "');", true);

                //Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "transfer", "window.location.href='" + UserUrl + "';", true);
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('送出失敗,請重新送出');window.location.href = '" + Url + "';</script>");
            }
        }
Esempio n. 16
0
        /// <summary>
        /// 得到一个商品价格列表
        /// </summary>
        public List <Model.article_goods> GetList(int article_id)
        {
            List <Model.article_goods> modelList = new List <Model.article_goods>();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,article_id,goods_no,spec_ids,spec_text,stock_quantity,market_price,sell_price");
            strSql.Append(" FROM " + databaseprefix + "article_goods");
            strSql.Append(" where article_id=" + article_id);
            DataTable dt = DbHelperOleDb.Query(strSql.ToString()).Tables[0];

            if (dt.Rows.Count > 0)
            {
                Model.article_goods model;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    model = new Model.article_goods();
                    #region 主表数据========================
                    if (dt.Rows[i]["id"] != null && dt.Rows[i]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[i]["id"].ToString());
                    }
                    if (dt.Rows[i]["article_id"] != null && dt.Rows[i]["article_id"].ToString() != "")
                    {
                        model.article_id = int.Parse(dt.Rows[i]["article_id"].ToString());
                    }
                    if (dt.Rows[i]["goods_no"] != null)
                    {
                        model.goods_no = dt.Rows[i]["goods_no"].ToString();
                    }
                    if (dt.Rows[i]["spec_ids"] != null)
                    {
                        model.spec_ids = dt.Rows[i]["spec_ids"].ToString();
                    }
                    if (dt.Rows[i]["spec_text"] != null)
                    {
                        model.spec_text = dt.Rows[i]["spec_text"].ToString();
                    }
                    if (dt.Rows[i]["stock_quantity"] != null && dt.Rows[i]["stock_quantity"].ToString() != "")
                    {
                        model.stock_quantity = int.Parse(dt.Rows[i]["stock_quantity"].ToString());
                    }
                    if (dt.Rows[i]["market_price"] != null && dt.Rows[i]["market_price"].ToString() != "")
                    {
                        model.market_price = decimal.Parse(dt.Rows[i]["market_price"].ToString());
                    }
                    if (dt.Rows[i]["sell_price"] != null && dt.Rows[i]["sell_price"].ToString() != "")
                    {
                        model.sell_price = decimal.Parse(dt.Rows[i]["sell_price"].ToString());
                    }
                    #endregion

                    #region 用户组价格数据==================
                    StringBuilder strSql2 = new StringBuilder();
                    strSql2.Append("select id,article_id,goods_id,group_id,price");
                    strSql2.Append(" FROM " + databaseprefix + "user_group_price");
                    strSql2.Append(" where goods_id=" + model.id);
                    DataTable dt2 = DbHelperOleDb.Query(strSql2.ToString()).Tables[0];
                    if (dt2.Rows.Count > 0)
                    {
                        List <Model.user_group_price> ls = new List <Model.user_group_price>();
                        for (int j = 0; j < dt2.Rows.Count; j++)
                        {
                            Model.user_group_price gpModel = new Model.user_group_price();
                            if (dt2.Rows[j]["id"] != null && dt2.Rows[j]["id"].ToString() != "")
                            {
                                gpModel.id = int.Parse(dt2.Rows[j]["id"].ToString());
                            }
                            if (dt2.Rows[j]["article_id"] != null && dt2.Rows[j]["article_id"].ToString() != "")
                            {
                                gpModel.article_id = int.Parse(dt2.Rows[j]["article_id"].ToString());
                            }
                            if (dt2.Rows[j]["goods_id"] != null && dt2.Rows[j]["goods_id"].ToString() != "")
                            {
                                gpModel.goods_id = int.Parse(dt2.Rows[j]["goods_id"].ToString());
                            }
                            if (dt2.Rows[j]["group_id"] != null && dt2.Rows[j]["group_id"].ToString() != "")
                            {
                                gpModel.group_id = int.Parse(dt2.Rows[j]["group_id"].ToString());
                            }
                            if (dt2.Rows[j]["price"] != null && dt2.Rows[j]["price"].ToString() != "")
                            {
                                gpModel.price = decimal.Parse(dt2.Rows[j]["price"].ToString());
                            }
                            ls.Add(gpModel);
                        }
                        model.group_prices = ls;
                    }
                    #endregion

                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 17
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.article_goods model)
 {
     return(dal.Add(model));
 }
Esempio n. 18
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.article_goods model)
        {
            using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString))
            {
                conn.Open();
                using (SqlTransaction trans = conn.BeginTransaction())
                {
                    try
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("update dt_article set ");
                        strSql.Append("channel_id=@channel_id,");
                        strSql.Append("category_id=@category_id,");
                        strSql.Append("title=@title,");
                        strSql.Append("link_url=@link_url,");
                        strSql.Append("img_url=@img_url,");
                        strSql.Append("seo_title=@seo_title,");
                        strSql.Append("seo_keywords=@seo_keywords,");
                        strSql.Append("seo_description=@seo_description,");
                        strSql.Append("content=@content,");
                        strSql.Append("sort_id=@sort_id,");
                        strSql.Append("click=@click,");
                        strSql.Append("is_lock=@is_lock,");
                        strSql.Append("user_id=@user_id,");
                        strSql.Append("add_time=@add_time");
                        strSql.Append(" where id=@id");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@channel_id",      SqlDbType.Int,         4),
                            new SqlParameter("@category_id",     SqlDbType.Int,         4),
                            new SqlParameter("@title",           SqlDbType.NVarChar,  100),
                            new SqlParameter("@link_url",        SqlDbType.NVarChar,  255),
                            new SqlParameter("@img_url",         SqlDbType.NVarChar,  255),
                            new SqlParameter("@seo_title",       SqlDbType.NVarChar,  255),
                            new SqlParameter("@seo_keywords",    SqlDbType.NVarChar,  255),
                            new SqlParameter("@seo_description", SqlDbType.NVarChar,  255),
                            new SqlParameter("@content",         SqlDbType.NText),
                            new SqlParameter("@sort_id",         SqlDbType.Int,         4),
                            new SqlParameter("@click",           SqlDbType.Int,         4),
                            new SqlParameter("@is_lock",         SqlDbType.TinyInt,     1),
                            new SqlParameter("@user_id",         SqlDbType.Int,         4),
                            new SqlParameter("@add_time",        SqlDbType.DateTime),
                            new SqlParameter("@id",              SqlDbType.Int, 4)
                        };
                        parameters[0].Value  = model.channel_id;
                        parameters[1].Value  = model.category_id;
                        parameters[2].Value  = model.title;
                        parameters[3].Value  = model.link_url;
                        parameters[4].Value  = model.img_url;
                        parameters[5].Value  = model.seo_title;
                        parameters[6].Value  = model.seo_keywords;
                        parameters[7].Value  = model.seo_description;
                        parameters[8].Value  = model.content;
                        parameters[9].Value  = model.sort_id;
                        parameters[10].Value = model.click;
                        parameters[11].Value = model.is_lock;
                        parameters[12].Value = model.user_id;
                        parameters[13].Value = model.add_time;
                        parameters[14].Value = model.id;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters);

                        //修改副表
                        StringBuilder strSql2 = new StringBuilder();
                        strSql2.Append("update dt_article_goods set ");
                        strSql2.Append("id=@id,");
                        strSql2.Append("goods_no=@goods_no,");
                        strSql2.Append("stock_quantity=@stock_quantity,");
                        strSql2.Append("market_price=@market_price,");
                        strSql2.Append("sell_price=@sell_price,");
                        strSql2.Append("point=@point,");
                        strSql2.Append("is_msg=@is_msg,");
                        strSql2.Append("is_top=@is_top,");
                        strSql2.Append("is_red=@is_red,");
                        strSql2.Append("is_hot=@is_hot,");
                        strSql2.Append("is_slide=@is_slide");
                        strSql2.Append(" where id=@id ");
                        SqlParameter[] parameters2 =
                        {
                            new SqlParameter("@id",             SqlDbType.Int,        4),
                            new SqlParameter("@goods_no",       SqlDbType.NVarChar, 100),
                            new SqlParameter("@stock_quantity", SqlDbType.Int,        4),
                            new SqlParameter("@market_price",   SqlDbType.Decimal,    5),
                            new SqlParameter("@sell_price",     SqlDbType.Decimal,    5),
                            new SqlParameter("@point",          SqlDbType.Int,        4),
                            new SqlParameter("@is_msg",         SqlDbType.TinyInt,    1),
                            new SqlParameter("@is_top",         SqlDbType.TinyInt,    1),
                            new SqlParameter("@is_red",         SqlDbType.TinyInt,    1),
                            new SqlParameter("@is_hot",         SqlDbType.TinyInt,    1),
                            new SqlParameter("@is_slide",       SqlDbType.TinyInt, 1)
                        };
                        parameters2[0].Value  = model.id;
                        parameters2[1].Value  = model.goods_no;
                        parameters2[2].Value  = model.stock_quantity;
                        parameters2[3].Value  = model.market_price;
                        parameters2[4].Value  = model.sell_price;
                        parameters2[5].Value  = model.point;
                        parameters2[6].Value  = model.is_msg;
                        parameters2[7].Value  = model.is_top;
                        parameters2[8].Value  = model.is_red;
                        parameters2[9].Value  = model.is_hot;
                        parameters2[10].Value = model.is_slide;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql2.ToString(), parameters2);

                        //修改顶和踩
                        StringBuilder strSql3 = new StringBuilder();
                        strSql3.Append("update dt_article_diggs set ");
                        strSql3.Append("digg_good=@digg_good,");
                        strSql3.Append("digg_bad=@digg_bad");
                        strSql3.Append(" where id=@id ");
                        SqlParameter[] parameters3 =
                        {
                            new SqlParameter("@digg_good", SqlDbType.Int, 4),
                            new SqlParameter("@digg_bad",  SqlDbType.Int, 4),
                            new SqlParameter("@id",        SqlDbType.Int, 4)
                        };
                        parameters3[0].Value = model.digg_good;
                        parameters3[1].Value = model.digg_bad;
                        parameters3[2].Value = model.id;
                        DbHelperSQL.ExecuteSql(conn, trans, strSql3.ToString(), parameters3);

                        //删除已删除的图片
                        new article_albums().DeleteList(conn, trans, model.albums, model.id);
                        //添加/修改相册
                        if (model.albums != null)
                        {
                            StringBuilder strSql4;
                            foreach (Model.article_albums models in model.albums)
                            {
                                strSql4 = new StringBuilder();
                                if (models.id > 0)
                                {
                                    strSql4.Append("update dt_article_albums set ");
                                    strSql4.Append("article_id=@article_id,");
                                    strSql4.Append("big_img=@big_img,");
                                    strSql4.Append("small_img=@small_img,");
                                    strSql4.Append("remark=@remark");
                                    strSql4.Append(" where id=@id");
                                    SqlParameter[] parameters4 =
                                    {
                                        new SqlParameter("@article_id", SqlDbType.Int,        4),
                                        new SqlParameter("@big_img",    SqlDbType.NVarChar, 255),
                                        new SqlParameter("@small_img",  SqlDbType.NVarChar, 255),
                                        new SqlParameter("@remark",     SqlDbType.NVarChar, 500),
                                        new SqlParameter("@id",         SqlDbType.Int, 4)
                                    };
                                    parameters4[0].Value = models.article_id;
                                    parameters4[1].Value = models.big_img;
                                    parameters4[2].Value = models.small_img;
                                    parameters4[3].Value = models.remark;
                                    parameters4[4].Value = models.id;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql4.ToString(), parameters4);
                                }
                                else
                                {
                                    strSql4.Append("insert into dt_article_albums(");
                                    strSql4.Append("article_id,big_img,small_img,remark)");
                                    strSql4.Append(" values (");
                                    strSql4.Append("@article_id,@big_img,@small_img,@remark)");
                                    SqlParameter[] parameters4 =
                                    {
                                        new SqlParameter("@article_id", SqlDbType.Int,        4),
                                        new SqlParameter("@big_img",    SqlDbType.NVarChar, 255),
                                        new SqlParameter("@small_img",  SqlDbType.NVarChar, 255),
                                        new SqlParameter("@remark",     SqlDbType.NVarChar, 500)
                                    };
                                    parameters4[0].Value = models.article_id;
                                    parameters4[1].Value = models.big_img;
                                    parameters4[2].Value = models.small_img;
                                    parameters4[3].Value = models.remark;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql4.ToString(), parameters4);
                                }
                            }
                        }

                        //添加/修改属性
                        if (model.attribute_values != null)
                        {
                            StringBuilder strSql5;
                            foreach (Model.attribute_value models in model.attribute_values)
                            {
                                strSql5 = new StringBuilder();
                                if (models.id > 0)
                                {
                                    strSql5.Append("update dt_attribute_value set ");
                                    strSql5.Append("article_id=@article_id,");
                                    strSql5.Append("attribute_id=@attribute_id,");
                                    strSql5.Append("title=@title,");
                                    strSql5.Append("content=@content");
                                    strSql5.Append(" where id=@id");
                                    SqlParameter[] parameters5 =
                                    {
                                        new SqlParameter("@article_id",   SqlDbType.Int,        4),
                                        new SqlParameter("@attribute_id", SqlDbType.Int,        4),
                                        new SqlParameter("@title",        SqlDbType.NVarChar, 100),
                                        new SqlParameter("@content",      SqlDbType.NText),
                                        new SqlParameter("@id",           SqlDbType.Int, 4)
                                    };
                                    parameters5[0].Value = models.article_id;
                                    parameters5[1].Value = models.attribute_id;
                                    parameters5[2].Value = models.title;
                                    parameters5[3].Value = models.content;
                                    parameters5[4].Value = models.id;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql5.ToString(), parameters5);
                                }
                                else
                                {
                                    strSql5.Append("insert into dt_attribute_value(");
                                    strSql5.Append("article_id,attribute_id,title,content)");
                                    strSql5.Append(" values (");
                                    strSql5.Append("@article_id,@attribute_id,@title,@content)");
                                    SqlParameter[] parameters5 =
                                    {
                                        new SqlParameter("@article_id",   SqlDbType.Int,        4),
                                        new SqlParameter("@attribute_id", SqlDbType.Int,        4),
                                        new SqlParameter("@title",        SqlDbType.NVarChar, 100),
                                        new SqlParameter("@content",      SqlDbType.NText)
                                    };
                                    parameters5[0].Value = models.article_id;
                                    parameters5[1].Value = models.attribute_id;
                                    parameters5[2].Value = models.title;
                                    parameters5[3].Value = models.content;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql5.ToString(), parameters5);
                                }
                            }
                        }

                        //添加/修改用户组价格
                        if (model.goods_group_prices != null)
                        {
                            StringBuilder strSql6;
                            foreach (Model.goods_group_price models in model.goods_group_prices)
                            {
                                strSql6 = new StringBuilder();
                                if (models.id > 0)
                                {
                                    strSql6.Append("update dt_goods_group_price set ");
                                    strSql6.Append("article_id=@article_id,");
                                    strSql6.Append("group_id=@group_id,");
                                    strSql6.Append("price=@price");
                                    strSql6.Append(" where id=@id");
                                    SqlParameter[] parameters6 =
                                    {
                                        new SqlParameter("@article_id", SqlDbType.Int,     4),
                                        new SqlParameter("@group_id",   SqlDbType.Int,     4),
                                        new SqlParameter("@price",      SqlDbType.Decimal, 5),
                                        new SqlParameter("@id",         SqlDbType.Int, 4)
                                    };
                                    parameters6[0].Value = models.article_id;
                                    parameters6[1].Value = models.group_id;
                                    parameters6[2].Value = models.price;
                                    parameters6[3].Value = models.id;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql6.ToString(), parameters6);
                                }
                                else
                                {
                                    strSql6.Append("insert into dt_goods_group_price(");
                                    strSql6.Append("article_id,group_id,price)");
                                    strSql6.Append(" values (");
                                    strSql6.Append("@article_id,@group_id,@price)");
                                    SqlParameter[] parameters6 =
                                    {
                                        new SqlParameter("@article_id", SqlDbType.Int,     4),
                                        new SqlParameter("@group_id",   SqlDbType.Int,     4),
                                        new SqlParameter("@price",      SqlDbType.Decimal, 5)
                                    };
                                    parameters6[0].Value = models.article_id;
                                    parameters6[1].Value = models.group_id;
                                    parameters6[2].Value = models.price;
                                    DbHelperSQL.ExecuteSql(conn, trans, strSql6.ToString(), parameters6);
                                }
                            }
                        }

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 19
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.article_goods model)
 {
     return(dal.Update(model));
 }
Esempio n. 20
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.article_goods GetGoodsModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 id,channel_id,category_id,title,link_url,img_url,seo_title,seo_keywords,seo_description,content,sort_id,click,is_lock,user_id,add_time,goods_no,stock_quantity,market_price,sell_price,point,is_msg,is_top,is_red,is_hot,is_slide,digg_good,digg_bad from view_article_goods ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                #region  父表信息
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["channel_id"] != null && ds.Tables[0].Rows[0]["channel_id"].ToString() != "")
                {
                    model.channel_id = int.Parse(ds.Tables[0].Rows[0]["channel_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["category_id"] != null && ds.Tables[0].Rows[0]["category_id"].ToString() != "")
                {
                    model.category_id = int.Parse(ds.Tables[0].Rows[0]["category_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["link_url"] != null && ds.Tables[0].Rows[0]["link_url"].ToString() != "")
                {
                    model.link_url = ds.Tables[0].Rows[0]["link_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["img_url"] != null && ds.Tables[0].Rows[0]["img_url"].ToString() != "")
                {
                    model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["seo_title"] != null && ds.Tables[0].Rows[0]["seo_title"].ToString() != "")
                {
                    model.seo_title = ds.Tables[0].Rows[0]["seo_title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["seo_keywords"] != null && ds.Tables[0].Rows[0]["seo_keywords"].ToString() != "")
                {
                    model.seo_keywords = ds.Tables[0].Rows[0]["seo_keywords"].ToString();
                }
                if (ds.Tables[0].Rows[0]["seo_description"] != null && ds.Tables[0].Rows[0]["seo_description"].ToString() != "")
                {
                    model.seo_description = ds.Tables[0].Rows[0]["seo_description"].ToString();
                }
                if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "")
                {
                    model.content = ds.Tables[0].Rows[0]["content"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["click"] != null && ds.Tables[0].Rows[0]["click"].ToString() != "")
                {
                    model.click = int.Parse(ds.Tables[0].Rows[0]["click"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["user_id"] != null && ds.Tables[0].Rows[0]["user_id"].ToString() != "")
                {
                    model.user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["goods_no"] != null && ds.Tables[0].Rows[0]["goods_no"].ToString() != "")
                {
                    model.goods_no = ds.Tables[0].Rows[0]["goods_no"].ToString();
                }
                if (ds.Tables[0].Rows[0]["stock_quantity"] != null && ds.Tables[0].Rows[0]["stock_quantity"].ToString() != "")
                {
                    model.stock_quantity = int.Parse(ds.Tables[0].Rows[0]["stock_quantity"].ToString());
                }
                if (ds.Tables[0].Rows[0]["market_price"] != null && ds.Tables[0].Rows[0]["market_price"].ToString() != "")
                {
                    model.market_price = decimal.Parse(ds.Tables[0].Rows[0]["market_price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sell_price"] != null && ds.Tables[0].Rows[0]["sell_price"].ToString() != "")
                {
                    model.sell_price = decimal.Parse(ds.Tables[0].Rows[0]["sell_price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "")
                {
                    model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_msg"] != null && ds.Tables[0].Rows[0]["is_msg"].ToString() != "")
                {
                    model.is_msg = int.Parse(ds.Tables[0].Rows[0]["is_msg"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_top"] != null && ds.Tables[0].Rows[0]["is_top"].ToString() != "")
                {
                    model.is_top = int.Parse(ds.Tables[0].Rows[0]["is_top"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_red"] != null && ds.Tables[0].Rows[0]["is_red"].ToString() != "")
                {
                    model.is_red = int.Parse(ds.Tables[0].Rows[0]["is_red"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_hot"] != null && ds.Tables[0].Rows[0]["is_hot"].ToString() != "")
                {
                    model.is_hot = int.Parse(ds.Tables[0].Rows[0]["is_hot"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_slide"] != null && ds.Tables[0].Rows[0]["is_slide"].ToString() != "")
                {
                    model.is_slide = int.Parse(ds.Tables[0].Rows[0]["is_slide"].ToString());
                }
                if (ds.Tables[0].Rows[0]["digg_good"] != null && ds.Tables[0].Rows[0]["digg_good"].ToString() != "")
                {
                    model.digg_good = int.Parse(ds.Tables[0].Rows[0]["digg_good"].ToString());
                }
                if (ds.Tables[0].Rows[0]["digg_bad"] != null && ds.Tables[0].Rows[0]["digg_bad"].ToString() != "")
                {
                    model.digg_bad = int.Parse(ds.Tables[0].Rows[0]["digg_bad"].ToString());
                }
                #endregion  父表信息end

                model.goods_group_prices = GetGoodsGroupPriceList(id);        //获得用户组商品价格
                model.albums             = new article_albums().GetList(id);  //相册信息
                model.attribute_values   = new attribute_value().GetList(id); //扩展属性
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 21
0
        private bool DoAdd()
        {
            bool result = true;

            Model.article_goods model = new Model.article_goods();
            BLL.article         bll   = new BLL.article();

            model.channel_id  = this.channel_id;
            model.title       = txtTitle.Text.Trim();
            model.category_id = Utils.StringToNum(ddlCategoryId.SelectedValue);
            //model.goods_no = txtGoodsNo.Text;
            //model.stock_quantity = Utils.StringToNum(txtStockQuantity.Text);
            //model.market_price = decimal.Parse(txtMarketPrice.Text);
            //model.sell_price = decimal.Parse(txtSellPrice.Text);
            // model.point = Utils.StringToNum(txtPoint.Text);
            model.link_url = txtLinkUrl.Text.Trim();
            model.img_url  = focus_photo.Value;
            //model.content = txtContent.Value;
            //model.seo_title = txtSeoTitle.Text.Trim();
            //model.seo_keywords = txtSeoKeywords.Text.Trim();
            //model.seo_description = txtSeoDescription.Text.Trim();
            //model.sort_id = Utils.StringToNum(txtSortId.Text.Trim());
            //model.click = Utils.StringToNum(txtClick.Text.Trim());
            //model.digg_good = Utils.StringToNum(txtDiggGood.Text.Trim());
            //model.digg_bad = Utils.StringToNum(txtDiggBad.Text.Trim());
            model.add_time = DateTime.Parse(txtTime.Text.ToString());
            model.is_msg   = 0;
            model.is_top   = 0;
            model.is_red   = 0;
            model.is_hot   = 0;
            model.is_slide = 0;
            model.is_lock  = 0;
            //model.lianxiren = txtuser.Text;
            // model.shangpinType = txtshangpintype.Text;
            //if (cblItem.Items[0].Selected == true)
            //{
            //    model.is_msg = 1;
            //}
            //if (cblItem.Items[1].Selected == true)
            //{
            //    model.is_top = 1;
            //}
            //if (cblItem.Items[2].Selected == true)
            //{
            //    model.is_red = 1;
            //}
            //if (cblItem.Items[3].Selected == true)
            //{
            //    model.is_hot = 1;
            //}
            //if (cblItem.Items[4].Selected == true)
            //{
            //    model.is_slide = 1;
            //}
            //if (cblItem.Items[5].Selected == true)
            //{
            //    model.is_lock = 1;
            //}
            //會員組價格
            List <Model.goods_group_price> priceList = new List <Model.goods_group_price>();

            //for (int i = 0; i < rptPrice.Items.Count; i++)
            //{
            //    int _groupid = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value);
            //    decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim());
            //    priceList.Add(new Model.goods_group_price { group_id = _groupid, price = _price });
            //}
            model.goods_group_prices = priceList;
            //儲存相冊
            string[] albumArr  = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null && albumArr.Length > 0)
            {
                List <Model.article_albums> ls = new List <Model.article_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.article_albums {
                                big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.article_albums {
                                big_img = imgArr[1], small_img = imgArr[2]
                            });
                        }
                    }
                }
                model.albums = ls;
            }

            //擴展屬性
            BLL.attributes bll2 = new BLL.attributes();
            DataSet        ds2  = bll2.GetList("channel_id=" + this.channel_id);

            List <Model.attribute_value> attrls = new List <Model.attribute_value>();

            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                int    attr_id    = Utils.StringToNum(dr["id"].ToString());
                string attr_title = dr["title"].ToString();
                string attr_value = Request.Form["content_" + attr_id];
                if (!string.IsNullOrEmpty(attr_value))
                {
                    attrls.Add(new Model.attribute_value {
                        attribute_id = attr_id, title = attr_title, content = attr_value
                    });
                }
            }
            model.attribute_values = attrls;

            // model.Postid = CheckBoxList1.SelectedValue;
            // model.Type = Utils.StringToNum(cblItem.SelectedValue);
            model.AddType = 0;
            model.Status  = 1;

            //if (!string.IsNullOrEmpty(ddlquyu.SelectedValue))
            //{
            //    model.quyu = Convert.ToInt32(ddlquyu.SelectedValue);
            //}
            //if (!string.IsNullOrEmpty(ddljiaqian.SelectedValue))
            //{
            //    model.jiaqianQJ = Convert.ToInt32(ddljiaqian.SelectedValue);
            //}
            //if (!string.IsNullOrEmpty(ddlmianji.SelectedValue))
            //{
            //    model.mianji = Convert.ToInt32(ddlmianji.SelectedValue);
            //}
            //if (!string.IsNullOrEmpty(ddlhuxing.SelectedValue))
            //{
            //    model.huxing = Convert.ToInt32(ddlhuxing.SelectedValue);
            //}
            //if (!string.IsNullOrEmpty(ddlfangshi.SelectedValue))
            //{
            //    model.fangshi = Convert.ToInt32(ddlfangshi.SelectedValue);
            //}
            //if (!string.IsNullOrEmpty(ddlditie.SelectedValue))
            //{
            //    model.xianlu = Convert.ToInt32(ddlditie.SelectedValue);
            //}

            // model.yajin = string.IsNullOrEmpty(txtyajin.Text) ? 0 : Convert.ToInt32(txtyajin.Text);
            // model.zuoxiang = txtzuoxiang.Text;
            // model.louceng = txtlouceng.Text;
            //model.xingneng = txtxingneng.Text;
            // model.yongtu = txtyongtu.Text;
            // model.chewei = txtchewei.Text;
            // model.shequ = txtshequ.Text;
            model.dizhi = txtdizhi.Text;
            //model.gongsi = txtgongsi.Text;
            model.fuwuxiangju = txtfuwxiangmu.Text;
            model.dianhua     = txtdianhua.Text;
            //model.Areaid = Convert.ToInt32(ddlAreaid.SelectedValue);
            //if (!bll.Update(model))
            //{
            //    result = false;
            //}


            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return(result);
        }
Esempio n. 22
0
        private void ShowInfo(int _id)
        {
            BLL.article         bll   = new BLL.article();
            Model.article_goods model = bll.GetGoodsModel(_id);

            #region 宴會廳參數
            CataID = model.category_id;

            txtZhuoShu.Text    = model.link_url;    //桌數
            txtSize.Text       = model.fuwuxiangju; //尺寸
            chkKitchen.Checked = false;
            if (model.stock_quantity == 1)
            {
                chkKitchen.Checked = true;    //廚房
            }
            chkStage.Checked = false;
            if (model.fangshi == 1)
            {
                chkStage.Checked = true; //舞台
            }
            chkSound.Checked = false;
            if (model.quyu == 1)
            {
                chkSound.Checked = true;    //音響
            }
            chkScreen.Checked = false;
            if (model.jiaqianQJ == 1)
            {
                chkScreen.Checked = true;    //投螢幕
            }
            if (!string.IsNullOrEmpty(model.shangpinType))
            {
                ddlForm.Text = model.shangpinType.ToString(); //形式
            }

            #endregion


            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtTitle.Text = model.title;
            txtY.Text     = model.goods_no;
            //txtStockQuantity.Text = model.stock_quantity.ToString();
            txtMarketPrice.Text = model.sell_price.ToString();
            //txtSellPrice.Text = model.sell_price.ToString();
            txtPoint.Text = model.point.ToString();
            //txtLinkUrl.Text = model.link_url;
            txtTime.Text = model.add_time.ToString();
            txtuser.Text = model.lianxiren;
            // txtshangpintype.Text = model.shangpinType;
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }
            if (model.is_lock == 1)
            {
                cblItem.Items[5].Selected = true;
            }
            //txtSortId.Text = model.sort_id.ToString();
            //txtClick.Text = model.click.ToString();
            txtDiggGood.Text = model.digg_good.ToString();
            //txtDiggBad.Text = model.digg_bad.ToString();
            txtContent.Value       = model.content;
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            //賦值用戶組價格
            if (model.goods_group_prices != null)
            {
                for (int i = 0; i < this.rptPrice.Items.Count; i++)
                {
                    int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value);
                    foreach (Model.goods_group_price modelt in model.goods_group_prices)
                    {
                        if (hideId == modelt.group_id)
                        {
                            ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString();
                            ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text    = modelt.price.ToString();
                        }
                    }
                }
            }
            //賦值上傳的相冊
            img_Url           = model.img_url; //封面圖片
            LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url);
            //賦值屬性清單
            LitAttributeList.Text       = GetAttributeHtml(model.attribute_values, this.channel_id, _id);
            cblItem.SelectedValue       = model.Type.ToString();
            CheckBoxList1.SelectedValue = model.Postid;

            //ddlquyu.SelectedValue = model.quyu.ToString();
            //ddljiaqian.SelectedValue = model.jiaqianQJ.ToString();
            txtMianJi.Text          = model.mianji.ToString();
            ddlhuxing.SelectedValue = model.huxing.ToString();
            //ddlfangshi.SelectedValue = model.fangshi.ToString();
            ddlditie.SelectedValue = model.xianlu.ToString();

            txtyajin.Text       = model.yajin.ToString();
            txtzuoxiang.Text    = model.zuoxiang;
            txtlouceng.Text     = model.louceng;
            txtxingneng.Text    = model.xingneng;
            txtSinglePrice.Text = model.yongtu;
            chkPort.Checked     = model.chewei == "有" ? true : false;
            txtshequ.Text       = model.shequ;
            txtdizhi.Text       = model.dizhi;

            txtgongsi.Text = model.gongsi;
            //txtfuwxiangmu.Text = model.fuwuxiangju;
            txtdianhua.Text         = model.dianhua;
            ddlAreaid.SelectedValue = model.Areaid.ToString();
            xiajiacheck.Checked     = model.Status == 1 ? false : true;
            xiajiatext.Value        = model.xiajialiyou;
        }
Esempio n. 23
0
        private void ShowInfo(int _id)
        {
            BLL.article         bll   = new BLL.article();
            Model.article_goods model = bll.GetGoodsModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtTitle.Text = model.title;
            // txtGoodsNo.Text = model.goods_no;
            // txtStockQuantity.Text = model.stock_quantity.ToString();
            //txtMarketPrice.Text = model.market_price.ToString();
            //txtSellPrice.Text = model.sell_price.ToString();
            //txtPoint.Text = model.point.ToString();
            txtLinkUrl.Text = model.link_url;
            txtTime.Text    = model.add_time.ToString();
            //txtuser.Text = model.lianxiren;
            // txtshangpintype.Text = model.shangpinType;
            //if (model.is_msg == 1)
            //{
            //    cblItem.Items[0].Selected = true;
            //}
            //if (model.is_top == 1)
            //{
            //    cblItem.Items[1].Selected = true;
            //}
            //if (model.is_red == 1)
            //{
            //    cblItem.Items[2].Selected = true;
            //}
            //if (model.is_hot == 1)
            //{
            //    cblItem.Items[3].Selected = true;
            //}
            //if (model.is_slide == 1)
            //{
            //    cblItem.Items[4].Selected = true;
            //}
            //if (model.is_lock == 1)
            //{
            //    cblItem.Items[5].Selected = true;
            //}
            //txtSortId.Text = model.sort_id.ToString();
            //txtClick.Text = model.click.ToString();
            //txtDiggGood.Text = model.digg_good.ToString();
            //txtDiggBad.Text = model.digg_bad.ToString();
            //txtContent.Value = model.content;
            //txtSeoTitle.Text = model.seo_title;
            //txtSeoKeywords.Text = model.seo_keywords;
            //txtSeoDescription.Text = model.seo_description;
            //賦值用戶組價格
            //if (model.goods_group_prices != null)
            //{
            //    for (int i = 0; i < this.rptPrice.Items.Count; i++)
            //    {
            //        int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value);
            //        foreach (Model.goods_group_price modelt in model.goods_group_prices)
            //        {
            //            if (hideId == modelt.group_id)
            //            {
            //                ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString();
            //                ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text = modelt.price.ToString();
            //            }
            //        }
            //    }
            //}
            //賦值上傳的相冊
            focus_photo.Value = model.img_url; //封面圖片
            LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url);
            //賦值屬性清單
            LitAttributeList.Text = GetAttributeHtml(model.attribute_values, this.channel_id, _id);
            //cblItem.SelectedValue = model.Type.ToString();
            //CheckBoxList1.SelectedValue = model.Postid;

            //ddlquyu.SelectedValue = model.quyu.ToString();
            //ddljiaqian.SelectedValue = model.jiaqianQJ.ToString();
            //ddlmianji.SelectedValue = model.mianji.ToString();
            //ddlhuxing.SelectedValue = model.huxing.ToString();
            //ddlfangshi.SelectedValue = model.fangshi.ToString();
            //ddlditie.SelectedValue = model.xianlu.ToString();

            //txtyajin.Text = model.yajin.ToString();
            //txtzuoxiang.Text = model.zuoxiang;
            //txtlouceng.Text = model.louceng;
            //txtxingneng.Text = model.xingneng;
            //txtyongtu.Text = model.yongtu;
            //txtchewei.Text = model.chewei;
            //txtshequ.Text = model.shequ;
            txtdizhi.Text = model.dizhi;

            //txtgongsi.Text = model.gongsi;
            txtfuwxiangmu.Text = model.fuwuxiangju;
            txtdianhua.Text    = model.dianhua;
            //ddlAreaid.SelectedValue = model.Areaid.ToString();
            //xiajiacheck.Checked = model.Status == 2 ? true : false;
            //xiajiatext.Value = model.xiajialiyou;
        }
Esempio n. 24
0
        private bool DoAdd()
        {
            bool result = true;
            Model.article_goods model = new Model.article_goods();
            BLL.article bll = new BLL.article();

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.goods_no = txtGoodsNo.Text;
            model.stock_quantity = int.Parse(txtStockQuantity.Text);
            model.market_price = decimal.Parse(txtMarketPrice.Text);
            model.sell_price = decimal.Parse(txtSellPrice.Text);
            model.point = int.Parse(txtPoint.Text);
            model.link_url = txtLinkUrl.Text.Trim();
            model.img_url = focus_photo.Value;
            model.content = txtContent.Value;
            model.seo_title = txtSeoTitle.Text.Trim();
            model.seo_keywords = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.click = int.Parse(txtClick.Text.Trim());
            model.digg_good = int.Parse(txtDiggGood.Text.Trim());
            model.digg_bad = int.Parse(txtDiggBad.Text.Trim());
            model.is_msg = 0;
            model.is_top = 0;
            model.is_red = 0;
            model.is_hot = 0;
            model.is_slide = 0;
            model.is_lock = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[3].Selected == true)
            {
                model.is_hot = 1;
            }
            if (cblItem.Items[4].Selected == true)
            {
                model.is_slide = 1;
            }
            if (cblItem.Items[5].Selected == true)
            {
                model.is_lock = 1;
            }
            //会员组价格
            List<Model.goods_group_price> priceList = new List<Model.goods_group_price>();
            for (int i = 0; i < rptPrice.Items.Count; i++)
            {
                int _groupid = Convert.ToInt32(((HiddenField)rptPrice.Items[i].FindControl("hideGroupId")).Value);
                decimal _price = Convert.ToDecimal(((TextBox)rptPrice.Items[i].FindControl("txtGroupPrice")).Text.Trim());
                priceList.Add(new Model.goods_group_price { group_id = _groupid, price = _price });
            }
            model.goods_group_prices = priceList;
            //保存相册
            string[] albumArr = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null && albumArr.Length > 0)
            {
                List<Model.article_albums> ls = new List<Model.article_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.article_albums { big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] });
                        }
                        else
                        {
                            ls.Add(new Model.article_albums { big_img = imgArr[1], small_img = imgArr[2] });
                        }
                    }
                }
                model.albums = ls;
            }

            //扩展属性
            BLL.attributes bll2 = new BLL.attributes();
            DataSet ds2 = bll2.GetList("channel_id=" + this.channel_id);

            List<Model.attribute_value> attrls = new List<Model.attribute_value>();
            foreach (DataRow dr in ds2.Tables[0].Rows)
            {
                int attr_id = int.Parse(dr["id"].ToString());
                string attr_title = dr["title"].ToString();
                string attr_value = Request.Form["content_" + attr_id];
                if (!string.IsNullOrEmpty(attr_value))
                {
                    attrls.Add(new Model.attribute_value { attribute_id = attr_id, title = attr_title, content = attr_value });
                }
            }
            model.attribute_values = attrls;

            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return result;
        }
Esempio n. 25
0
        //設置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ChkAdminLevel(channel_id, DTEnums.ActionEnum.Edit.ToString()); //檢查許可權
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.article         bll   = new BLL.article();
            Model.article_goods model = bll.GetGoodsModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnmsg":
                if (model.is_msg == 1)
                {
                    bll.UpdateGoodsField(id, "is_msg=0");
                }
                else
                {
                    bll.UpdateGoodsField(id, "is_msg=1");
                }
                break;

            case "ibtntop":
                if (model.is_top == 1)
                {
                    bll.UpdateGoodsField(id, "is_top=0");
                }
                else
                {
                    bll.UpdateGoodsField(id, "is_top=1");
                }
                break;

            case "ibtnred":
                if (model.is_red == 1)
                {
                    bll.UpdateGoodsField(id, "is_red=0");
                }
                else
                {
                    bll.UpdateGoodsField(id, "is_red=1");
                }
                break;

            case "ibtnhot":
                if (model.is_hot == 1)
                {
                    bll.UpdateGoodsField(id, "is_hot=0");
                }
                else
                {
                    bll.UpdateGoodsField(id, "is_hot=1");
                }
                break;

            case "ibtnslide":
                if (model.is_slide == 1)
                {
                    bll.UpdateGoodsField(id, "is_slide=0");
                }
                else
                {
                    bll.UpdateGoodsField(id, "is_slide=1");
                }
                break;

            case "sk":
                bll.UpdateField(id, "Status=1");
                break;
            }
            this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc");
        }
Esempio n. 26
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Model.article_goods GetGoodsModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1 id,channel_id,category_id,title,link_url,img_url,seo_title,seo_keywords,seo_description,content,sort_id,click,is_lock,user_id,add_time,goods_no,stock_quantity,market_price,sell_price,point,is_msg,is_top,is_red,is_hot,is_slide,digg_good,digg_bad from view_article_goods ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = id;

            Model.article_goods model = new Model.article_goods();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                #region  ������Ϣ
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["channel_id"] != null && ds.Tables[0].Rows[0]["channel_id"].ToString() != "")
                {
                    model.channel_id = int.Parse(ds.Tables[0].Rows[0]["channel_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["category_id"] != null && ds.Tables[0].Rows[0]["category_id"].ToString() != "")
                {
                    model.category_id = int.Parse(ds.Tables[0].Rows[0]["category_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["link_url"] != null && ds.Tables[0].Rows[0]["link_url"].ToString() != "")
                {
                    model.link_url = ds.Tables[0].Rows[0]["link_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["img_url"] != null && ds.Tables[0].Rows[0]["img_url"].ToString() != "")
                {
                    model.img_url = ds.Tables[0].Rows[0]["img_url"].ToString();
                }
                if (ds.Tables[0].Rows[0]["seo_title"] != null && ds.Tables[0].Rows[0]["seo_title"].ToString() != "")
                {
                    model.seo_title = ds.Tables[0].Rows[0]["seo_title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["seo_keywords"] != null && ds.Tables[0].Rows[0]["seo_keywords"].ToString() != "")
                {
                    model.seo_keywords = ds.Tables[0].Rows[0]["seo_keywords"].ToString();
                }
                if (ds.Tables[0].Rows[0]["seo_description"] != null && ds.Tables[0].Rows[0]["seo_description"].ToString() != "")
                {
                    model.seo_description = ds.Tables[0].Rows[0]["seo_description"].ToString();
                }
                if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "")
                {
                    model.content = ds.Tables[0].Rows[0]["content"].ToString();
                }
                if (ds.Tables[0].Rows[0]["sort_id"] != null && ds.Tables[0].Rows[0]["sort_id"].ToString() != "")
                {
                    model.sort_id = int.Parse(ds.Tables[0].Rows[0]["sort_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["click"] != null && ds.Tables[0].Rows[0]["click"].ToString() != "")
                {
                    model.click = int.Parse(ds.Tables[0].Rows[0]["click"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_lock"] != null && ds.Tables[0].Rows[0]["is_lock"].ToString() != "")
                {
                    model.is_lock = int.Parse(ds.Tables[0].Rows[0]["is_lock"].ToString());
                }
                if (ds.Tables[0].Rows[0]["user_id"] != null && ds.Tables[0].Rows[0]["user_id"].ToString() != "")
                {
                    model.user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                if (ds.Tables[0].Rows[0]["goods_no"] != null && ds.Tables[0].Rows[0]["goods_no"].ToString() != "")
                {
                    model.goods_no = ds.Tables[0].Rows[0]["goods_no"].ToString();
                }
                if (ds.Tables[0].Rows[0]["stock_quantity"] != null && ds.Tables[0].Rows[0]["stock_quantity"].ToString() != "")
                {
                    model.stock_quantity = int.Parse(ds.Tables[0].Rows[0]["stock_quantity"].ToString());
                }
                if (ds.Tables[0].Rows[0]["market_price"] != null && ds.Tables[0].Rows[0]["market_price"].ToString() != "")
                {
                    model.market_price = decimal.Parse(ds.Tables[0].Rows[0]["market_price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sell_price"] != null && ds.Tables[0].Rows[0]["sell_price"].ToString() != "")
                {
                    model.sell_price = decimal.Parse(ds.Tables[0].Rows[0]["sell_price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["point"] != null && ds.Tables[0].Rows[0]["point"].ToString() != "")
                {
                    model.point = int.Parse(ds.Tables[0].Rows[0]["point"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_msg"] != null && ds.Tables[0].Rows[0]["is_msg"].ToString() != "")
                {
                    model.is_msg = int.Parse(ds.Tables[0].Rows[0]["is_msg"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_top"] != null && ds.Tables[0].Rows[0]["is_top"].ToString() != "")
                {
                    model.is_top = int.Parse(ds.Tables[0].Rows[0]["is_top"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_red"] != null && ds.Tables[0].Rows[0]["is_red"].ToString() != "")
                {
                    model.is_red = int.Parse(ds.Tables[0].Rows[0]["is_red"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_hot"] != null && ds.Tables[0].Rows[0]["is_hot"].ToString() != "")
                {
                    model.is_hot = int.Parse(ds.Tables[0].Rows[0]["is_hot"].ToString());
                }
                if (ds.Tables[0].Rows[0]["is_slide"] != null && ds.Tables[0].Rows[0]["is_slide"].ToString() != "")
                {
                    model.is_slide = int.Parse(ds.Tables[0].Rows[0]["is_slide"].ToString());
                }
                if (ds.Tables[0].Rows[0]["digg_good"] != null && ds.Tables[0].Rows[0]["digg_good"].ToString() != "")
                {
                    model.digg_good = int.Parse(ds.Tables[0].Rows[0]["digg_good"].ToString());
                }
                if (ds.Tables[0].Rows[0]["digg_bad"] != null && ds.Tables[0].Rows[0]["digg_bad"].ToString() != "")
                {
                    model.digg_bad = int.Parse(ds.Tables[0].Rows[0]["digg_bad"].ToString());
                }
                #endregion  ������Ϣend

                model.goods_group_prices = GetGoodsGroupPriceList(id); //����û�����Ʒ�۸�
                model.albums = new article_albums().GetList(id); //�����Ϣ
                model.attribute_values = new attribute_value().GetList(id); //��չ����
                return model;
            }
            else
            {
                return null;
            }
        }
        public void PublishUsedGood_Andriod(string title, string type, string quantity, string price, string description, string userId, string mobilephone, string imgarr, string version, string equType, string equName)
        {
            string json_result = string.Empty;
            if (string.IsNullOrEmpty(title))
            {
                json_result = "{\"status\":\"false\",\"data\":\"title参数不能为空!\"}";
                Context.Response.Write(json_result);
                Context.Response.End();
                return;
            }
            //变量处理
            int _type = 0, _userId = 0, _quantity = 0;
            decimal _price = 0;

            int.TryParse(type, out _type);
            int.TryParse(quantity, out _quantity);
            int.TryParse(userId, out _userId);
            decimal.TryParse(price, out _price);

            try
            {

                bool result = true;
                Model.article_goods model = new Model.article_goods();
                model.channel_id = (int)DTEnums.ChannelEnum.goods;
                model.title = title;
                model.category_id = _type;
                model.stock_quantity = _quantity;
                model.market_price = _price;
                model.sell_price = _price;
                model.content = description;
                model.user_id = _userId;
                model.add_time = DateTime.Now;
                model.goods_no = mobilephone;
                model.img_url = "";
                //处理图片组
                if (!string.IsNullOrEmpty(imgarr.Trim()))
                {
                    UpLoad _uploadHelper = new UpLoad();
                    List<Model.article_albums> _ls_albums = new List<Model.article_albums>();
                    string[] arr_img = imgarr.Split('|');
                    string _temp = string.Empty;
                    for (int i = 0; i < arr_img.Length; i++)
                    {
                        _temp = _uploadHelper.Base64ToImg(arr_img[i]);
                        if (_temp == null)
                        {
                            Context.Response.Write("{\"status\":\"false\",\"data\":\"上传图片过程中发生意外!\"}");
                            Context.Response.End();
                            return;
                        }
                        //图片上传处理(存入相册中)
                        _ls_albums.Add(new Model.article_albums
                        {
                            big_img = _temp,
                            small_img = _temp,
                            remark = ""
                        });
                        model.img_url = _temp;
                    }
                    model.albums = _ls_albums;

                }

                model.link_url = "";
                model.is_red = 0;
                model.is_slide = 0;
                model.is_top = 0;
                model.sort_id = 99;
                model.add_time = DateTime.Now;

                if (bll_article.Add(model) < 1)
                {
                    json_result = "{\"status\":\"false\",\"data\":\"发布失败!\"}";
                }
                else
                {
                    json_result = "{\"status\":\"true\",\"data\":\"发布成功!\"}";
                }
            }
            catch (Exception ex)
            {
                json_result = "{\"status\":\"false\",\"data\":\"" + ex.Message + "\"}";
            }
            WriteWebServiceLog(version, equType, equName, "PublishUsedGood_Andriod", "");
            Context.Response.Write(json_result);
            Context.Response.End();
        }