protected void Page_Load(object sender, System.EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        if (!Page.IsPostBack)
        {
            #region 获取页面参数
            ViewState["DataSet"] = Request.QueryString["DataSet"] != null ? new Guid(Request.QueryString["DataSet"]) : Guid.Empty;
            ViewState["ID"]      = Request.QueryString["ID"] != null ? new Guid(Request.QueryString["ID"]) : Guid.Empty;
            #endregion

            #region 获取字段对应的数据集ID
            if ((Guid)ViewState["ID"] != Guid.Empty)
            {
                Rpt_DataSetFieldsBLL _bll = new Rpt_DataSetFieldsBLL((Guid)ViewState["ID"]);
                ViewState["DataSet"] = _bll.Model.DataSet;
            }

            if ((Guid)ViewState["DataSet"] == Guid.Empty)
            {
                Response.Redirect("Rpt_DataSetList.aspx");
            }

            Rpt_DataSet dataset = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).Model;
            ViewState["DataSet_CommandType"] = dataset.CommandType;
            #endregion


            BindDropDown();

            if ((Guid)ViewState["ID"] != Guid.Empty)
            {
                //修改
                BindData();
            }
            else
            {
                //新增

                ddl_IsComputeField.SelectedValue = "Y";
                ddl_IsComputeField.Enabled       = false;
                ddl_IsComputeField_SelectedIndexChanged(null, null);

                int maxsortid = 0;
                IList <Rpt_DataSetFields> fields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields();
                if (fields.Count > 0)
                {
                    maxsortid = fields.Max(p => p.ColumnSortID);
                }
                tbx_SortID.Text = (++maxsortid).ToString();

                tbx_FieldName.Visible   = true;
                ddl_DisplayMode.Enabled = false;
                tbx_TreeLevel.Enabled   = false;
                bt_Delete.Visible       = false;
            }
        }
    }
Exemplo n.º 2
0
    protected void bt_AddToDataSet_Click(object sender, EventArgs e)
    {
        IList <Rpt_DataSetFields> datasetfields = new Rpt_DataSetBLL((Guid)ViewState["ID"]).GetFields();
        int maxsortid = 0;

        if (datasetfields.Count > 0)
        {
            maxsortid = datasetfields.Max(p => p.ColumnSortID);
        }

        foreach (ListItem item in cbxl_Fields.Items)
        {
            if (item.Selected)
            {
                Guid fieldid = new Guid(item.Value);

                UD_ModelFields f = new UD_ModelFieldsBLL(fieldid).Model;
                if (f != null)
                {
                    string fieldname = new UD_TableListBLL(f.TableID).Model.ModelClassName + "_" + f.FieldName;
                    if (datasetfields.FirstOrDefault(p => p.FieldName == fieldname) != null)
                    {
                        continue;
                    }

                    maxsortid++;

                    Rpt_DataSetFieldsBLL fieldbll = new Rpt_DataSetFieldsBLL();
                    fieldbll.Model.DataSet        = (Guid)ViewState["ID"];
                    fieldbll.Model.FieldID        = f.ID;
                    fieldbll.Model.FieldName      = fieldname;
                    fieldbll.Model.DisplayName    = f.DisplayName;
                    fieldbll.Model.DataType       = f.DataType;
                    fieldbll.Model.IsComputeField = "N";
                    fieldbll.Model.ColumnSortID   = maxsortid;

                    if (f.RelationType == 1 || f.RelationType == 2)
                    {
                        fieldbll.Model.DisplayMode = 2;
                    }
                    else
                    {
                        fieldbll.Model.DisplayMode = 1;
                    }

                    fieldbll.Model.Description = f.Description;
                    fieldbll.Add();
                }
            }
        }

        BindGrid();
        new Rpt_DataSetBLL((Guid)ViewState["ID"]).ClearCache();
    }
    protected void bt_Expand_Click(object sender, EventArgs e)
    {
        Rpt_DataSetFields m = new Rpt_DataSetFieldsBLL((Guid)ViewState["ID"]).Model;
        if (m == null || m.TreeLevel != 0) return;

        UD_ModelFields field = new UD_ModelFieldsBLL(m.FieldID).Model;

        if (field == null) return;

        //如果关联表是树形结构,则允许设定树表层次
        if (field.RelationType == 2 && new UD_TableListBLL(field.RelationTableName).Model.TreeFlag == "Y")
        {
            int maxsortid = 0;
            IList<Rpt_DataSetFields> datasetfields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields();
            if (datasetfields.Count > 0) maxsortid = datasetfields.Max(p => p.ColumnSortID);

            Dictionary<string, Dictionary_Data> levels;
            if (field.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity")
                levels = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel");//关联至管理片区
            else if (field.RelationTableName == "MCS_SYS.dbo.Addr_OfficialCity")
                levels = DictionaryBLL.GetDicCollections("Addr_OfficialCityLevel");  //关联至行政城市
            else
                return;

            foreach (string level in levels.Keys)
            {
                string fieldname = m.FieldName + level;
                if (datasetfields.FirstOrDefault(p => p.FieldName == fieldname) == null)
                {
                    maxsortid++;

                    Rpt_DataSetFieldsBLL fieldbll = new Rpt_DataSetFieldsBLL();
                    fieldbll.Model.DataSet = (Guid)ViewState["DataSet"];
                    fieldbll.Model.FieldID = field.ID;
                    fieldbll.Model.FieldName = fieldname;
                    fieldbll.Model.DisplayName = levels[level].Name;
                    fieldbll.Model.DataType = 3;                                  //固定为字符串型
                    fieldbll.Model.IsComputeField = "N";
                    fieldbll.Model.ColumnSortID = maxsortid;
                    fieldbll.Model.DisplayMode = 2;
                    fieldbll.Model.TreeLevel = int.Parse(level);
                    fieldbll.Model.Description = field.Description;
                    fieldbll.Add();
                }
            }
            MessageBox.ShowAndRedirect(this, "展开级别成功!", "Rpt_DataSetFieldsList.aspx?ID=" + ViewState["DataSet"].ToString());
        }
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        if (!Page.IsPostBack)
        {
            #region 获取页面参数
            ViewState["DataSet"] = Request.QueryString["DataSet"] != null ? new Guid(Request.QueryString["DataSet"]) : Guid.Empty;
            ViewState["ID"]      = Request.QueryString["ID"] != null ? new Guid(Request.QueryString["ID"]) : Guid.Empty;
            #endregion

            BindDropDown();

            if ((Guid)ViewState["ID"] != Guid.Empty)
            {
                //修改
                BindData();
                td_TemParam.Visible = false;
            }
            else
            {
                //新增
                if ((Guid)ViewState["DataSet"] == Guid.Empty)
                {
                    Response.Redirect("Rpt_DataSetList.aspx");
                }
                bt_Delete.Visible = false;

                TextBox tbx_ParamSortID = (TextBox)pl_detail.FindControl("Rpt_DataSetParams_ParamSortID");
                if (tbx_ParamSortID != null)
                {
                    int maxsortid = 0;

                    IList <Rpt_DataSetParams> paramlist = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetParams();
                    if (paramlist.Count > 0)
                    {
                        maxsortid = paramlist.Max(p => p.ParamSortID);
                    }

                    tbx_ParamSortID.Text   = (++maxsortid).ToString();
                    ViewState["MaxSortID"] = maxsortid;
                }
            }
        }
    }
    protected void bt_AddToDataSet_Click(object sender, EventArgs e)
    {
        IList<Rpt_DataSetFields> datasetfields = new Rpt_DataSetBLL((Guid)ViewState["ID"]).GetFields();
        int maxsortid = 0;
        if (datasetfields.Count > 0) maxsortid = datasetfields.Max(p => p.ColumnSortID);

        foreach (ListItem item in cbxl_Fields.Items)
        {
            if (item.Selected)
            {
                Guid fieldid = new Guid(item.Value);

                UD_ModelFields f = new UD_ModelFieldsBLL(fieldid).Model;
                if (f != null)
                {
                    string fieldname = new UD_TableListBLL(f.TableID).Model.ModelClassName + "_" + f.FieldName;
                    if (datasetfields.FirstOrDefault(p => p.FieldName == fieldname) != null) continue;

                    maxsortid++;

                    Rpt_DataSetFieldsBLL fieldbll = new Rpt_DataSetFieldsBLL();
                    fieldbll.Model.DataSet = (Guid)ViewState["ID"];
                    fieldbll.Model.FieldID = f.ID;
                    fieldbll.Model.FieldName = fieldname;
                    fieldbll.Model.DisplayName = f.DisplayName;
                    fieldbll.Model.DataType = f.DataType;
                    fieldbll.Model.IsComputeField = "N";
                    fieldbll.Model.ColumnSortID = maxsortid;

                    if (f.RelationType == 1 || f.RelationType == 2)
                        fieldbll.Model.DisplayMode = 2;
                    else
                        fieldbll.Model.DisplayMode = 1;

                    fieldbll.Model.Description = f.Description;
                    fieldbll.Add();
                }
            }
        }

        BindGrid();
        new Rpt_DataSetBLL((Guid)ViewState["ID"]).ClearCache();
    }
    protected void bt_Expand_Click(object sender, EventArgs e)
    {
        Rpt_DataSetFields m = new Rpt_DataSetFieldsBLL((Guid)ViewState["ID"]).Model;

        if (m == null || m.TreeLevel != 0)
        {
            return;
        }

        UD_ModelFields field = new UD_ModelFieldsBLL(m.FieldID).Model;

        if (field == null)
        {
            return;
        }

        //如果关联表是树形结构,则允许设定树表层次
        if (field.RelationType == 2 && new UD_TableListBLL(field.RelationTableName).Model.TreeFlag == "Y")
        {
            int maxsortid = 0;
            IList <Rpt_DataSetFields> datasetfields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields();
            if (datasetfields.Count > 0)
            {
                maxsortid = datasetfields.Max(p => p.ColumnSortID);
            }

            Dictionary <string, Dictionary_Data> levels;
            if (field.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity")
            {
                levels = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel");//关联至管理片区
            }
            else if (field.RelationTableName == "MCS_SYS.dbo.Addr_OfficialCity")
            {
                levels = DictionaryBLL.GetDicCollections("Addr_OfficialCityLevel");  //关联至行政城市
            }
            else
            {
                return;
            }

            foreach (string level in levels.Keys)
            {
                string fieldname = m.FieldName + level;
                if (datasetfields.FirstOrDefault(p => p.FieldName == fieldname) == null)
                {
                    maxsortid++;

                    Rpt_DataSetFieldsBLL fieldbll = new Rpt_DataSetFieldsBLL();
                    fieldbll.Model.DataSet        = (Guid)ViewState["DataSet"];
                    fieldbll.Model.FieldID        = field.ID;
                    fieldbll.Model.FieldName      = fieldname;
                    fieldbll.Model.DisplayName    = levels[level].Name;
                    fieldbll.Model.DataType       = 3;                            //固定为字符串型
                    fieldbll.Model.IsComputeField = "N";
                    fieldbll.Model.ColumnSortID   = maxsortid;
                    fieldbll.Model.DisplayMode    = 2;
                    fieldbll.Model.TreeLevel      = int.Parse(level);
                    fieldbll.Model.Description    = field.Description;
                    fieldbll.Add();
                }
            }
            MessageBox.ShowAndRedirect(this, "展开级别成功!", "Rpt_DataSetFieldsList.aspx?ID=" + ViewState["DataSet"].ToString());
        }
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        if (!Page.IsPostBack)
        {
            #region 获取页面参数
            ViewState["DataSet"] = Request.QueryString["DataSet"] != null ? new Guid(Request.QueryString["DataSet"]) : Guid.Empty;
            ViewState["ID"] = Request.QueryString["ID"] != null ? new Guid(Request.QueryString["ID"]) : Guid.Empty;
            #endregion

            BindDropDown();

            if ((Guid)ViewState["ID"] != Guid.Empty)
            {
                //修改
                BindData();
                td_TemParam.Visible = false;
            }
            else
            {
                //新增
                if ((Guid)ViewState["DataSet"] == Guid.Empty) Response.Redirect("Rpt_DataSetList.aspx");
                bt_Delete.Visible = false;

                TextBox tbx_ParamSortID = (TextBox)pl_detail.FindControl("Rpt_DataSetParams_ParamSortID");
                if (tbx_ParamSortID != null)
                {
                    int maxsortid = 0;

                    IList<Rpt_DataSetParams> paramlist = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetParams();
                    if (paramlist.Count > 0) maxsortid = paramlist.Max(p => p.ParamSortID);

                    tbx_ParamSortID.Text = (++maxsortid).ToString();
                    ViewState["MaxSortID"] = maxsortid;
                }
            }
        }
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        // 在此处放置用户代码以初始化页面
        if (!Page.IsPostBack)
        {
            #region 获取页面参数
            ViewState["DataSet"] = Request.QueryString["DataSet"] != null ? new Guid(Request.QueryString["DataSet"]) : Guid.Empty;
            ViewState["ID"] = Request.QueryString["ID"] != null ? new Guid(Request.QueryString["ID"]) : Guid.Empty;
            #endregion

            #region 获取字段对应的数据集ID
            if ((Guid)ViewState["ID"] != Guid.Empty)
            {
                Rpt_DataSetFieldsBLL _bll = new Rpt_DataSetFieldsBLL((Guid)ViewState["ID"]);
                ViewState["DataSet"] = _bll.Model.DataSet;
            }

            if ((Guid)ViewState["DataSet"] == Guid.Empty)
            {
                Response.Redirect("Rpt_DataSetList.aspx");
            }

            Rpt_DataSet dataset = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).Model;
            ViewState["DataSet_CommandType"] = dataset.CommandType;
            #endregion

            BindDropDown();

            if ((Guid)ViewState["ID"] != Guid.Empty)
            {
                //修改
                BindData();
            }
            else
            {
                //新增

                ddl_IsComputeField.SelectedValue = "Y";
                ddl_IsComputeField.Enabled = false;
                ddl_IsComputeField_SelectedIndexChanged(null, null);

                int maxsortid = 0;
                IList<Rpt_DataSetFields> fields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields();
                if (fields.Count > 0) maxsortid = fields.Max(p => p.ColumnSortID);
                tbx_SortID.Text = (++maxsortid).ToString();

                tbx_FieldName.Visible = true;
                ddl_DisplayMode.Enabled = false;
                tbx_TreeLevel.Enabled = false;
                bt_Delete.Visible = false;
            }
        }
    }