Exemplo n.º 1
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.article bll = new BLL.article();
            Model.article_company model = bll.GetCompanyModel(_id);

            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();

            model.category_id = int.Parse(ddlCategoryId.SelectedValue);
            model.link_url = txtLinkUrl.Text.Trim();
            //检查是否有自定义图片
            if (txtImgUrl.Text.Trim() != "")
            {
                model.img_url = txtImgUrl.Text;
            }
            else
            {
                model.img_url = focus_photo.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.content = Utils.ToTxt(txtContent.Text);
            model.digg_good = int.Parse(txtDiggGood.Text.Trim());
            model.digg_bad = int.Parse(txtDiggBad.Text.Trim());
            model.is_msg = 0;
            model.is_red = 0;
            model.is_lock = 0;
            model.is_top = 0;
            model.telephone = txtTelephone.Text.Trim();
            model.user = txtContact.Text.Trim();
            model.address = txtAddress.Text.Trim();
            model.remark1 = "";
            model.remark2 = 0;
            model.x_lng = "";
            model.y_lat = "";
            model.line =  Utils.ToHtml(txtLine.Text.Trim());
            model.price = decimal.Parse(txtPrice.Text.Trim());
            model.sell_price = decimal.Parse(txtSellPrice.Text.Trim());
            model.flight_num = txtFlightNum.Text.Trim();
            model.seat_price = txtFlightSeat.Text.Trim();
            model.begin_date = txtBeginDate.Text.Trim();
            model.end_date = txtEndDate.Text.Trim();
            model.entry_port = txtEntryPort.Text.Trim();
            model.visa_type = txtVisaType.Text.Trim();
            model.visa_nation = txtVisaNation.Text.Trim();
            model.visa_data = Utils.ToHtml( txtVisaData.Text.Trim());
            //if (cblItem.Items[0].Selected == true)
            //{
            //    model.is_msg = 1;
            //}
            if (cblItem.Items[0].Selected == true)
            {
                model.is_red = 1;
            }
            //if (cblItem.Items[2].Selected == true)
            //{
            //    model.is_lock = 1;
            //}
            //if (cblItem.Items[3].Selected == true)
            //{
            //    model.is_top = 1;
            //}
            //保存相册
            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 = int.Parse(imgArr[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;
            }
            if (!bll.Update(model))
            {
                result = false;
            }
            return result;
        }
Exemplo n.º 2
0
        private void ShowInfo(int _id)
        {
            BLL.article bll = new BLL.article();
            Model.article_company model = bll.GetCompanyModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtAddress.Text = model.address;
            txtTelephone.Text = model.telephone;
            txtContact.Text = model.user;

            txtTitle.Text = model.title;
            //自定义图片才绑定
            string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1);
            if (!filename.StartsWith("small_"))
            {
                txtImgUrl.Text = model.img_url;
            }
            txtLinkUrl.Text = model.link_url;

            if (model.is_red == 1)
            {
                cblItem.Items[0].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.Text = Utils.ToTxt(model.content);
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;

            txtLine.Text =  Utils.ToTxt(model.line);
            txtPrice.Text = model.price.ToString();
            txtSellPrice.Text = model.sell_price.ToString();
            txtFlightNum.Text = model.flight_num;
            txtFlightSeat.Text = model.seat_price;
            txtBeginDate.Text = model.begin_date;
            txtEndDate.Text = model.end_date;
            txtEntryPort.Text = model.entry_port;
            txtVisaType.Text = model.visa_type;
            txtVisaNation.Text = model.visa_nation;
            txtVisaData.Text = Utils.ToTxt( model.visa_data);
            //txtlng.Text = model.x_lng;
            //txtlat.Text = model.y_lat;
            //赋值上传的相册
            focus_photo.Value = model.img_url; //封面图片
            LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url);
        }
Exemplo n.º 3
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_company model = bll.GetCompanyModel(id);
     switch (e.CommandName.ToLower())
     {
         case "ibtnmsg":
             if (model.is_msg == 1)
                 bll.UpdateContentField(id, "is_msg=0");
             else
                 bll.UpdateContentField(id, "is_msg=1");
             break;
         case "ibtnred":
             if (model.is_red == 1)
                 bll.UpdateContentField(id, "is_red=0");
             else
                 bll.UpdateContentField(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");
 }