// ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// SectionUpdate
        /// </summary>
        public void SectionUpdate()
        {
            foreach (Fix1TDS.LFS_MASTER_AREARow masterAreaRow in (Fix1TDS.LFS_MASTER_AREADataTable)Table)
            {
                LinningPlanGateway liningPlanGateway = new LinningPlanGateway();
                Fix1JlinerGateway fix1JlinerGateway = new Fix1JlinerGateway();
                fix1JlinerGateway.LoadByIdCompanyId(masterAreaRow.ID, masterAreaRow.COMPANY_ID);

                Fix1Jliner fix1Jliner = new Fix1Jliner(fix1JlinerGateway.Data);

                // Update variables
                int numLats = fix1Jliner.GetNumLats(masterAreaRow.ID, masterAreaRow.COMPANY_ID);
                int notLinedYeet = fix1Jliner.GetNotLinedYet(masterAreaRow.ID, masterAreaRow.COMPANY_ID);
                bool allMeasured = fix1Jliner.GetAllMeasured(masterAreaRow.ID, masterAreaRow.COMPANY_ID);
                int notMeasuredYet = fix1Jliner.GetNotMeasuredYet(masterAreaRow.ID, masterAreaRow.COMPANY_ID);
                int notDeliveredYet = fix1Jliner.GetNotDeliveredYet(masterAreaRow.ID, masterAreaRow.COMPANY_ID);

                masterAreaRow.NumLats = numLats;
                masterAreaRow.NotLinedYet = notLinedYeet;
                masterAreaRow.AllMeasured = (numLats == 0) ? false : allMeasured;
                masterAreaRow.NotMeasuredYet = notMeasuredYet;
                masterAreaRow.NotDeliveredYet = notDeliveredYet;

                // Update IssueWithtLaterals
                Guid rowId = masterAreaRow.ID;
                if (liningPlanGateway.IsLateralsIssueNo(rowId))
                {
                    masterAreaRow.IssueWithLaterals = "No";
                }
                else
                {
                    if (liningPlanGateway.IsLateralsIssueOutOfScope(rowId))
                    {
                        masterAreaRow.IssueWithLaterals = "Out Of Scope";
                    }
                    else
                    {
                        if (liningPlanGateway.IsLateralsIssueYesOutOfScope(rowId))
                        {
                            masterAreaRow.IssueWithLaterals = "Yes, Out Of Scope";
                        }
                        else
                        {
                            if (liningPlanGateway.IsLateralsIssueYes(rowId))
                            {
                                masterAreaRow.IssueWithLaterals = "Yes";
                            }
                        }
                    }
                }
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // 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();
            }
        }
Beispiel #3
0
        /// <summary>
        /// UpdateIssueWithLaterals
        /// </summary>
        public void UpdateIssueWithLaterals()
        {
            LinningPlanGateway liningPlanGateway = new LinningPlanGateway();

            foreach (SectionTDS.LFS_MASTER_AREARow lfsMasterAreaRow in (SectionTDS.LFS_MASTER_AREADataTable)Table)
            {
                Guid rowId = lfsMasterAreaRow.ID;

                if (lfsMasterAreaRow.NumLats > 0)
                {
                    if (liningPlanGateway.IsLateralsIssueNo(rowId))
                    {
                        lfsMasterAreaRow.IssueWithLaterals = "No";
                    }
                    else
                    {
                        if (liningPlanGateway.IsLateralsIssueOutOfScope(rowId))
                        {
                            lfsMasterAreaRow.IssueWithLaterals = "Out Of Scope";
                        }
                        else
                        {
                            if (liningPlanGateway.IsLateralsIssueYesOutOfScope(rowId))
                            {
                                lfsMasterAreaRow.IssueWithLaterals = "Yes, Out Of Scope";
                            }
                            else
                            {
                                if (liningPlanGateway.IsLateralsIssueYes(rowId))
                                {
                                    lfsMasterAreaRow.IssueWithLaterals = "Yes";
                                }
                            }
                        }
                    }
                }
                else
                {
                    lfsMasterAreaRow.IssueWithLaterals = "No";
                }
            }
        }