Ejemplo n.º 1
0
    //保存
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        TB_Employee_InfoCategory model = new TB_Employee_InfoCategory();

        if (ViewState["id"] != null)
        {
            model = EmployeeService.InfoCategoryService.Get(ViewState["id"]);
        }
        model.Name    = TbName.Text;
        model.OrderBy = TbOrderBy.Text.ToInt();
        model.Creater = AdminUserName;

        if (ViewState["id"] == null)
        {
            if (EmployeeService.InfoCategoryService.Insert(model) == 1)
            {
                MessageDiv.InnerHtml = CommonClass.Reload("数据添加成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据添加失败");
            }
        }
        else
        {
            if (EmployeeService.InfoCategoryService.Update(model) == 1)
            {
                MessageDiv.InnerHtml = CommonClass.Reload("数据修改成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据修改失败");
            }
        }
    }
Ejemplo n.º 2
0
    //加载
    public void LoadDataBind()
    {
        int ID = CommonClass.ReturnRequestInt("id", 0);

        if (ID > 0)
        {
            TB_Employee_InfoCategory model = EmployeeService.InfoCategoryService.Get(ID);
            if (model.ID.ToInt() > 0)
            {
                ViewState["id"] = model.ID;

                TbName.Text    = model.Name;
                TbOrderBy.Text = model.OrderBy.ToStr();
            }
        }
    }