コード例 #1
0
        private bool DoAdd()
        {
            BLL.plugin_images   bll   = new BLL.plugin_images();
            Model.plugin_images model = new Model.plugin_images();

            model.title      = txtName.Text;
            model.link_url   = txtUrl.Text;
            model.img_url    = txtImgUrl.Text;
            model.target     = rblTarget.SelectedValue;
            model.is_lock    = int.Parse(rblHide.SelectedValue);
            model.sort_id    = Utils.StrToInt(txtSort.Text, 99);
            model.add_time   = DateTime.Now;
            model.back_color = txtColor.Text;
            model.is_type    = Utils.StrToInt(ddlType.SelectedValue, 0);
            model.content    = txtContent.Value;
            model.class_id   = Utils.StrToInt(ddlClassId.SelectedValue, 0);
            model.img_url    = txtImgUrl.Text.Trim();
            model.icon_url   = txtIconUrl.Text.Trim();
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "添加橱窗内容:" + model.title);
                return(true);
            }
            return(false);
        }
コード例 #2
0
 private void ShowInfo(int _id)
 {
     BLL.plugin_images   bll   = new BLL.plugin_images();
     Model.plugin_images model = bll.GetModel(_id);
     txtName.Text             = model.title;
     txtUrl.Text              = model.link_url;
     rblTarget.SelectedValue  = model.target;
     txtSort.Text             = model.sort_id.ToString();
     rblHide.SelectedValue    = model.is_lock.ToString();
     ddlClassId.SelectedValue = model.class_id.ToString();
     txtColor.Text            = model.back_color;
     txtContent.Value         = model.content;
     this.contentType         = model.is_type;
     ddlType.SelectedValue    = this.contentType.ToString();
     txtImgUrl.Text           = model.img_url;
     if (!string.IsNullOrEmpty(model.img_url))
     {
         divImg.Visible  = true;
         imgUrl.ImageUrl = model.img_url;
     }
     txtIconUrl.Text = model.icon_url;
     if (!string.IsNullOrEmpty(model.icon_url))
     {
         divIcon.Visible  = true;
         imgIcon.ImageUrl = model.icon_url;
     }
 }
コード例 #3
0
ファイル: images_list.aspx.cs プロジェクト: hui3694/forcomp
        //绑定数据
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page                     = DTRequest.GetQueryIntValue("page", 1);
            this.txtKeywords.Text         = Utils.Htmls(this.keywords);
            this.ddlClassID.SelectedValue = this.class_id.ToString();

            DataTable dt = new BLL.plugin_images().GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount).Tables[0];

            dt.Columns.Add("class_title", Type.GetType("System.String"));
            if (dt.Rows.Count > 0)
            {
                int cid = 0;
                Model.plugin_images_class cmodel;
                BLL.plugin_images_class   bll = new BLL.plugin_images_class();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cid    = int.Parse(dt.Rows[i]["class_id"].ToString());
                    cmodel = bll.GetModel(cid);
                    if (null != cmodel)
                    {
                        dt.Rows[i]["class_title"] = cmodel.title;
                    }
                }
            }
            this.rptList.DataSource = dt;
            this.rptList.DataBind();
            //绑定页码
            this.txtPageNum.Text = pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("images_list.aspx", "keywords={0}&class_id={1}&page={2}", keywords, this.class_id.ToString(), "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
コード例 #4
0
ファイル: images_list.aspx.cs プロジェクト: hui3694/forcomp
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            //检查权限
            ChkAdminLevel("plugin_images_list", DTEnums.ActionEnum.Delete.ToString());
            BLL.plugin_images bll = new BLL.plugin_images();
            int      sucCount     = 0;
            int      errorCount   = 0;
            Repeater rptList      = new Repeater();

            rptList = this.rptList;
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除橱窗内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("成功删除 " + sucCount + " 条,失败 " + errorCount + " 条!", Utils.CombUrlTxt("images_list.aspx", "keywords={0}&class_id={1}", this.keywords, this.class_id.ToString()));
        }
コード例 #5
0
        /// <summary>
        /// 根据ID查询图片
        /// </summary>
        /// <param name="id">ID</param>
        /// <returns>返回 Model</returns>
        public DataTable get_images_list(string call_index)
        {
            DataTable dt = new DataTable();

            if (null != call_index && call_index.Length > 0)
            {
                Model.plugin_images_class model = new BLL.plugin_images_class().GetModel(call_index);
                if (null != model && model.is_lock == 0)
                {
                    DataTable old = new BLL.plugin_images().GetList(model.num, "is_lock=0 and class_id=" + model.id, "sort_id asc,id desc").Tables[0];
                    dt = add_class_info(old, model);
                }
            }
            return(dt);
        }
コード例 #6
0
ファイル: images_list.aspx.cs プロジェクト: hui3694/forcomp
 /// <summary>
 /// 保存排序
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("plugin_images_list", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.plugin_images bll = new BLL.plugin_images();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     JscriptMsg("保存排序成功!", Utils.CombUrlTxt("images_list.aspx", "keywords={0}&class_id={1}", this.keywords, this.class_id.ToString()));
 }
コード例 #7
0
        /// <summary>
        /// 根据标记名查询内容列表
        /// </summary>
        /// <param name="call_index">call_index</param>
        /// <returns>返回内容</returns>
        public DataTable get_images_list(string call_index, string _strWhere, string filedOrder)
        {
            DataTable dt = new DataTable();

            if (null != call_index && call_index.Length > 0)
            {
                Model.plugin_images_class model = new BLL.plugin_images_class().GetModel(call_index);
                if (null != model && model.is_lock == 0)
                {
                    string strWhere = "is_lock=0 and class_id=" + model.id;
                    if (null != _strWhere && _strWhere.Length > 0)
                    {
                        strWhere += " and " + _strWhere;
                    }
                    DataTable old = new BLL.plugin_images().GetList(model.num, strWhere, filedOrder).Tables[0];
                    dt = add_class_info(old, model);
                }
            }
            return(dt);
        }