Beispiel #1
0
    public void BindGv()
    {
        DataTable templateItem = BudTemplate.GetTemplateItem(this.tvBudget.SelectedValue);

        this.gvBudget.DataSource = templateItem;
        this.gvBudget.DataBind();
    }
Beispiel #2
0
 protected void btnSave_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.IList <BudTemplate> byName = BudTemplate.GetByName(this.txtTemplateName.Text.Trim());
     if (this.action == "update")
     {
         BudTemplate byId = BudTemplate.GetById(base.Request["id"]);
         if (byId.Name != this.txtTemplateName.Text.Trim() && byName.Count > 0)
         {
             base.RegisterScript("top.ui.alert('此名称已存在,请重新定义');");
             return;
         }
         try
         {
             BudTemplate.Update(this.UpdateModel(byId));
         }
         catch
         {
             base.RegisterScript("top.ui.alert('" + this.SetMsg() + "失败,此模板不存在');");
         }
         base.RegisterScript("top.ui.tabSuccess({ parentName: '_TemplateList' });");
         return;
     }
     else
     {
         if (byName.Count > 0)
         {
             base.RegisterScript("top.ui.alert('此名称已存在,请重新定义')");
             return;
         }
         BudTemplate.Add(this.AddModel());
         base.RegisterScript("top.ui.tabSuccess({ parentName: '_TemplateList' });");
         return;
     }
 }
Beispiel #3
0
    protected void BindTree()
    {
        this.tvBudget.Nodes.Clear();
        TreeNode treeNode = new TreeNode("模板", "0");

        treeNode.SelectAction = TreeNodeSelectAction.None;
        this.tvBudget.Nodes.AddAt(0, treeNode);
        if (string.IsNullOrEmpty(this.ddlType.SelectedValue))
        {
            return;
        }
        System.Collections.Generic.IList <BudTemplate> all = BudTemplate.GetAll(this.ddlType.SelectedValue);
        int num = 0;

        foreach (BudTemplate current in all)
        {
            num++;
            TreeNode treeNode2 = new TreeNode(current.Name, current.Id);
            if (num == 1)
            {
                treeNode2.Select();
            }
            if (base.Request["template"] != null && base.Request["template"] == treeNode2.Value)
            {
                treeNode2.Select();
            }
            treeNode.ChildNodes.Add(treeNode2);
        }
        this.tvBudget.ExpandAll();
    }
Beispiel #4
0
    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保存成功!!');");
        }
    }
Beispiel #5
0
    protected void BindTree()
    {
        this.tvBudget.Nodes.Clear();
        TreeNode treeNode = new TreeNode("模板", "0");

        treeNode.SelectAction = TreeNodeSelectAction.None;
        this.tvBudget.Nodes.AddAt(0, treeNode);
        System.Collections.Generic.IList <BudTemplate> list = BudTemplate.Select(this.ddlType.SelectedValue);
        int num = 0;

        if (list.Count <BudTemplate>() == 0)
        {
            this.btnAdd.Disabled = true;
        }
        else
        {
            this.btnAdd.Disabled = false;
        }
        foreach (BudTemplate current in list)
        {
            num++;
            TreeNode treeNode2 = new TreeNode(current.Name, current.Id);
            if (num == 1)
            {
                treeNode2.Select();
            }
            if (base.Request["tempId"] != null && base.Request["tempId"] == treeNode2.Value)
            {
                treeNode2.Select();
            }
            treeNode.ChildNodes.Add(treeNode2);
        }
        this.tvBudget.ExpandAll();
    }
Beispiel #6
0
 public void BindGv()
 {
     System.Collections.Generic.IList <BudTemplate> dataSource = new System.Collections.Generic.List <BudTemplate>();
     //dataSource = BudTemplate.Select(NBasePage.pagesize, this.AspNetPager1.CurrentPageIndex - 1, this.tvTempType.SelectedValue);
     dataSource = BudTemplate.Select(this.tvTempType.SelectedValue);
     this.gvTemplate.DataSource = dataSource;
     this.gvTemplate.DataBind();
     //this.AspNetPager1.RecordCount = BudTemplate.GetAll(this.tvTempType.SelectedValue).Count;
 }
Beispiel #7
0
    public void BindGv()
    {
        DataTable templateItem = BudTemplate.GetTemplateItem(this.tvBudget.SelectedValue);

        this.gvBudget.DataSource = templateItem;
        this.gvBudget.DataBind();
        this.hfldCheckedIds.Value = string.Empty;
        this.hfldTempId.Value     = this.tvBudget.SelectedValue;
        this.hfldTemTypeId.Value  = this.ddlType.SelectedValue;
    }
Beispiel #8
0
    private void AddTemplate(ref string typeId)
    {
        string selectedValue = this.ddlType.SelectedValue;

        if (!string.IsNullOrEmpty(selectedValue))
        {
            typeId = System.Guid.NewGuid().ToString();
            BudTemplateType byId        = BudTemplateType.GetById(selectedValue);
            BudTemplate     budTemplate = BudTemplate.Create(typeId, System.DateTime.Now.ToString("yyyyMMddHHmmsss"), this.hdtemplateName.Value.Trim(), PageHelper.QueryUser(this, base.UserCode), new System.DateTime?(System.DateTime.Now), byId);
            BudTemplate.Add(budTemplate);
        }
    }
Beispiel #9
0
    public void AddTemplate(ref string typeId)
    {
        string text = base.Request["typeId"];

        if (!string.IsNullOrEmpty(text))
        {
            typeId = System.Guid.NewGuid().ToString();
            BudTemplateType byId        = BudTemplateType.GetById(text);
            BudTemplate     budTemplate = BudTemplate.Create(typeId, System.DateTime.Now.ToString("yyyyMMddHHmmsss"), this.txtTypeName.Text.Trim(), PageHelper.QueryUser(this, base.UserCode), new System.DateTime?(System.DateTime.Now), byId);
            BudTemplate.Add(budTemplate);
        }
    }
Beispiel #10
0
    public void InitPage()
    {
        this.hlfdtempTypeId.Value = base.Request.QueryString["tempTypeId"].ToString();
        if (!(this.action == "update"))
        {
            this.lblTitle.Text = "新增模板";
            this.hdGuid.Value  = System.Guid.NewGuid().ToString();
            return;
        }
        this.lblTitle.Text = "编辑模板";
        string      id   = base.Request["id"];
        BudTemplate byId = BudTemplate.GetById(id);

        if (byId != null)
        {
            this.txtTemplateName.Text = byId.Name;
            this.hlfdtempTypeId.Value = byId.BudTempType.Id;
            return;
        }
        base.RegisterScript("alert('系统提示:\\n\\n此模板不存在!');");
        base.RegisterScript("winclose('TemplateEdit', 'TemplateList.aspx?tempTypeId=" + this.hlfdtempTypeId.Value + "', true);");
    }
Beispiel #11
0
 protected void btnDel_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
     if (this.hfldPurchaseChecked.Value.Contains("["))
     {
         list = JsonHelper.GetListFromJson(this.hfldPurchaseChecked.Value);
     }
     else
     {
         list.Add(this.hfldPurchaseChecked.Value);
     }
     try
     {
         BudTemplate.Delete(list);
         base.RegisterScript("alert('系统提示:\\n删除成功!')");
         this.AddTempTypeIdToUrl();
     }
     catch
     {
         base.RegisterScript("alert('系统提示:\\n请先删除子项!')");
     }
 }
Beispiel #12
0
 public BudTemplate UpdateModel(BudTemplate model)
 {
     model.Name        = this.txtTemplateName.Text.Trim();
     model.BudTempType = BudTemplateType.GetById(this.hlfdtempTypeId.Value.Trim());
     return(model);
 }
Beispiel #13
0
 public BudTemplate AddModel()
 {
     return(BudTemplate.Create(this.hdGuid.Value, System.DateTime.Now.ToString("yyyyMMddHHmmsss"), this.txtTemplateName.Text.Trim(), PageHelper.QueryUser(this, base.UserCode), new System.DateTime?(System.DateTime.Now), BudTemplateType.GetById(this.hlfdtempTypeId.Value.Trim())));
 }