Beispiel #1
0
    protected void btnSaveTemplate_Click(object sender, System.EventArgs e)
    {
        string      name        = this.txtTemplateName.Text.Trim();
        string      user        = PageHelper.QueryUser(this, base.UserCode);
        string      id          = System.Guid.NewGuid().ToString();
        ResTemplate resTemplate = ResTemplate.Create(id, name, 0, true, user, new System.DateTime?(System.DateTime.Now));

        ResTemplate.Add(resTemplate);
        foreach (GridViewRow gridViewRow in this.gvResource.Rows)
        {
            HiddenField  hiddenField  = gridViewRow.FindControl("hflddExcelColumn") as HiddenField;
            DropDownList dropDownList = gridViewRow.FindControl("ddlDBColmn") as DropDownList;
            if (hiddenField != null && dropDownList != null && !(dropDownList.SelectedValue == ""))
            {
                string          value           = hiddenField.Value;
                string          text            = dropDownList.SelectedItem.Text;
                string          selectedValue   = dropDownList.SelectedValue;
                ResTemplateItem restemplateitem = ResTemplateItem.Create(System.Guid.NewGuid().ToString(), resTemplate, value, text, selectedValue);
                ResTemplateItem.Add(restemplateitem);
            }
        }
        base.RegisterScript("alert('系统提示:\\n已成功保存为模板!');setTem('0');");
        this.BindddlTemplate();
        this.BindTemGv();
    }
Beispiel #2
0
 public void BindddlTemplate()
 {
     System.Collections.Generic.List <ResTemplate> dataSource = ResTemplate.GetAll().ToList <ResTemplate>();
     this.ddlTemlpate.DataSource     = dataSource;
     this.ddlTemlpate.DataTextField  = "Name";
     this.ddlTemlpate.DataValueField = "Id";
     this.ddlTemlpate.DataBind();
 }