Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = YK.Common.CommonClass.ReturnRequestInt("id", 0);

        if (id > 0)
        {
            help = InfoService.HelpService.Get(id);
        }
        else
        {
            List <TB_Info_Help> list = InfoService.HelpService.Search(1);
            help = list.Count > 0 ? list.First() : new TB_Info_Help();
        }
    }
Пример #2
0
 //状态设置
 protected void BtnStateSet_Click(object sender, EventArgs e)
 {
     foreach (RepeaterItem ri in RepList.Items)
     {
         CheckBox cb = ((CheckBox)ri.FindControl("CheckBoxChoose"));
         int      ID = Convert.ToInt32(((HiddenField)ri.FindControl("HiddenFieldID")).Value);
         if (cb.Checked == true)
         {
             TB_Info_Help model = InfoService.HelpService.Get(ID);
             model.IsHIdden = CkIsHidden.Checked;
             InfoService.HelpService.Update(model);
         }
     }
     //重新加载
     LoadDataBind();
 }
Пример #3
0
    //保存
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        TB_Info_Help model = new TB_Info_Help();

        if (ViewState["id"] != null)
        {
            model = InfoService.HelpService.Get(ViewState["id"]);
        }
        model.CategoryId = DDLCategory.SelectedValue.ToInt();
        model.Title      = TbName.Text;
        model.Remark     = FckRemark.Value;
        model.IsHIdden   = CheckBoxIsHidden.Checked;
        model.Creater    = AdminUserName;

        IInfo_Help Help = InfoService.HelpService;

        if (ViewState["id"] == null)
        {
            model.AddDate = DateTime.Now;
            if (Help.Insert(model) == 1)
            {
                //操作日志
                AdminService.LogService.Insert(OperationType.用户操作, 0, "帮助中心添加" + model.Title);

                MessageDiv.InnerHtml = CommonClass.Reload("数据添加成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据添加失败");
            }
        }
        else
        {
            if (Help.Update(model) == 1)
            {
                //操作日志
                AdminService.LogService.Insert(OperationType.用户操作, 0, "帮助中心修改" + model.Title);

                MessageDiv.InnerHtml = CommonClass.Reload("数据修改成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据修改失败");
            }
        }
    }
Пример #4
0
    //加载
    public void LoadDataBind()
    {
        DDLCategory.DataSource     = InfoService.HelpCategoryService.Search();
        DDLCategory.DataTextField  = "Name";
        DDLCategory.DataValueField = "ID";
        DDLCategory.DataBind();

        int ID = CommonClass.ReturnRequestInt("id", 0);

        if (ID > 0)
        {
            TB_Info_Help model = InfoService.HelpService.Get(ID);
            TbName.Text = model.Title;
            CheckBoxIsHidden.Checked = model.IsHIdden;
            FckRemark.Value          = model.Remark;

            ViewState["id"] = model.ID;
        }
    }