コード例 #1
0
        private void BindSelect()
        {
            DataTable dt = EnumCollection.EnumToDataTable(typeof(EnumCollection.resource_group), "key", "val");

            if (dt.Rows.Count > 0)
            {
                this.rbtnGroup.Items.Clear();
                foreach (DataRow item in dt.Rows)
                {
                    this.rbtnGroup.Items.Add(new ListItem(item["key"].ToString(), item["val"].ToString()));
                }
                this.rbtnGroup.SelectedIndex = 0;
            }

            dt = new BLL.user_info().GetList(" group_id = " + (int)EnumCollection.user_group.资源分享用户);
            this.ckbUser.DataSource     = dt;
            this.ckbUser.DataTextField  = "phone";
            this.ckbUser.DataValueField = "id";
            this.ckbUser.DataBind();
            this.ckbUser.SelectedIndex = 0;

            dt = new BLL.common_school().GetList(" 1=1 order by sort ");
            this.ddlSchool.DataSource     = dt;
            this.ddlSchool.DataTextField  = "name";
            this.ddlSchool.DataValueField = "id";
            this.ddlSchool.DataBind();
            this.ckbUser.SelectedIndex = 0;
        }
コード例 #2
0
        private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " 1 = 1 ";
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (name like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("school_list.aspx", "keywords={0}", ""));
                    return;
                }
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_school bll = new BLL.common_school();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "sort", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("school_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
コード例 #3
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_common_school_list", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.common_school bll = new BLL.common_school();
            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 += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除学校信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("school_list.aspx", "keywords={0}", this.keywords));
        }
コード例 #4
0
 private void ShowInfo()
 {
     BLL.common_school   bll   = new BLL.common_school();
     Model.common_school model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txtname.Text = model.name + "";
     txtsort.Text = model.sort + "";
 }
コード例 #5
0
        private bool DoEdit()
        {
            bool result = false;

            BLL.common_school   bll   = new BLL.common_school();
            Model.common_school model = bll.GetModel(this.id);

            model.name = Convert.ToString(txtname.Text);
            model.sort = Convert.ToInt32(txtsort.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改学校信息,主键:" + this.id); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #6
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_school", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtname.Text.Trim() == "" || txtname.Text.Trim().Length > 50)
            {
                strError += "名称为空或超出长度![br]";
            }
            if (txtsort.Text.Trim() == "" || txtsort.Text.Trim().Length > 4)
            {
                strError += "排序为空或超出长度![br]";
            }
            if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8)
            {
                strError += "添加时间为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            Model.common_school model = new Model.common_school();
            BLL.common_school   bll   = new BLL.common_school();

            model.name     = Convert.ToString(txtname.Text);
            model.sort     = Convert.ToInt32(txtsort.Text);
            model.add_time = Convert.ToDateTime(txtadd_time.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加学校信息信息,主键:" + id); //记录日志
                JscriptMsg("添加学校信息信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
コード例 #7
0
        private bool DoAdd()
        {
            bool result = false;

            BLL.common_school   bll   = new BLL.common_school();
            Model.common_school model = new Model.common_school();

            model.name     = Convert.ToString(txtname.Text);
            model.sort     = Convert.ToInt32(txtsort.Text);
            model.add_time = System.DateTime.Now;

            int id = bll.Add(model);

            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "添加学校信息,主键:" + id); //记录日志
                result = true;
            }
            return(result);
        }
コード例 #8
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_school", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.common_school   bll   = new BLL.common_school();
            Model.common_school model = bll.GetModel(this.id);

            model.name     = Convert.ToString(txtname.Text);
            model.sort     = Convert.ToInt32(txtsort.Text);
            model.add_time = Convert.ToDateTime(txtadd_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改学校信息信息,主键:" + id); //记录日志
                JscriptMsg("修改学校信息信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }