protected void Save_Btn(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["tid"]))
     {
         Convert.ToInt32(base.Request.QueryString["tid"]);
         Tasks_TypeInfo tasks_TypeInfo = this.ViewState["sd"] as Tasks_TypeInfo;
         tasks_TypeInfo.TypeName = this.TypeName.Value.Replace("#", "").Replace(",", "");
         tasks_TypeInfo.Orders   = Convert.ToInt32(this.Orders.Value);
         tasks_TypeInfo.Notes    = this.Notes.Value;
         if (Convert.ToInt32(this.parentID.SelectedValue) != tasks_TypeInfo.id)
         {
             tasks_TypeInfo.ParentID = Convert.ToInt32(this.parentID.SelectedValue);
         }
         Tasks_Type.Init().Update(tasks_TypeInfo);
         string str = HttpContext.Current.Server.HtmlEncode("您好!工作任务分类已编辑成功!");
         base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=../Manage/Tasks/TaskType_List.aspx&tip=" + str);
     }
     else
     {
         Tasks_TypeInfo tasks_TypeInfo = new Tasks_TypeInfo();
         tasks_TypeInfo.TypeName = this.TypeName.Value.Replace("#", "").Replace(",", "");
         tasks_TypeInfo.Orders   = Convert.ToInt32(this.Orders.Value);
         tasks_TypeInfo.Notes    = this.Notes.Value;
         tasks_TypeInfo.ParentID = Convert.ToInt32(this.parentID.SelectedValue);
         Tasks_Type.Init().Add(tasks_TypeInfo);
         string str = HttpContext.Current.Server.HtmlEncode("您好!工作任务分类已添加成功!");
         base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=../Manage/Tasks/TaskType_List.aspx&tip=" + str);
     }
 }
Exemple #2
0
    protected void Del_Btn(object sender, EventArgs e)
    {
        LinkButton     linkButton      = sender as LinkButton;
        string         commandArgument = linkButton.CommandArgument;
        Tasks_TypeInfo byId            = Tasks_Type.Init().GetById(Convert.ToInt32(commandArgument));

        this.DeleteDep(byId);
        this.Show();
    }
    private void Show(string did)
    {
        Tasks_TypeInfo byId = Tasks_Type.Init().GetById(Convert.ToInt32(did));

        this.ViewState["sd"]        = byId;
        this.parentID.SelectedValue = string.Concat(byId.ParentID);
        this.TypeName.Value         = byId.TypeName;
        this.Notes.Value            = byId.Notes;
        this.Orders.Value           = string.Concat(byId.Orders);
    }
Exemple #4
0
    private void DeleteDep(Tasks_TypeInfo sdi)
    {
        IList all = Tasks_Type.Init().GetAll("ParentID=" + sdi.id, null);

        for (int i = 0; i < all.Count; i++)
        {
            Tasks_TypeInfo sdi2 = all[i] as Tasks_TypeInfo;
            this.DeleteDep(sdi2);
        }
        this.DeleteTasks(sdi.id);
        Tasks_Type.Init().Delete(sdi.id);
    }