Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (CurrentUser.RightIsAdmin || CurrentUser.HasFactoryAdminRole())
            {
                if (CurrentUser.RightCanDelete || CurrentUser.RightIsCurrentFactoryAdmin)
                {
                    buttonDelete.Visible = true;
                }
                else
                {
                    buttonDelete.Visible = false;
                }


                DataSet ds = new DataSet();

                #region 工厂数据绑定

                ds.ReadXml(Server.MapPath("..") + "\\ERPReportFactory.xml");
                dropDownListFactory.DataSource     = ds;
                dropDownListFactory.DataTextField  = "Name";
                dropDownListFactory.DataValueField = "Value";
                dropDownListFactory.DataBind();


                if (dropDownListFactory.Items.Count == 0)
                {
                    dropDownListFactory.Items.Add(new ListItem("暂无工厂", "0"));
                }
                else if (!CurrentUser.RightIsAdmin)
                {
                    for (int i = dropDownListFactory.Items.Count - 1; i >= 0; i--)
                    {
                        int tmpID = Convert.ToInt32(dropDownListFactory.Items[i].Value);
                        if (!CurrentUser.FactoryIDList.Contains(tmpID) || (CurrentUser.FactoryIDList.Contains(tmpID) && CurrentUser.UseTypeList[CurrentUser.FactoryIDList.IndexOf(tmpID)] == 0))
                        {
                            dropDownListFactory.Items.Remove(dropDownListFactory.Items[i]);
                        }
                    }
                }

                dropDownListFactory.SelectedIndex = 0;

                #endregion


                if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    labelTitle.Text = "修改查询报表";
                    int ID = Convert.ToInt32(Request.QueryString["ID"]);

                    dropDownListFactory.Enabled = false;
                    buttonCopy.Visible          = true;

                    InfoSysEntityTableAdapters.SQLReportTableAdapter sqlAdapter = new InfoSysEntityTableAdapters.SQLReportTableAdapter();

                    InfoSysEntity.SQLReportDataTable curTable = sqlAdapter.SelectByID(ID);
                    foreach (InfoSysEntity.SQLReportRow curRow in curTable.Rows)
                    {
                        textBoxReportName.Text   = curRow.SQLReportName;
                        textBoxSQLCommand.Text   = curRow.SQLReportSqlCommand;
                        textBoxSQLSQLWhere.Text  = (curRow.SQLReportSqlWhere.GetType() == typeof(DBNull)) ? "" : curRow.SQLReportSqlWhere;
                        textBoxSQLOrder.Text     = (curRow.SQLReportSqlOrder.GetType() == typeof(DBNull)) ? "" : curRow.SQLReportSqlOrder;
                        textBoxSpecialField.Text = (curRow.SQLReportSpecialField.GetType() == typeof(DBNull)) ? "" : curRow.SQLReportSpecialField;
                        textBoxShowURL.Text      = (curRow.SQLReportShowURL.GetType() == typeof(DBNull)) ? "" : curRow.SQLReportShowURL;
                        radioButtonListReportStatus.SelectedValue = curRow.SQLReportStatus.ToString();
                        dropDownListReportCate.SelectedValue      = curRow.SQLReportCate.ToString();
                        radioButtonListFucCode.SelectedValue      = curRow.SQLReportFuncCode.ToString();
                        textBoxComment.Text               = curRow.SQLReportComment;
                        textBoxCalculateField.Text        = curRow.SQLReportCalculateField;
                        dropDownListFactory.SelectedValue = curRow.SQLReportFactory.ToString();
                        textBoxSortIndex.Text             = curRow.SQLReportSortIndex.ToString();
                        checkBoxIsLimited.Checked         = curRow.SQLReportIsLimited == 1 ? true : false;

                        string strBelongsTo = curRow.SQLReportBelongsTo.ToString();
                        foreach (string str in strBelongsTo.Split(','))
                        {
                            for (int i = 0; i < checkBoxListReportCate.Items.Count; i++)
                            {
                                ListItem item = checkBoxListReportCate.Items[i];
                                if (item.Value.Equals(str))
                                {
                                    item.Selected = true;
                                }
                            }
                        }

                        break;
                    }
                }
                else
                {
                    buttonCopy.Visible = false;
                }

                departmentDatabinding();
            }
            else
            {
                FounderTecInfoSys.Common.PageGeneralAction.GoBackShowWarmingWindow("您没有权限查看此页面,开通权限请与管理员联系");
                Response.End();
            }
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (CurrentUser.RightIsAdmin || CurrentUser.HasFactoryAdminRole())
            {
                if (CurrentUser.RightCanDelete || CurrentUser.RightIsCurrentFactoryAdmin)
                {
                    buttonDelete.Visible = true;
                }
                else
                {
                    buttonDelete.Visible = false;
                }


                DataSet ds = new DataSet();

                #region 工厂数据绑定

                ds.ReadXml(Server.MapPath("..") + "\\ERPReportFactory.xml");
                dropDownListFactory.DataSource     = ds;
                dropDownListFactory.DataTextField  = "Name";
                dropDownListFactory.DataValueField = "Value";
                dropDownListFactory.DataBind();

                if (dropDownListFactory.Items.Count == 0)
                {
                    dropDownListFactory.Items.Add(new ListItem("暂无工厂", "0"));
                }
                else if (!CurrentUser.RightIsAdmin)
                {
                    for (int i = dropDownListFactory.Items.Count - 1; i >= 0; i--)
                    {
                        int tmpID = Convert.ToInt32(dropDownListFactory.Items[i].Value);
                        if (!CurrentUser.FactoryIDList.Contains(tmpID) || (CurrentUser.FactoryIDList.Contains(tmpID) && CurrentUser.UseTypeList[CurrentUser.FactoryIDList.IndexOf(tmpID)] == 0))
                        {
                            dropDownListFactory.Items.Remove(dropDownListFactory.Items[i]);
                        }
                    }
                }

                dropDownListFactory.SelectedIndex = 0;

                #endregion


                if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
                {
                    labelTitle.Text = "修改ERP辅助功能";
                    int ID = Convert.ToInt32(Request.QueryString["ID"]);

                    dropDownListFactory.Enabled = false;
                    buttonCopy.Visible          = true;

                    InfoSysEntityTableAdapters.SQLReportTableAdapter sqlAdapter = new InfoSysEntityTableAdapters.SQLReportTableAdapter();

                    InfoSysEntity.SQLReportDataTable curTable = sqlAdapter.SelectByID(ID);
                    foreach (InfoSysEntity.SQLReportRow curRow in curTable.Rows)
                    {
                        textBoxName.Text    = curRow.SQLReportName;
                        textBoxShowURL.Text = (curRow.SQLReportShowURL.GetType() == typeof(DBNull)) ? "" : curRow.SQLReportShowURL;
                        dropDownListReportCate.SelectedValue = curRow.SQLReportCate.ToString();
                        dropDownListFactory.SelectedValue    = curRow.SQLReportFactory.ToString();
                        textBoxSortIndex.Text = curRow.SQLReportSortIndex.ToString();

                        rightTable = new InfoSysEntityTableAdapters.ERPAddinRightTableAdapter().GetDataBySQLReportID(curRow.SQLReportID);

                        break;
                    }
                }
                else
                {
                    buttonCopy.Visible   = false;
                    buttonDelete.Visible = false;
                }

                departmentDatabinding();
                rightTableDataBing();
            }
            else
            {
                FounderTecInfoSys.Common.PageGeneralAction.GoBackShowWarmingWindow("您没有权限查看此页面,开通权限请与管理员联系");
                Response.End();
            }
        }
    }