Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (CurrentFactoryID <= 0 || CurrentFunctionID <= 0)
            {
                FounderTecInfoSys.Common.PageGeneralAction.GoBackShowWarmingWindow("报表未找到或已经被删除");
                Response.End();
            }

            HasRight(1);

            string strURL = "about:blank";
            SQLReportTableAdapter sqlAdapter = new SQLReportTableAdapter();

            InfoSysEntity.SQLReportDataTable curTable = sqlAdapter.GetDataByID(CurrentUser.UserADAcount, Request.UserHostAddress, CurrentFunctionID);
            foreach (InfoSysEntity.SQLReportRow curRow in curTable.Rows)
            {
                strURL = curRow.SQLReportShowURL;
                if (strURL.Contains("?"))
                {
                    strURL += "&FID=" + curRow.SQLReportFactory.ToString() + "&ID=" + curRow.SQLReportID.ToString();
                }
                else
                {
                    strURL += "?FID=" + curRow.SQLReportFactory.ToString() + "&ID=" + curRow.SQLReportID.ToString();
                }
                break;
            }
            //Response.Redirect("http://pcbit-live01/ReportServer", false);
            Response.Redirect(strURL, true);
        }
    }
Ejemplo 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 = "修改查询报表";
                    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();
            }
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //listFootSum.Add("合计:");
            if (null == Request.UrlReferrer || (!Request.UrlReferrer.ToString().ToLower().Contains("left.aspx") && !Request.UrlReferrer.ToString().ToLower().Contains("searchcondition.aspx")))
            {
                FounderTecInfoSys.Common.PageGeneralAction.GoBackShowWarmingWindow("警告,你的操作属于非法操作!");
                Response.End();
            }
            labelField.Attributes.Add("onclick", "if(tableOfField.style.display=='none') {tableOfField.style.display='block';} else {tableOfField.style.display='none';} ");


            if (CurrentFactoryID <= 0 || CurrentFunctionID <= 0)
            {
                FounderTecInfoSys.Common.PageGeneralAction.GoBackShowWarmingWindow("报表未找到或已经被删除");
                Response.End();
            }


            #region 调试辅助系统
            if (CurrentUser.RightIsAdmin)
            {
                tableForDebugInfo.Visible = true;
            }
            else
            {
                tableForDebugInfo.Visible = false;
            }
            #endregion


            SQLReportTableAdapter sqlAdapter = new SQLReportTableAdapter();

            InfoSysEntity.SQLReportDataTable curTable = sqlAdapter.GetDataByID(CurrentUser.UserADAcount, Request.UserHostAddress, CurrentFunctionID);
            foreach (InfoSysEntity.SQLReportRow curRow in curTable.Rows)
            {
                // 权限

                if (HasRight(1))  // 特殊字段
                {
                    isShowSpecialField = true;
                }
                else
                {
                    isShowSpecialField = false;
                }

                if (HasRight(2) || HasRight(3) || curRow.SQLReportType == 2) // 导出功能
                {
                    isShowOutputButton = true;
                }
                else
                {
                    isShowOutputButton = false;
                }



                strReportName   = curRow.SQLReportName;
                labelTitle.Text = strReportName;

                if (curRow.SQLReportIsLimited == 1)
                {
                    strCommand = "select top 3000 * from ( " + curRow.SQLReportSqlCommand + " ) as tmp where 1=1 ";
                }
                else
                {
                    isLimited  = false;
                    strCommand = "select * from ( " + curRow.SQLReportSqlCommand + " ) as tmp where 1=1 ";
                }
                strWhere          = Convert.IsDBNull(curRow.SQLReportSqlWhere) ? "" : curRow.SQLReportSqlWhere;
                strOrder          = Convert.IsDBNull(curRow.SQLReportSqlOrder) ? "" : curRow.SQLReportSqlOrder;
                strSpecialField   = Convert.IsDBNull(curRow.SQLReportSpecialField) ? "" : curRow.SQLReportSpecialField;
                reportStatus      = curRow.SQLReportStatus;
                labelComment.Text = curRow.SQLReportComment;


                string strCalField = curRow.SQLReportCalculateField;

                string[] str = strCalField.Split(',');
                for (int i = 0; i < str.Length; i++)
                {
                    str[i] = str[i].Trim();
                    if (!str[i].Equals(string.Empty) && !listCalculateField.Contains(str[i]))
                    {
                        if (
                            isShowSpecialField
                            ||
                            string.IsNullOrEmpty(strSpecialField) || (!FounderTecInfoSys.Common.CommonFunction.FuncForString.isContain(strSpecialField, str[i], ','))
                            )
                        {
                            listCalculateField.Add(str[i]);
                        }
                    }
                }


                reportFuncCode = curRow.SQLReportFuncCode;

                break;
            }

            btnSaveToExcel.Visible = isShowOutputButton;


            if (listCalculateField.Count > 0)
            {
                GridView1.ShowFooter = true;
            }
            else
            {
                GridView1.ShowFooter = false;
            }

            showSearchData();
        }
    }
Ejemplo n.º 4
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();
            }
        }
    }