Esempio n. 1
0
        private void ShowInfo(int _id)
        {
            BLL.goods bll = new BLL.goods();
            Model.goods model = bll.GetGoodsModel(_id);

            ddlBusiness.SelectedValue = model.category_id.ToString();

            ddlDiscount.SelectedValue = model.discount.ToString();
            ddlType.SelectedValue = model.type_id.ToString();

            txtTitle.Text = model.title;
            txtImgUrl.Text = model.img_url;
            txtContent.Text = model.content;
            //9:30-22:00";
            string[] arr_time =  model.sell_time.Split('-');
            if (arr_time.Length > 1)
            {
                ddlTime_l1.SelectedValue = arr_time[0].Split(':')[0];
                ddlTime_l2.SelectedValue = arr_time[0].Split(':')[1];
                ddlTime_r1.SelectedValue = arr_time[1].Split(':')[0];
                ddlTime_r2.SelectedValue = arr_time[1].Split(':')[1];
            }
            txtPhone.Text = model.phone;
            txtMobile.Text = model.mobilephone;
            txtLocation.Text = model.address;
            txtlng.Text = model.lng;
            txtlat.Text = model.lat;
            txtContact.Text = model.contact;

            txtAvgPrice.Text = model.avg_price.ToString();

            //判断 当为门票类型时,market_price为成人票价格 sell_price 为儿童票价格
            if (model.category_id == (int)DTEnums.CatergoryID.season)
            {
                txtAdultPrice.Text = model.market_price.ToString();
                txtChildPrice.Text = model.sell_price.ToString();
            }
            else
            {
                txtMarketPrice.Text = model.market_price.ToString();
            }

            rdoItem.SelectedValue = model.good_limit.ToString();// 0;//用户导游都能看
            cblItem.SelectedValue = model.type_id.ToString();
            txtSortId.Text = model.sort_id.ToString();
            //model.sell_price = 0;
            //model.status = 1; //0是申请 1是正常  2是过期禁用

            txtStartDate.Text = model.begin_date;
            txtEndDate.Text = model.end_date;
            if (model.is_top == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            //赋值用户组价格
            //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();
            //            }
            //        }
            //    }
            //}
            if (!string.IsNullOrEmpty(model.remark1))
            {
                string[] arrList = model.remark1.Split(',');
                //绑定对应城市数据
                CityBind(int.Parse(arrList[0].ToString()), int.Parse(arrList[1].ToString()));
                this.ddlProvince.SelectedValue = arrList[0].ToString();
                this.ddlCity.SelectedValue = arrList[1].ToString();
                this.ddlArea.SelectedValue = arrList[2].ToString();

            }
            //赋值上传的相册
            focus_photo.Value = model.img_url; //封面图片
            LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url);
        }
Esempio n. 2
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.goods bll = new BLL.goods();
     Model.goods model = bll.GetGoodsModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtntop":
             if (model.is_top == 1)
                 bll.UpdateField(id, "is_top=0");
             else
                 bll.UpdateField(id, "is_top=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateField(id, "is_red=0");
             else
                 bll.UpdateField(id, "is_red=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. 3
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.goods bll = new BLL.goods();
            Model.goods model = bll.GetGoodsModel(_id);
            model.id = _id;
            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.category_id = int.Parse(ddlBusiness.SelectedValue);
            model.link_url = "";
            //检查是否有自定义图片
            if (txtImgUrl.Text.Trim() != "")
            {
                model.img_url = txtImgUrl.Text;
            }
            else
            {
                model.img_url = @"/admin/images/default.png";
            }
            model.content = txtContent.Text.Trim();
            model.sell_time = String.Format("{0}:{1}-{2}:{3}", ddlTime_l1.SelectedValue, ddlTime_l2.SelectedValue, ddlTime_r1.SelectedValue, ddlTime_r2.SelectedValue); //"9:30-22:00";
            model.phone = txtPhone.Text.Trim();
            model.mobilephone = txtMobile.Text.Trim();
            model.city_id = int.Parse(Request.Form["ddlArea"]);
            model.address = txtLocation.Text.Trim();
            model.lat = txtlat.Text.Trim();
            model.lng = txtlng.Text.Trim();
            model.type_id = string.IsNullOrEmpty(Request.Form["ddlType"]) ? 0 : int.Parse(Request.Form["ddlType"]);
            model.rtype_id = 0;
            model.discount = string.IsNullOrEmpty(Request.Form["ddlDiscount"]) ? 0 : int.Parse(Request.Form["ddlDiscount"]);
            model.avg_price = decimal.Parse(txtAvgPrice.Text.Trim());
            model.contact = txtContact.Text.Trim();

            //判断 当为门票类型时,market_price为成人票价格 sell_price 为儿童票价格
            if (int.Parse(ddlBusiness.SelectedValue) == (int)DTEnums.CatergoryID.season)
            {
                model.market_price = decimal.Parse(txtAdultPrice.Text);
                model.sell_price = decimal.Parse(txtChildPrice.Text);
            }
            else
            {
                model.market_price = decimal.Parse(txtMarketPrice.Text);
                model.sell_price = 0;
            }

            model.status = 1;
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.begin_date = txtStartDate.Text.Trim();
            model.end_date = txtEndDate.Text.Trim();
            model.good_limit = int.Parse(rdoItem.SelectedValue);//用户导游都能看

            model.is_red = 0;
            model.is_slide = 0;
            model.is_top = 0;
            model.remark1 = Request.Form["ddlProvince"] + "," + Request.Form["ddlCity"] + "," + Request.Form["ddlArea"];
            model.remark2 = 0;

            if (cblItem.Items[0].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_red = 1;
            }

            //查看权限

            model.good_limit = int.Parse(rdoItem.SelectedValue);

            ////会员组价格
            //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;

            //保存相册
            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.goods_albums> ls = new List<Model.goods_albums>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int img_id = int.Parse(imgArr[0]);
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.goods_albums { id = img_id, good_id = _id, big_img = imgArr[1], small_img = imgArr[2], remark = remarkArr[i] });
                        }
                        else
                        {
                            ls.Add(new Model.goods_albums { id = img_id, good_id = _id, big_img = imgArr[1], small_img = imgArr[2] });
                        }
                    }
                }
                model.albums = ls;
            }

            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }