コード例 #1
0
ファイル: SaveAsTemplate.aspx.cs プロジェクト: zxl881203/src
    protected void btnSave_Click(object sender, System.EventArgs e)
    {
        System.Collections.Generic.IList <BudTemplate> byName = BudTemplate.GetByName(this.txtTypeName.Text.Trim());
        if (byName.Count > 0)
        {
            base.RegisterScript("alert('系统提示:\\n\\n此名称已存在!!请重新定义!!')");
            return;
        }
        string empty = string.Empty;

        this.AddTemplate(ref empty);
        BudTemplate.GetById(empty);
        string text = (this.Session["taskIds"] == null) ? "" : this.Session["taskIds"].ToString();

        if (!string.IsNullOrEmpty(text))
        {
            System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
            if (text.Contains("["))
            {
                list = JsonHelper.GetListFromJson(text);
            }
            else
            {
                list.Add(text);
            }
            string inputUser = PageHelper.QueryUser(this, base.UserCode);
            BudTemplateItem.SaveTemplate(list, empty, "", inputUser);
            base.RegisterScript("alert('系统提示:\\n\\n保存成功!!');");
        }
    }
コード例 #2
0
    protected void btnSave_Click1(object sender, System.EventArgs e)
    {
        string value = this.hfldCheckedIds.Value;
        int    count = BudTemplateItem.GetResourcesByTempItemId(value).Count;

        if (count > 0)
        {
            this.strJS.Append("alert('系统提示:\\n此节点已配置资源,不能保存在此节点下!');");
        }
        else
        {
            bool flag = base.Request["save"] != null;
            if (flag)
            {
                this.strJS.Append("alert('系统提示:\\n已保存,不能重复保存!');");
            }
            else
            {
                string text = (this.Session["taskIds"] == null) ? "" : this.Session["taskIds"].ToString();
                if (!string.IsNullOrEmpty(text))
                {
                    System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
                    if (text.Contains("["))
                    {
                        list = JsonHelper.GetListFromJson(text);
                    }
                    else
                    {
                        list.Add(text);
                    }
                    string inputUser = PageHelper.QueryUser(this, base.UserCode);
                    BudTemplateItem.SaveTemplate(list, this.tvBudget.SelectedValue, value, inputUser);
                    this.ViewState["save"] = true;
                    this.btnSave.Enabled   = false;
                    this.strJS.Append("alert('系统提示:\\n保存成功!');");
                    this.strJS.Append(string.Concat(new string[]
                    {
                        "location='SelectTemplate.aspx?type=",
                        this.ddlType.SelectedValue,
                        "&template=",
                        this.tvBudget.SelectedValue,
                        "&save=1';"
                    }));
                }
            }
        }
        base.RegisterScript(this.strJS.ToString());
    }
コード例 #3
0
    protected void btnSaveTemplate_Click(object sender, System.EventArgs e)
    {
        bool flag = base.Request["saveAs"] != null;

        if (flag)
        {
            this.strJS.Append("alert('系统提示:\\n已保存为新模板,不能重复保存!');");
        }
        else
        {
            string text = (this.Session["taskIds"] == null) ? "" : this.Session["taskIds"].ToString();
            if (!string.IsNullOrEmpty(text))
            {
                System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
                if (text.Contains("["))
                {
                    list = JsonHelper.GetListFromJson(text);
                }
                else
                {
                    list.Add(text);
                }
                BudTask.GetOrderNumberById(list);
                this.hdtemplateName.Value.Trim();
                string empty = string.Empty;
                this.AddTemplate(ref empty);
                string inputUser = PageHelper.QueryUser(this, base.UserCode);
                BudTemplateItem.SaveTemplate(list, empty, "", inputUser);
                this.strJS.Append("alert('系统提示:\\n保存成功!');");
                this.strJS.Append(string.Concat(new string[]
                {
                    "location='SelectTemplate.aspx?type=",
                    this.ddlType.SelectedValue,
                    "&template=",
                    empty,
                    "&saveAs=1';"
                }));
                this.ViewState["saveAs"] = true;
                this.btnSaveAs.Disabled  = true;
            }
        }
        base.RegisterScript(this.strJS.ToString());
    }