예제 #1
0
        private DefineSqlParameter getPar(string paraName, SqlDbType dbType, int size, object value)
        {
            DefineSqlParameter par = null;

            par       = new DefineSqlParameter(paraName, dbType, size, "");
            par.Value = value;
            return(par);
        }
예제 #2
0
        private void LoadReport(CompanyOperator Operator)
        {
            string rid = Request.QueryString["rid"];

            if (this.Session["ReportID"] != null)
            {
                ird = this.Session["ReportID"].ToString();
            }
            if (ird == null || ird.Trim() == "")
            {
                ird = "1";                                 // return;
            }
            TableRow  dRow  = null;
            TableCell tCell = null;

            if (!this.IsPostBack || rid != ird)
            {
                list   = new List <FiledItem>();
                report = new BaseReport(Convert.ToInt32(rid));
                this.Session["ReportID"] = rid;

                bool isHaveCompany = false;
                bool isHaveOper    = false;

                foreach (DefineSqlParameter par in report.DataSource.DbParameterCollection)
                {
                    if (!par.ParameterName.StartsWith("_"))
                    {
                        dRow       = new TableRow();
                        tCell      = new TableCell();
                        tCell.Text = par.ParameterName;
                        dRow.Cells.Add(tCell);
                        this.tabCondition.Rows.Add(dRow);

                        dRow  = new TableRow();
                        tCell = new TableCell();
                        //创建输入
                        FiledItem item = new FiledItem(par);
                        list.Add(item);
                        tCell.Controls.Add(item.getFiled());
                        dRow.Cells.Add(tCell);
                        this.tabCondition.Rows.Add(dRow);
                    }
                    else
                    {
                        switch (par.ParameterName)
                        {
                        case "_CompanyID":
                            par.Value = Operator.CompanyID;
                            break;

                        case "_OperatorID":
                            par.Value = Operator.OperID;
                            break;

                        default: par.Value = string.Empty;
                            break;
                        }
                    }

                    if (par.ParameterName == "_CompanyID")
                    {
                        isHaveCompany = true;
                    }
                    if (par.ParameterName == "_OperatorID")
                    {
                        isHaveOper = true;
                    }
                }

                if (!isHaveCompany)
                {
                    DefineSqlParameter parCompanyId = new DefineSqlParameter("_CompanyID", SqlDbType.VarChar, 50, "");
                    parCompanyId.Value = Operator.CompanyID;
                    report.DataSource.DbParameterCollection.Add(parCompanyId);
                }
                if (!isHaveOper)
                {
                    DefineSqlParameter parOperatorId = new DefineSqlParameter("_OperatorID", SqlDbType.VarChar, 50, "");
                    parOperatorId.Value = Operator.OperID;
                    report.DataSource.DbParameterCollection.Add(parOperatorId);
                }


                this.Session["Rlist"] = list;
                this.Session.Add("Report", report);
                btnQuery_Click(null, null);
            }
            else
            {
                list   = (List <FiledItem>) this.Session["Rlist"];
                report = (BaseReport)this.Session["Report"];
                //this.Table1.Rows.Clear();
                if (list == null)
                {
                    return;
                }
                foreach (FiledItem par in list)
                {
                    if (!par.FiledName.StartsWith("_"))
                    {
                        dRow       = new TableRow();
                        tCell      = new TableCell();
                        tCell.Text = par.FiledName;
                        dRow.Cells.Add(tCell);
                        this.tabCondition.Rows.Add(dRow);

                        dRow  = new TableRow();
                        tCell = new TableCell();
                        tCell.Controls.Add(par.getFiled());
                        dRow.Cells.Add(tCell);
                        this.tabCondition.Rows.Add(dRow);
                    }
                }
            }
        }
예제 #3
0
 public FiledItem(DefineSqlParameter par)
 {
     this.par = par;
 }
예제 #4
0
        private void LoadReportHeader(/*CompanyOperator Operator*/)
        {
            string rid = Request.QueryString["id"];

            if (this.Session["ReportID"] != null)
            {
                ird = this.Session["ReportID"].ToString();
            }
            if (ird == null || ird.Trim() == "")
            {
                ird = "1";                                 // return;
            }
            if (!this.IsPostBack || rid != ird)
            {
                list   = new List <FiledItem>();
                report = new BaseReport(Convert.ToInt32(rid));
                this.Session["ReportID"] = rid;

                bool isHaveCompany = false;
                bool isHaveOper    = false;

                foreach (DefineSqlParameter par in report.DataSource.DbParameterCollection)
                {
                    if (!par.ParameterName.StartsWith("_"))
                    {
                        //创建输入
                        FiledItem item = new FiledItem(par);
                        list.Add(item);
                    }
                    else
                    {
                        switch (par.ParameterName)
                        {
                        case "_CompanyID":
                            par.Value = "";    // loginOperator == null ? "" : loginOperator.CompanyID;
                            break;

                        case "_OperatorID":
                            par.Value = "";    // loginOperator == null ? "" : loginOperator.OperID;
                            break;

                        default:
                            par.Value = string.Empty;
                            break;
                        }
                    }

                    if (par.ParameterName == "_CompanyID")
                    {
                        isHaveCompany = true;
                    }
                    if (par.ParameterName == "_OperatorID")
                    {
                        isHaveOper = true;
                    }
                }


                if (!isHaveCompany)
                {
                    DefineSqlParameter parCompanyId = new DefineSqlParameter("_CompanyID", SqlDbType.VarChar, 50, "");
                    parCompanyId.Value = "";// Operator.CompanyID;
                    report.DataSource.DbParameterCollection.Add(parCompanyId);
                }
                if (!isHaveOper)
                {
                    DefineSqlParameter parOperatorId = new DefineSqlParameter("_OperatorID", SqlDbType.VarChar, 50, "");
                    parOperatorId.Value = "";// Operator.OperID;
                    report.DataSource.DbParameterCollection.Add(parOperatorId);
                }


                this.Session["Rlist"] = list;
                this.Session.Add("Report", report);
            }
            else
            {
                list   = (List <FiledItem>) this.Session["Rlist"];
                report = (BaseReport)this.Session["Report"];
            }
            if (list == null)
            {
                return;
            }

            LoadCondition(list);
            btnQuery_Click(null, null);
        }