Пример #1
0
        /// <summary>
        /// ProcessForReport
        /// </summary>
        /// <param name="linningPlanTDS">TDS for process</param>
        public void ProcessForReport(LinningPlanTDS linningPlanTDS)
        {
            LinningPlanJlinerGateway linningPlanJlinerGateway = new LinningPlanJlinerGateway(Data);
            linningPlanJlinerGateway.ClearBeforeFill = false;
            LinningPlanJliner linningPlanJliner = new LinningPlanJliner(Data);

            foreach (LinningPlanTDS.LinningPlanRow linningPlanRow in linningPlanTDS.LinningPlan.Rows)
            {
                if (linningPlanRow.Selected != "9")
                {
                    // Create row for report
                    LinningPlanTDS.LinningPlanRow newRow = ((LinningPlanTDS.LinningPlanDataTable)Table).NewLinningPlanRow();

                    newRow.ID = linningPlanRow.ID;
                    newRow.COMPANY_ID = linningPlanRow.COMPANY_ID;
                    newRow.RecordID = linningPlanRow.RecordID;
                    if (!linningPlanRow.IsStreetNull()) newRow.Street = linningPlanRow.Street;
                    if (!linningPlanRow.IsConfirmedSizeNull()) newRow.ConfirmedSize = linningPlanRow.ConfirmedSize;
                    if (!linningPlanRow.IsBypassRequiredNull()) newRow.BypassRequired = linningPlanRow.BypassRequired;
                    if (!linningPlanRow.IsDegreeOfTrafficControlNull()) newRow.DegreeOfTrafficControl = linningPlanRow.DegreeOfTrafficControl;
                    if (!linningPlanRow.IsNumLatsNull()) newRow.NumLats = linningPlanRow.NumLats;
                    if (!linningPlanRow.IsNotLinedYetNull()) newRow.NotLinedYet = linningPlanRow.NotLinedYet;
                    if (!linningPlanRow.IsActualLengthNull()) newRow.ActualLength = linningPlanRow.ActualLength;
                    if (!linningPlanRow.IsUSMHNull()) newRow.USMH = linningPlanRow.USMH;
                    if (!linningPlanRow.IsDSMHNull()) newRow.DSMH = linningPlanRow.DSMH;
                    if (!linningPlanRow.IsAllMeasuredNull()) newRow.AllMeasured = linningPlanRow.AllMeasured;
                    if (!linningPlanRow.IsDate_Null()) newRow.Date_ = linningPlanRow.Date_;
                    if (!linningPlanRow.IsFlusherNull()) newRow.Flusher = linningPlanRow.Flusher;
                    if (!linningPlanRow.IsFlusherMNNull()) newRow.FlusherMN = linningPlanRow.FlusherMN;
                    if (!linningPlanRow.IsLinerNull()) newRow.Liner = linningPlanRow.Liner;
                    if (!linningPlanRow.IsLinerMNNull()) newRow.LinerMN = linningPlanRow.LinerMN;
                    if (!linningPlanRow.IsRotatorNull()) newRow.Rotator = linningPlanRow.Rotator;
                    if (!linningPlanRow.IsRotatorMNNull()) newRow.RotatorMN = linningPlanRow.RotatorMN;
                    if (!linningPlanRow.IsCompressorNull()) newRow.Compressor = linningPlanRow.Compressor;
                    if (!linningPlanRow.IsCompressorMNNull()) newRow.CompressorMN = linningPlanRow.CompressorMN;
                    newRow.Selected = linningPlanRow.Selected;
                    if (!linningPlanRow.IsLinerMNTypeNull()) newRow.LinerMNType = linningPlanRow.LinerMNType; else newRow.LinerMNType = "";

                    ((LinningPlanTDS.LinningPlanDataTable)Table).AddLinningPlanRow(newRow);

                    // Select jliners for report
                    linningPlanJlinerGateway.LoadByIdMn(linningPlanRow.ID, linningPlanRow.COMPANY_ID, newRow.LinerMNType);
                    linningPlanJliner.UpdateCommentsForReport();
                }
            }
        }
 /// <summary>
 /// InitData
 /// </summary>
 protected override void InitData()
 {
     _data = new LinningPlanTDS();
 }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_APP_VIEW"]))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in linning_plan.aspx");
                }

                // Tag page
                hdfCurrentClient.Value = (string)Request.QueryString["client"];

                // Prepare initial data

                // ...  for the client
                int companyId = Int32.Parse(Session["companyID"].ToString());
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(int.Parse(hdfCurrentClient.Value), companyId);
                TextBox tbxCurrentClient = (TextBox)tkrpbLeftMenuCurrentClient.FindItemByValue("mCurrentClient").FindControl("tbxCurrentClient");
                tbxCurrentClient.Text = companiesGateway.GetName(int.Parse(hdfCurrentClient.Value));

                // ... for the grid
                linningPlanTDS = new LinningPlanTDS();
                LinningPlanGateway linningPlanGateway = new LinningPlanGateway(linningPlanTDS);
                linningPlanGateway.ClearBeforeFill = false;

                linningPlanGateway.LoadByCompaniesIdIssueWithLateralsNoOutOfScope(companyId, int.Parse(hdfCurrentClient.Value));
                linningPlanGateway.LoadByCompaniesIdOtherIssueWithLaterals(companyId, int.Parse(hdfCurrentClient.Value));

                grdLinningPlan.DataSource = linningPlanGateway.Table;
                grdLinningPlan.DataBind();

                // Check results
                if (linningPlanTDS.LinningPlan.Rows.Count > 0)
                {
                    pNoResults.Visible = false;
                }
                else
                {
                    pNoResults.Visible = true;
                }

                // Store dataset
                Session["linningPlanTDS"] = linningPlanTDS;
            }
            else
            {
                // Restore dataset
                linningPlanTDS = (LinningPlanTDS) Session["linningPlanTDS"];

                // ... for the grid
                LinningPlanGateway linningPlanGateway = new LinningPlanGateway(linningPlanTDS);
                linningPlanGateway.ClearBeforeFill = false;
                int companyId = Int32.Parse(Session["companyID"].ToString());
                linningPlanGateway.LoadByCompaniesIdIssueWithLateralsNoOutOfScope(companyId, int.Parse(hdfCurrentClient.Value));
                linningPlanGateway.LoadByCompaniesIdOtherIssueWithLaterals(companyId, int.Parse(hdfCurrentClient.Value));

                grdLinningPlan.DataSource = linningPlanGateway.Table;
                grdLinningPlan.DataBind();
            }
        }