Пример #1
0
        private void GrdCatalystsAdd()
        {
            if (ValidateCatalystsFooter())
            {
                Page.Validate("catalystDataFooter");
                if (Page.IsValid)
                {
                    int companyId = Int32.Parse(hdfCompanyId.Value);
                    bool inDatabase = false;
                    bool deleted = false;
                    int workId = Int32.Parse(hdfWorkId.Value);

                    int catalystId = Int32.Parse(((DropDownList)grdCatalysts.FooterRow.FindControl("ddlNameFooter")).SelectedValue);

                    decimal percentageByWeight = -1;
                    if (((TextBox)grdCatalysts.FooterRow.FindControl("tbxPercentageByWeightFooter")).Text.Trim() != "")
                    {
                        if ((Validator.IsValidDecimal(((TextBox)grdCatalysts.FooterRow.FindControl("tbxPercentageByWeightFooter")).Text.Trim())))
                        {
                            percentageByWeight = decimal.Round(decimal.Parse(((TextBox)grdCatalysts.FooterRow.FindControl("tbxPercentageByWeightFooter")).Text.Trim()), 2);
                        }
                    }

                    decimal lbsForMixQuantity = -1;
                    if (((Label)grdCatalysts.FooterRow.FindControl("lblLbsForMixQuantityFooter")).Text.Trim() != "")
                    {
                        if ((Validator.IsValidDecimal(((Label)grdCatalysts.FooterRow.FindControl("lblLbsForMixQuantityFooter")).Text.Trim())))
                        {
                            lbsForMixQuantity = decimal.Round(decimal.Parse(((Label)grdCatalysts.FooterRow.FindControl("lblLbsForMixQuantityFooter")).Text.Trim()), 2);
                        }
                    }

                    string lbsForDrum = ((Label)grdCatalysts.FooterRow.FindControl("lblLbsForDrumFooter")).Text.Trim(); ;

                    WorkFullLengthLiningCatalystsGateway workFullLengthLiningCatalystsGateway = new WorkFullLengthLiningCatalystsGateway();
                    workFullLengthLiningCatalystsGateway.LoadByCatalystId(catalystId, companyId);
                    string name = workFullLengthLiningCatalystsGateway.GetName(catalystId);

                    FullLengthLiningWetOutCatalystsDetails model = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                    model.Insert(workId, catalystId, name, percentageByWeight, lbsForMixQuantity, lbsForDrum, deleted, companyId, inDatabase);

                    Session.Remove("wetOutCatalystsDetailsDummy");
                    Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                    Session["wetOutCatalystsDetails"] = fullLengthLiningTDS.WetOutCatalystsDetails;

                    grdCatalysts.DataBind();
                    grdCatalysts.PageIndex = grdCatalysts.PageCount - 1;
                }
            }
        }
Пример #2
0
        private void UpdateDatabase()
        {
            // Get ids & location
            int projectId = Int32.Parse(hdfCurrentProjectId.Value.Trim());
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(projectId);

            Int64 countryId = projectGateway.GetCountryID(projectId);
            Int64? provinceId = null; if (projectGateway.GetProvinceID(projectId).HasValue) provinceId = (Int64)projectGateway.GetProvinceID(projectId);
            Int64? countyId = null; if (projectGateway.GetCountyID(projectId).HasValue) countyId = (Int64)projectGateway.GetCountyID(projectId);
            Int64? cityId = null; if (projectGateway.GetCityID(projectId).HasValue) cityId = (Int64)projectGateway.GetCityID(projectId);

            string workType = hdfWorkType.Value.Trim();
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int workId = Int32.Parse(hdfWorkId.Value);
            int sectionAssetId = Int32.Parse(hdfAssetId.Value);
            bool isNewMeasuredFromDsmh = false;

            FullLengthLiningLateralDetails flLateralDetails = new FullLengthLiningLateralDetails();
            flLateralDetails.LoadForEdit(workId, sectionAssetId, companyId, projectId);

            if (flLateralDetails.Table.Rows.Count == 0)
            {
                if (ddlM1DataMeasuredFromMh.SelectedValue == "DSMH")
                {
                    isNewMeasuredFromDsmh = true;
                    FullLengthLiningLateralDetails fllLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                    fllLateralDetails.ModifyLateralId();
                }
            }

            DB.Open();
            DB.BeginTransaction();
            try
            {
                // Save lateral details
                // Save lateral details
                bool roboticPrepCompleted = ckbxPrepDataRoboticPrepCompleted.Checked;
                DateTime? roboticPrepCompletedCompleted = null; if (tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.HasValue) roboticPrepCompletedCompleted = tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.Value;

                FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                fullLengthLiningLateralDetails.Save(workId, projectId, sectionAssetId, countryId, provinceId, countyId, cityId, tbxVideoLength.Text.Trim(), companyId, isNewMeasuredFromDsmh, roboticPrepCompleted, roboticPrepCompletedCompleted);

                // Save catalyst details
                string newRunDetails = "";
                foreach (ListItem lst in cbxlSectionId.Items)
                {
                    if (lst.Selected)
                    {
                        newRunDetails = newRunDetails + lst.Value + ">";
                    }
                }
                newRunDetails = newRunDetails.Substring(0, newRunDetails.Length - 1);
                FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                fullLengthLiningWetOutCatalystsDetails.Save(companyId, newRunDetails, projectId);

                // Save section details
                FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS);
                fullLengthLiningSectionDetails.Save(countryId, provinceId, countyId, cityId, projectId, companyId);

                // Save work details
                FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS);
                fullLengthLiningWorkDetails.Save(countryId, provinceId, countyId, cityId, projectId, sectionAssetId, companyId, ckbxWetOutDataIncludeWetOutInformation.Checked, ckbxInversionDataIncludeInversionInformation.Checked);

                // Save material details
                string newMaterial = ddlM1DataMaterial.SelectedValue;

                if (ddlM1DataMaterial.SelectedIndex > 0)
                {
                    LfsAssetSewerLateralGateway lfsAssetSewertLateralGateway = new LfsAssetSewerLateralGateway(null);
                    if (!lfsAssetSewertLateralGateway.IsUsedInMaterials(sectionAssetId, newMaterial, companyId))
                    {
                        MaterialInformation materialInformation = new MaterialInformation(materialInformationTDS);
                        materialInformation.Save(companyId);
                    }
                }

                DB.CommitTransaction();

                // Store datasets
                fullLengthLiningTDS.AcceptChanges();
                Session["fullLengthLiningTDS"] = fullLengthLiningTDS;

                materialInformationTDS.AcceptChanges();
                Session["materialInformationTDS"] = materialInformationTDS;
            }
            catch (Exception ex)
            {
                DB.RollbackTransaction();

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }
Пример #3
0
        private bool Apply()
        {
            // Validate data
            bool validData = true;

            validData = ValidatePage();

            if (validData)
            {
                // Laterals Gridview
                // ... If the gridview is edition mode
                if (grdLaterals.EditIndex >= 0)
                {
                    grdLaterals.UpdateRow(grdLaterals.EditIndex, true);
                }

                // Save Lateral data
                GrdFLAddLateralsNewAdd();

                // Catalysts Gridview
                if (ckbxWetOutDataIncludeWetOutInformation.Checked)
                {
                    // ... If the gridview is edition mode
                    if (grdCatalysts.EditIndex >= 0)
                    {
                        grdCatalysts.UpdateRow(grdCatalysts.EditIndex, true);
                    }

                    // Save Lateral data
                    GrdCatalystsAdd();
                }

                // Save data
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int assetId = Int32.Parse(hdfAssetId.Value);
                int workId = Int32.Parse(hdfWorkId.Value);
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());

                // Get Section Details
                // ... FullLengthLiningSectionDetails data
                string newStreet = ""; if (tbxStreet.Text != "") newStreet = tbxStreet.Text.Trim();
                string newUsmh = ""; if (tbxUSMH.Text != "") newUsmh = tbxUSMH.Text.Trim();
                string newDsmh = ""; if (tbxDSMH.Text != "") newDsmh = tbxDSMH.Text.Trim();
                string newMapSize = ""; if (tbxMapSize.Text != "") newMapSize = tbxMapSize.Text.Trim();
                string newSize = ""; if (tbxConfirmedSize.Text != "") newSize = tbxConfirmedSize.Text.Trim();
                string newThickness = ""; if (ddlThickness.SelectedValue != "") newThickness = ddlThickness.SelectedValue;
                string newMapLength = ""; if (tbxMapLength.Text != "") newMapLength = tbxMapLength.Text.Trim();

                string newSteelTapeThroughSewer = "";
                string newLength = "";
                if (tbxM1DataSteelTapeThroughSewer.Text != "")
                {
                    newSteelTapeThroughSewer = tbxM1DataSteelTapeThroughSewer.Text.Trim();
                    newLength = tbxM1DataSteelTapeThroughSewer.Text.Trim();
                }

                int? newLaterals = null; if (tbxLaterals.Text != "") newLaterals = Int32.Parse(tbxLaterals.Text.Trim());
                int? newLiveLaterals = null; if (tbxLiveLaterals.Text != "") newLiveLaterals = Int32.Parse(tbxLiveLaterals.Text.Trim());

                // Get m1 data
                // ... assetSewerSection data
                string newUsmhDepth = ""; if ((tbxM1DataUsmhDepth.Text != "") && (tbxUSMH.Text != "")) newUsmhDepth = tbxM1DataUsmhDepth.Text.Trim();
                string newDsmhDepth = ""; if ((tbxM1DataDsmhDepth.Text != "") && (tbxDSMH.Text != "")) newDsmhDepth = tbxM1DataDsmhDepth.Text.Trim();

                // ... lfsAssetSewerSection data
                string newUsmhMouth12 = ""; if ((tbxM1DataUsmhMouth12.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth12 = tbxM1DataUsmhMouth12.Text.Trim();
                string newUsmhMouth1 = ""; if ((tbxM1DataUsmhMouth1.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth1 = tbxM1DataUsmhMouth1.Text.Trim();
                string newUsmhMouth2 = ""; if ((tbxM1DataUsmhMouth2.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth2 = tbxM1DataUsmhMouth2.Text.Trim();
                string newUsmhMouth3 = ""; if ((tbxM1DataUsmhMouth3.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth3 = tbxM1DataUsmhMouth3.Text.Trim();
                string newUsmhMouth4 = ""; if ((tbxM1DataUsmhMouth4.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth4 = tbxM1DataUsmhMouth4.Text.Trim();
                string newUsmhMouth5 = ""; if ((tbxM1DataUsmhMouth5.Text != "") && (tbxUSMH.Text != "")) newUsmhMouth5 = tbxM1DataUsmhMouth5.Text.Trim();
                string newDsmhMouth12 = ""; if ((tbxM1DataDsmhMouth12.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth12 = tbxM1DataDsmhMouth12.Text.Trim();
                string newDsmhMouth1 = ""; if ((tbxM1DataDsmhMouth1.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth1 = tbxM1DataDsmhMouth1.Text.Trim();
                string newDsmhMouth2 = ""; if ((tbxM1DataDsmhMouth2.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth2 = tbxM1DataDsmhMouth2.Text.Trim();
                string newDsmhMouth3 = ""; if ((tbxM1DataDsmhMouth3.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth3 = tbxM1DataDsmhMouth3.Text.Trim();
                string newDsmhMouth4 = ""; if ((tbxM1DataDsmhMouth4.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth4 = tbxM1DataDsmhMouth4.Text.Trim();
                string newDsmhMouth5 = ""; if ((tbxM1DataDsmhMouth5.Text != "") && (tbxDSMH.Text != "")) newDsmhMouth5 = tbxM1DataDsmhMouth5.Text.Trim();
                string newGeneralSubArea = ""; if (tbxGeneralSubArea.Text != "") newGeneralSubArea = tbxGeneralSubArea.Text.Trim();

                // ... assetSewerMH data
                string newUsmhAddress = ""; if (tbxM1DataUsmhAddress.Text != "") newUsmhAddress = tbxM1DataUsmhAddress.Text.Trim();
                string newDsmhAddress = ""; if (tbxM1DataDsmhAddress.Text != "") newDsmhAddress = tbxM1DataDsmhAddress.Text.Trim();

                // Update section details
                FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS);
                fullLengthLiningSectionDetails.Update(workId, assetId, newStreet, newMapSize, newSize, newMapLength, newLength, newLaterals, newLiveLaterals, newUsmhDepth, newDsmhDepth, newSteelTapeThroughSewer, newUsmhMouth12, newUsmhMouth1, newUsmhMouth2, newUsmhMouth3, newUsmhMouth4, newUsmhMouth5, newDsmhMouth12, newDsmhMouth1, newDsmhMouth2, newDsmhMouth3, newDsmhMouth4, newDsmhMouth5, newUsmh, newDsmh, newUsmhAddress, newDsmhAddress, newGeneralSubArea, newThickness);

                // Get generalData
                // ... Ra new data
                DateTime? newPreFlushDate = null;
                if (tkrdpGeneralPreFlushDate.Visible == true)
                {
                    if (tkrdpGeneralPreFlushDate.SelectedDate.HasValue)
                    {
                        newPreFlushDate = tkrdpGeneralPreFlushDate.SelectedDate.Value;
                    }
                }
                else
                {
                    if (tkrdpGeneralPreFlushDateReadOnly.SelectedDate.HasValue)
                    {
                        newPreFlushDate = tkrdpGeneralPreFlushDateReadOnly.SelectedDate.Value;
                    }
                }

                DateTime? newPreVideoDate = null;
                if (tkrdpGeneralPreVideoDate.Visible == true)
                {
                    if (tkrdpGeneralPreVideoDate.SelectedDate.HasValue)
                    {
                        newPreVideoDate = tkrdpGeneralPreVideoDate.SelectedDate.Value;
                    }
                }
                else
                {
                    if (tkrdpGeneralPreVideoDateReadOnly.SelectedDate.HasValue)
                    {
                        newPreVideoDate = tkrdpGeneralPreVideoDateReadOnly.SelectedDate.Value; ;
                    }
                }

                // ... FullLengthLining data
                string newGeneralClientId = ""; if (tbxGeneralClientId.Text != "") newGeneralClientId = tbxGeneralClientId.Text.Trim();
                DateTime? newGeneralProposedLiningDate = null; if (tkrdpGeneralProposedLiningDate.SelectedDate.HasValue) newGeneralProposedLiningDate = tkrdpGeneralProposedLiningDate.SelectedDate.Value;
                DateTime? newGeneralDeadlineLiningDate = null; if (tkrdpGeneralDeadlineLiningDate.SelectedDate.HasValue) newGeneralDeadlineLiningDate = tkrdpGeneralDeadlineLiningDate.SelectedDate.Value;
                DateTime? newGeneralP1Date = null; if (tkrdpPrepDataP1Date.SelectedDate.HasValue) newGeneralP1Date = tkrdpPrepDataP1Date.SelectedDate.Value;
                DateTime? newGeneralM1Date = null; if (tkrdpM1DataM1Date.SelectedDate.HasValue) newGeneralM1Date = tkrdpM1DataM1Date.SelectedDate.Value;
                DateTime? newGeneralM2Date = null; if (tkrdpM2DataM2Date.SelectedDate.HasValue) newGeneralM2Date = tkrdpM2DataM2Date.SelectedDate.Value;
                DateTime? newGeneralInstallDate = null; if (tkrdpInstallDataInstallDate.SelectedDate.HasValue) newGeneralInstallDate = tkrdpInstallDataInstallDate.SelectedDate.Value;
                DateTime? newGeneralFinalVideo = null; if (tkrdpInstallDataFinalVideoDate.SelectedDate.HasValue) newGeneralFinalVideo = tkrdpInstallDataFinalVideoDate.SelectedDate.Value;
                bool newGeneralIssueIdentified = ckbxGeneralIssueIdentified.Checked;
                bool newGeneralLfsIssue = ckbxGeneralLfsIssue.Checked;
                bool newGeneralClientIssue = ckbxGeneralClientIssue.Checked;
                bool newGeneralSalesIssue = ckbxGeneralSalesIssue.Checked;
                bool newGeneralIssueGivenToClient = ckbxGeneralIssueGivenToClient.Checked;
                bool newGeneralIssueResolved = ckbxGeneralIssueResolved.Checked;
                bool newGeneralIssueInvestigation = ckbxGeneralIssueInvestigation.Checked;
                int? newPrepDataCXIsRemoved = null; if (tbxPrepDataCXIsRemoved.Text != "") newPrepDataCXIsRemoved = Int32.Parse(tbxPrepDataCXIsRemoved.Text.Trim());
                bool newRoboticPrepCompleted = ckbxPrepDataRoboticPrepCompleted.Checked;
                DateTime? newRoboticPrepCompletedDate = null; if (tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.HasValue) newRoboticPrepCompletedDate = tkrdpPrepDataRoboticPrepCompletedDate.SelectedDate.Value;
                bool newP1Completed = ckbxPrepDataP1Completed.Checked;

                // ... WorkFullLengthLiningM1 data
                string newMeasurementsTakenBy = ""; if (tbxM1DataMeasurementsTakenBy.Text != "") newMeasurementsTakenBy = tbxM1DataMeasurementsTakenBy.Text.Trim();
                string newMaterial = ddlM1DataMaterial.SelectedValue;
                string newTrafficControl = ddlM1DataTrafficControl.SelectedValue;
                string newSiteDetails = ""; if (ddlM1DataSiteDetails.SelectedValue != "(Select)") newSiteDetails = ddlM1DataSiteDetails.SelectedValue;
                bool newPipeSizeChange = ckbxM1DataPipeSizeChange.Checked;
                bool newStandardByPass = ckbxM1DataStandardBypass.Checked;
                string newStandardBypassComments = ""; if (tbxM1DataStandardBypassComments.Text != "") newStandardBypassComments = tbxM1DataStandardBypassComments.Text.Trim();
                string newTrafficControlDetails = ""; if (tbxM1DataTrafficControlDetails.Text != "") newTrafficControlDetails = tbxM1DataTrafficControlDetails.Text.Trim();
                string newMeasurementType = ddlM1DataMeasurementType.SelectedValue;
                string newMeasuredFromMh = ""; if (tbxM1DataMeasuredFromMh.Visible) newMeasuredFromMh = tbxM1DataMeasuredFromMh.Text; else newMeasuredFromMh = ddlM1DataMeasuredFromMh.SelectedValue;
                string newVideoDoneFromMh = ""; if (tbxM1DataVideoDoneFromMh.Visible) newVideoDoneFromMh = tbxM1DataVideoDoneFromMh.Text; else newVideoDoneFromMh = ddlM1DataVideoDoneFromMh.SelectedValue;
                string newVideoDoneToMh = ""; if (tbxM1DataVideoDoneToMh.Visible) newVideoDoneToMh = tbxM1DataVideoDoneToMh.Text; else newVideoDoneToMh = ddlM1DataVideoDoneToMh.SelectedValue;
                string newAccessType = ""; if (ddlM1DataAccessType.SelectedValue != "(Select)") newAccessType = ddlM1DataAccessType.SelectedValue;

                // ... ... For header values
                string newVideoLength = tbxVideoLength.Text.Trim();

                // ... WorkFullLengthLiningM2 data
                string newMeasurementTakenByM2 = tbxM2DataMeasurementsTakenBy.Text.Trim();
                bool newDropPipe = ckbxM2DataDropPipe.Checked;
                string newDropPipeInvertDepth = tbxM2DataDropPipeInvertdepth.Text.Trim();
                int? newCappedLaterals = null; if (tbxM2DataCappedLaterals.Text != "") newCappedLaterals = Int32.Parse(tbxM2DataCappedLaterals.Text.Trim());
                string newLineWidthId = ""; if (tbxM2DataLineWidthId.Text != "") newLineWidthId = tbxM2DataLineWidthId.Text.Trim();
                string newHydrantAddress = ""; if (tbxM2DataHydrantAddress.Text != "") newHydrantAddress = tbxM2DataHydrantAddress.Text.Trim();
                string newHydroWireWithin10FtOfInversionMH = ddlM2DataHydroWireWithin10FtOfInversionMh.SelectedValue.Trim();
                string newDistanceToInversionMH = ""; if (tbxM2DataDistanceToInversionMH.Text != "") newDistanceToInversionMH = tbxM2DataDistanceToInversionMH.Text.Trim();
                string newSurfaceGrade = ""; if (ddlM2DataSurfaceGrade.SelectedValue != "(Select)") newSurfaceGrade = ddlM2DataSurfaceGrade.SelectedValue;
                bool newHydroPulley = cbxM2DataHydroPulley.Checked;
                bool newFridgeCart = cbxM2DataFridgeCart.Checked;
                bool newTwoPump = cbxM2DataTwoPump.Checked;
                bool newSixBypass = cbxM2DataSixBypass.Checked;
                bool newScaffolding = cbxM2DataScaffolding.Checked;
                bool newWinchExtension = cbxM2DataWinchExtension.Checked;
                bool newExtraGenerator = cbxM2DataExtraGenerator.Checked;
                bool newGreyCableExtension = cbxM2DataGreyCableExtension.Checked;
                bool newEasementMats = cbxM2DataEasementMats.Checked;
                bool newRampsRequired = cbxM2DataRampsRequired.Checked;
                bool newCameraSkid = cbxM2DataCameraSkid.Checked;

                // ... Update work details
                FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS);

                // ... ... If it doen's have wet out information
                if (!ckbxWetOutDataIncludeWetOutInformation.Checked)
                {
                    fullLengthLiningWorkDetails.Update(workId, newGeneralClientId, newGeneralProposedLiningDate, newGeneralDeadlineLiningDate, newGeneralP1Date, newGeneralM1Date, newGeneralM2Date, newGeneralInstallDate, newGeneralFinalVideo, newGeneralIssueIdentified, newGeneralLfsIssue, newGeneralClientIssue, newGeneralSalesIssue, newGeneralIssueGivenToClient, newGeneralIssueResolved, newGeneralIssueInvestigation, newPrepDataCXIsRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementsTakenBy, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardByPass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasuredFromMh, newVideoDoneFromMh, newVideoDoneToMh, newMeasurementTakenByM2, newDropPipe, newDropPipeInvertDepth, newCappedLaterals, newLineWidthId, newHydrantAddress, newHydroWireWithin10FtOfInversionMH, newDistanceToInversionMH, newSurfaceGrade, newHydroPulley, newFridgeCart, newTwoPump, newSixBypass, newScaffolding, newWinchExtension, newExtraGenerator, newGreyCableExtension, newEasementMats, newRampsRequired, newVideoLength, newPreFlushDate, newPreVideoDate, newCameraSkid, newAccessType, newP1Completed);
                }
                else
                {
                    // Wet out data
                    string newLinerTuber = "";
                    int newResinId = 0;
                    decimal newExcessResin = 0;
                    string newPoundsDrums = "";
                    decimal newDrumDiameter = 0;
                    decimal newHoistMaximumHeight = 0;
                    decimal newHoistMinimumHeight = 0;
                    decimal newDownDropTubeLenght = 0;
                    decimal newPumpHeightAboveGround = 0;
                    int newTubeResinToFeltFactor = 0;
                    DateTime newDateOfSheet = DateTime.Now;
                    int newEmployeeID = 0;
                    string newRunDetails = "";
                    string newRunDetails2 = "";
                    DateTime newWetOutDate = DateTime.Now;
                    DateTime? newInstallDate = null;
                    string newInversionThickness = "";
                    Distance lengthToLine = new Distance("0");
                    decimal newLengthToLine = 0;
                    decimal newPlusExtra = 0;
                    decimal newForTurnOffset = 0;
                    decimal newLengthToWetOut = 0;

                    decimal newTubeMaxColdHead = 0;
                    decimal newTubeMaxColdHeadPsi = 0;
                    decimal newTubeMaxHotHead = 0;
                    decimal newTubeMaxHotHeadPsi = 0;
                    decimal newTubeIdealHead = 0;
                    decimal newTubeIdealHeadPsi = 0;

                    decimal newNetResinForTube = 0;
                    decimal newNetResinForTubeUsgals = 0;
                    string newNetResinForTubeDrumsIns = "";
                    decimal newNetResinForTubeLbsFt = 0;
                    decimal newNetResinForTubeUsgFt = 0;

                    int newExtraResinForMix = 0;
                    decimal newExtraLbsForMix = 0;
                    decimal newTotalMixQuantity = 0;
                    decimal newTotalMixQuantityUsgals = 0;
                    string newTotalMixQuantityDrumsIns = "";

                    string newInversionType = "";
                    decimal newDepthOfInversionMH = 0;
                    decimal newTubeForColumn = 0;
                    decimal newTubeForStartDry = 0;
                    decimal newTotalTube = 0;
                    string newDropTubeConnects = "";
                    decimal newAllowsHeadTo = 0;
                    decimal newRollerGap = 0;

                    decimal newHeightNeeded = 0;
                    string newAvailable = "";
                    string newHoistHeight = "";
                    string newCommentsCipp = "";

                    string newResinLabel = "";
                    string newDrumContainsLabel = "";
                    string newLinerTubeLabel = "";
                    string newForLbDrumsLabel = "";
                    string newNetResinLabel = "";
                    string newCatalystLabel = "";

                    if (ckbxWetOutDataIncludeWetOutInformation.Checked)
                    {
                        // .... ... Wet Out Sheet
                        newLinerTuber = ddlWetOutDataLinerTube.SelectedValue;
                        newResinId = Int32.Parse(ddlWetOutDataResins.SelectedValue);
                        newExcessResin = decimal.Round(decimal.Parse(tbxWetOutDataExcessResin.Text), 1);
                        newPoundsDrums = ddlWetOutDataPoundsDrums.SelectedValue;
                        newDrumDiameter = decimal.Round(decimal.Parse(tbxWetOutDataDrumDiameter.Text), 1);
                        newHoistMaximumHeight = decimal.Round(decimal.Parse(tbxWetOutDataHoistMaximumHeight.Text), 0);
                        newHoistMinimumHeight = decimal.Round(decimal.Parse(tbxWetOutDataHoistMinimumHeight.Text), 0);
                        newDownDropTubeLenght = decimal.Round(decimal.Parse(tbxWetOutDataDownDropTubeLength.Text), 0);
                        newPumpHeightAboveGround = decimal.Round(decimal.Parse(tbxWetOutDataPumpHeightAboveGround.Text), 2);
                        newTubeResinToFeltFactor = Int32.Parse(tbxWetOutDataTubeResinToFeltFactor.Text);

                        newDateOfSheet = DateTime.Parse(tbxWetOutDataDateOfSheet.Text);
                        newEmployeeID = Int32.Parse(ddlWetOutDataMadeBy.SelectedValue);

                        foreach (ListItem lst in cbxlSectionId.Items)
                        {
                            if (lst.Selected)
                            {
                                newRunDetails = newRunDetails + lst.Value + ">";
                            }
                        }
                        newRunDetails = newRunDetails.Substring(0, newRunDetails.Length - 1);

                        newRunDetails2 = ddlWetOutDataRunDetails2.SelectedValue;
                        newWetOutDate = (DateTime)tkrdpWetOutDataWetOutDate.SelectedDate;

                        if (tkrdpInstallDataInstallDate.SelectedDate.ToString() != "")
                        {
                            newInstallDate = (DateTime)tkrdpInstallDataInstallDate.SelectedDate;
                        }

                        newInversionThickness = ddlThickness.SelectedValue;
                        lengthToLine = new Distance(tbxWetOutDataLengthToLine.Text);
                        newLengthToLine = decimal.Round(decimal.Parse(lengthToLine.ToStringInEng3()), 1);
                        newPlusExtra = decimal.Round(decimal.Parse(tbxWetOutDataPlusExtra.Text), 0);
                        newForTurnOffset = decimal.Round(decimal.Parse(tbxWetOutDataForTurnOffset.Text), 0);
                        newLengthToWetOut = decimal.Round(decimal.Parse(tbxWetOutDataLengthtToWetOut.Text), 1);

                        newTubeMaxColdHead = decimal.Round(decimal.Parse(tbxWetOutDataTubeMaxColdHead.Text), 1);
                        newTubeMaxColdHeadPsi = decimal.Round(decimal.Parse(tbxWetOutDataTubeMaxColdHeadPSI.Text), 1);
                        newTubeMaxHotHead = decimal.Round(decimal.Parse(tbxWetOutDataTubeMaxHotHead.Text), 1);
                        newTubeMaxHotHeadPsi = decimal.Round(decimal.Parse(tbxWetOutDataTubeMaxHotHeadPSI.Text), 1);
                        newTubeIdealHead = decimal.Round(decimal.Parse(tbxWetOutDataTubeIdealHead.Text), 1);
                        newTubeIdealHeadPsi = decimal.Round(decimal.Parse(tbxWetOutDataTubeIdealHeadPSI.Text), 1);

                        newNetResinForTube = decimal.Round(decimal.Parse(tbxWetOutDataNetResinForTube.Text), 0);
                        newNetResinForTubeUsgals = decimal.Round(decimal.Parse(tbxWetOutDataNetResinForTubeUsgals.Text), 1);
                        newNetResinForTubeDrumsIns = tbxWetOutDataNetResinForTubeDrumsIns.Text;
                        newNetResinForTubeLbsFt = decimal.Round(decimal.Parse(tbxWetOutDataNetResinForTubeLbsFt.Text), 2);
                        newNetResinForTubeUsgFt = decimal.Round(decimal.Parse(tbxWetOutDataNetResinForTubeUsgFt.Text), 3);

                        newExtraResinForMix = Int32.Parse(tbxWetOutDataExtraResinForMix.Text);
                        newExtraLbsForMix = decimal.Round(decimal.Parse(tbxWetOutDataExtraLbsForMix.Text), 2);
                        newTotalMixQuantity = decimal.Round(decimal.Parse(tbxWetOutDataTotalMixQuantity.Text), 0);
                        newTotalMixQuantityUsgals = decimal.Round(decimal.Parse(tbxWetOutDataTotalMixQuantityUsgals.Text), 1);
                        newTotalMixQuantityDrumsIns = tbxWetOutDataTotalMixQuantityDrumsIns.Text;

                        newInversionType = ddlWetOutDataInversionType.SelectedValue;
                        newDepthOfInversionMH = decimal.Round(decimal.Parse(tbxWetOutDataDepthOfInversionMH.Text), 0);
                        newTubeForColumn = decimal.Round(decimal.Parse(tbxWetOutDataTubeForColumn.Text), 0);
                        newTubeForStartDry = decimal.Round(decimal.Parse(tbxWetOutDataTubeForStartDry.Text), 0);
                        newTotalTube = decimal.Round(decimal.Parse(tbxWetOutDataTotalTube.Text), 1);
                        newDropTubeConnects = tbxWetOutDataDropTubeConnects.Text;
                        newAllowsHeadTo = decimal.Round(decimal.Parse(tbxWetOutDataAllowsHeadTo.Text), 0);
                        newRollerGap = decimal.Round(decimal.Parse(tbxWetOutDataRollerGap.Text), 0);

                        newHeightNeeded = decimal.Round(decimal.Parse(tbxWetOutDataHeightNeeded.Text), 0);
                        newAvailable = tbxWetOutDataAvailable.Text;
                        newHoistHeight = tbxWetOutDataHoistHeight.Text;
                        newCommentsCipp = tbxWetOutDataNotes.Text;

                        newResinLabel = lblWetOutDataResinGray.Text;
                        newDrumContainsLabel = lblWetOutDataDrumContainsGray.Text;
                        newLinerTubeLabel = lblWetOutDataLinerTubeGray.Text;
                        newForLbDrumsLabel = lblWetOutDataLbDrumsGrey.Text;
                        newNetResinLabel = lblWetOutDataNetResinGrey.Text;
                        newCatalystLabel = lblWetOutDataCatalystGrey.Text;
                    }

                    // Inversion data
                    string newInversionComment = "";
                    string newPipeType = "";
                    string newPipeCondition = "";
                    string newGroundMoisture = "";
                    decimal newBoilerSize = 0;
                    decimal newPumpTotalCapacity = 0;
                    decimal newLayFlatSize = 0;
                    decimal newLayFlatQuantityTotal = 0;

                    decimal newWaterStartTemp = 0;
                    decimal newTemp1 = 0;
                    decimal newHoldAtT1 = 0;
                    decimal newTempT2 = 0;
                    decimal newCookAtT2 = 0;
                    decimal newCoolDownFor = 0;
                    decimal newCoolToTemp = 0;
                    decimal newDropInPipeRun = 0;
                    decimal newPipeSlopOf = 0;

                    decimal newF45F120 = 0;
                    decimal newHold = 0;
                    decimal newF120F185 = 0;
                    decimal newCookTime = 0;
                    decimal newCoolTime = 0;
                    decimal newAproxTotal = 0;

                    decimal newWaterChangesPerHour = 0;
                    decimal newReturnWaterVelocity = 0;
                    decimal newLayflatBackPressure = 0;
                    decimal newPumpLiftAtIdealHead = 0;
                    decimal newWaterToFillLinerColumn = 0;
                    decimal newWaterPerFit = 0;
                    string newInstallationResults = "";
                    string newInversionLinerTubeLabel = "";
                    string newHeadsIdealLabel = "";
                    string newPumpingAndCirculationLabel = "";

                    if ((ckbxInversionDataIncludeInversionInformation.Checked) && (ckbxWetOutDataIncludeWetOutInformation.Checked))
                    {
                        // .... ... Inversion data
                        newInversionComment = tbxInversionDataCommentsEdit.Text;
                        newPipeType = ddlInversionDataInversionPipeType.SelectedValue;
                        newPipeCondition = ddlInversionDataPipeCondition.SelectedValue;
                        newGroundMoisture = ddlInversionDataGroundMoisture.SelectedValue;
                        newBoilerSize = decimal.Round(decimal.Parse(tbxInversionDataBoilerSize.Text), 0);
                        newPumpTotalCapacity = decimal.Round(decimal.Parse(tbxInversionDataPumpsTotalCapacity.Text), 0);
                        newLayFlatSize = decimal.Round(decimal.Parse(tbxInversionDataLayflatSize.Text), 0);
                        newLayFlatQuantityTotal = decimal.Round(decimal.Parse(tbxInversionDataLayflatQuantityTotal.Text), 0);

                        newWaterStartTemp = decimal.Round(decimal.Parse(tbxInversionDataWaterStartTempTs.Text), 0);
                        newTemp1 = decimal.Round(decimal.Parse(tbxInversionDataTempT1.Text), 0);
                        newHoldAtT1 = decimal.Round(decimal.Parse(tbxInversionDataHoldAtT1For.Text), 1);
                        newTempT2 = decimal.Round(decimal.Parse(tbxInversionDataTempT2.Text), 0);
                        newCookAtT2 = decimal.Round(decimal.Parse(tbxInversionDataCookAtT2For.Text), 0);
                        newCoolDownFor = decimal.Round(decimal.Parse(tbxInversionDataCoolDownFor.Text), 0);
                        newCoolToTemp = decimal.Round(decimal.Parse(tbxInversionDataCoolToTemp.Text), 0);
                        newDropInPipeRun = decimal.Round(decimal.Parse(tbxInversionDataDropInPipeRun.Text), 1);
                        newPipeSlopOf = decimal.Round(decimal.Parse(tbxInversionDataPipeSlopeOf.Text), 2);

                        newF45F120 = decimal.Round(decimal.Parse(tbxInversionData45F120F.Text), 1);
                        newHold = decimal.Round(decimal.Parse(tbxInversionDataHold.Text), 1);
                        newF120F185 = decimal.Round(decimal.Parse(tbxInversionData120F185F.Text), 1);
                        newCookTime = decimal.Round(decimal.Parse(tbxInversionDataCookTime.Text), 1);
                        newCoolTime = decimal.Round(decimal.Parse(tbxInversionDataCoolTime.Text), 1);
                        newAproxTotal = decimal.Round(decimal.Parse(tbxInversionDataAproxTotal.Text), 1);

                        newWaterChangesPerHour = decimal.Round(decimal.Parse(tbxInversionDataWaterChangesPerHour.Text), 2);
                        newReturnWaterVelocity = decimal.Round(decimal.Parse(tbxInversionDataReturnWaterVelocity.Text), 2);
                        newLayflatBackPressure = decimal.Round(decimal.Parse(tbxInversionDataLayflatBackPressure.Text), 1);
                        newPumpLiftAtIdealHead = decimal.Round(decimal.Parse(tbxInversionDataPumpLiftAtIdealHead.Text), 1);
                        newWaterToFillLinerColumn = decimal.Round(decimal.Parse(tbxInversionDataWaterToFillLinerColumn.Text), 0);
                        newWaterPerFit = decimal.Round(decimal.Parse(tbxInversionDataWaterPerFit.Text), 2);
                        newInstallationResults = tbxInversionDataNotesAndInstallationResults.Text;
                        newInversionLinerTubeLabel = lblInversionDataLinerInfoGrey.Text;
                        newHeadsIdealLabel = lblInversionDataHeadsGrey.Text;
                        newPumpingAndCirculationLabel = lblInversionDataPumpingCirculationSubtitle.Text;
                    }

                    // ... Update
                    fullLengthLiningWorkDetails.UpdateWithWetOutInformation(workId, newGeneralClientId, newGeneralProposedLiningDate, newGeneralDeadlineLiningDate, newGeneralP1Date, newGeneralM1Date, newGeneralM2Date, newGeneralInstallDate, newGeneralFinalVideo, newGeneralIssueIdentified, newGeneralLfsIssue, newGeneralClientIssue, newGeneralSalesIssue, newGeneralIssueGivenToClient, newGeneralIssueResolved, newGeneralIssueInvestigation, newPrepDataCXIsRemoved, newRoboticPrepCompleted, newRoboticPrepCompletedDate, newMeasurementsTakenBy, newMaterial, newTrafficControl, newSiteDetails, newPipeSizeChange, newStandardByPass, newStandardBypassComments, newTrafficControlDetails, newMeasurementType, newMeasuredFromMh, newVideoDoneFromMh, newVideoDoneToMh, newMeasurementTakenByM2, newDropPipe, newDropPipeInvertDepth, newCappedLaterals, newLineWidthId, newHydrantAddress, newHydroWireWithin10FtOfInversionMH, newDistanceToInversionMH, newSurfaceGrade, newHydroPulley, newFridgeCart, newTwoPump, newSixBypass, newScaffolding, newWinchExtension, newExtraGenerator, newGreyCableExtension, newEasementMats, newRampsRequired, newVideoLength, newPreFlushDate, newPreVideoDate, newCameraSkid, newLinerTuber, newResinId, newExcessResin, newPoundsDrums, newDrumDiameter, newHoistMaximumHeight, newHoistMinimumHeight, newDownDropTubeLenght, newPumpHeightAboveGround, newTubeResinToFeltFactor, newDateOfSheet, newEmployeeID, newRunDetails, newRunDetails2, newWetOutDate, newInstallDate, newInversionThickness, newLengthToLine, newPlusExtra, newForTurnOffset, newLengthToWetOut, newTubeMaxColdHead, newTubeMaxColdHeadPsi, newTubeMaxHotHead, newTubeMaxHotHeadPsi, newTubeIdealHead, newTubeIdealHeadPsi, newNetResinForTube, newNetResinForTubeUsgals, newNetResinForTubeDrumsIns, newNetResinForTubeLbsFt, newNetResinForTubeUsgFt, newExtraResinForMix, newExtraLbsForMix, newTotalMixQuantity, newTotalMixQuantityUsgals, newTotalMixQuantityDrumsIns, newInversionType, newDepthOfInversionMH, newTubeForColumn, newTubeForStartDry, newTotalTube, newDropTubeConnects, newAllowsHeadTo, newRollerGap, newHeightNeeded, newAvailable, newHoistHeight, newCommentsCipp, newResinLabel, newDrumContainsLabel, newLinerTubeLabel, newForLbDrumsLabel, newNetResinLabel, newCatalystLabel, newInversionComment, newPipeType, newPipeCondition, newGroundMoisture, newBoilerSize, newPumpTotalCapacity, newLayFlatSize, newLayFlatQuantityTotal, newWaterStartTemp, newTemp1, newHoldAtT1, newTempT2, newCookAtT2, newCoolDownFor, newCoolToTemp, newDropInPipeRun, newPipeSlopOf, newF45F120, newHold, newF120F185, newCookTime, newCoolTime, newAproxTotal, newWaterChangesPerHour, newReturnWaterVelocity, newLayflatBackPressure, newPumpLiftAtIdealHead, newWaterToFillLinerColumn, newWaterPerFit, newInstallationResults, newInversionLinerTubeLabel, newHeadsIdealLabel, newPumpingAndCirculationLabel, newAccessType, newP1Completed);
                }

                if (ddlM1DataMaterial.SelectedIndex > 0)
                {
                    LfsAssetSewerLateralGateway lfsAssetSewertLateralGateway = new LfsAssetSewerLateralGateway(null);
                    if (!lfsAssetSewertLateralGateway.IsUsedInMaterials(assetId, newMaterial, companyId))
                    {
                        MaterialInformation model = new MaterialInformation(materialInformationTDS);
                        model.Insert(assetId, newMaterial, DateTime.Now, false, companyId, false);
                    }
                }

                // Store datasets
                Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                Session["materialInformationTDS"] = materialInformationTDS;

                // Update database
                UpdateDatabase();

                // Restore datasets
                fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];

                fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId);
                fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);
                fullLengthLiningTDS.LateralDetails.Clear();
                FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId);
                grdLaterals.DataBind();

                fullLengthLiningTDS.WetOutCatalystsDetails.Clear();
                FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId);
                grdCatalysts.DataBind();

                // ... Store dataset
                Session["fullLengthLiningTDS"] = fullLengthLiningTDS;

                ViewState["update"] = "yes";
            }

            return validData;
        }
Пример #4
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            bool isFromTabClick = false;

            if (!IsPostBack)
            {
                if (!isFromTabClick)
                {
                    // Security check
                    if (!(Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_EDIT"])))
                    {
                        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_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in fl_edit.aspx");
                    }

                    // Tag Page
                    TagPage();

                    // Prepare initial data
                    Session.Remove("flAddLateralsNewDummy");
                    Session.Remove("wetOutCatalystsDetailsDummy");
                    Session.Remove("materialInformationTDS");

                    materialInformationTDS = new MaterialInformationTDS();

                    // ... for wet out section list
                    AssetSewerSectionList assetSewerSectionList = new AssetSewerSectionList();
                    assetSewerSectionList.LoadAndAddItem(Int32.Parse(hdfCurrentProjectId.Value), hdfWorkType.Value, "-1", "(All)", Int32.Parse(hdfCompanyId.Value));
                    cbxlSectionId.DataSource = assetSewerSectionList.Table;
                    cbxlSectionId.DataValueField = "SectionID";
                    cbxlSectionId.DataTextField = "FlowOrderID";
                    cbxlSectionId.DataBind();

                    cbxlInversionDataSectionId.DataSource = assetSewerSectionList.Table;
                    cbxlInversionDataSectionId.DataValueField = "SectionID";
                    cbxlInversionDataSectionId.DataTextField = "FlowOrderID";
                    cbxlInversionDataSectionId.DataBind();

                    // If coming from
                    int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                    int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                    int assetId = Int32.Parse(hdfAssetId.Value.Trim());
                    int workId = Int32.Parse(hdfWorkId.Value.Trim());
                    string workType = hdfWorkType.Value;

                    // ... fl_navigator2.aspx
                    if (Request.QueryString["source_page"] == "fl_navigator2.aspx")
                    {
                        StoreNavigatorState();
                        ViewState["update"] = "no";

                        // ... Set initial tab
                        if ((string)Session["dialogOpenedFll"] != "1")
                        {
                            hdfActiveTab.Value = Request.QueryString["active_tab"];

                            fullLengthLiningTDS = new FullLengthLiningTDS();

                            FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS);
                            fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId);

                            FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS);
                            fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                            FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                            fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId);

                            FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                            fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId);
                        }
                        else
                        {
                            hdfActiveTab.Value = (string)Session["activeTabFll"];

                            // Restore datasets
                            fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];
                        }

                        // ... Store dataset
                        Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                    }

                    // ... fl_summary.aspx or fl_edit.aspx
                    if ((Request.QueryString["source_page"] == "fl_summary.aspx") || (Request.QueryString["source_page"] == "fl_edit.aspx"))
                    {
                        StoreNavigatorState();
                        ViewState["update"] = Request.QueryString["update"];

                        // ... Restore dataset
                        fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];

                        // ... Set initial tab
                        if ((string)Session["dialogOpenedFll"] != "1")
                        {
                            hdfActiveTab.Value = Request.QueryString["active_tab"];
                        }
                        else
                        {
                            hdfActiveTab.Value = (string)Session["activeTabFll"];
                        }

                        if (ViewState["update"].ToString().Trim() == "yes")
                        {
                            FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS);
                            fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId);

                            FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS);
                            fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                            FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                            fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId);

                            FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                            fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId);

                            // ... Store dataset
                            Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                        }
                    }

                    // Prepare initial data
                    lblMissingData.Visible = false;

                    // Set initial tab
                    int activeTab = Int32.Parse(hdfActiveTab.Value);
                    tcFlDetails.ActiveTabIndex = activeTab;

                    // ... for client
                    int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                    CompaniesGateway companiesGateway = new CompaniesGateway();
                    companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                    lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                    // ... for project
                    ProjectGateway projectGateway = new ProjectGateway();
                    projectGateway.LoadByProjectId(currentProjectId);
                    string name = projectGateway.GetName(currentProjectId);
                    if (name.Length > 23) name = name.Substring(0, 20) + "...";
                    lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Section";

                    // ... Data for current full length lining work
                    LoadFullLengthLiningData(currentProjectId, assetId, companyId);

                    // Databind
                    Page.DataBind();

                    // Especial load for Run details
                    string runDetails = hdfRunDetails.Value;
                    WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGateway = new WorkFullLengthLiningWetOutGateway();
                    workFullLengthLiningWetOutGateway.LoadByWorkId(workId, companyId);

                    // ... Verify if work has cipp information to load run details
                    if (workFullLengthLiningWetOutGateway.Table.Rows.Count > 0)
                    {
                        string[] runDetailsList = runDetails.Split('>');
                        for (int i = 0; i < runDetailsList.Length; i++)
                        {
                            cbxlSectionId.Items.FindByValue(runDetailsList[i]).Selected = true;
                            cbxlInversionDataSectionId.Items.FindByValue(runDetailsList[i]).Selected = true;
                        }
                    }
                    else
                    {
                        if (cbxlSectionId.Items.Count > 1)
                        {
                            cbxlSectionId.Items.FindByValue(runDetails).Selected = true;
                        }
                    }

                    // SelectIndex for grids
                    ((DropDownList)grdLaterals.FooterRow.FindControl("ddlNewMaterial")).SelectedIndex = 0;
                    ((DropDownList)grdCatalysts.FooterRow.FindControl("ddlNameFooter")).SelectedIndex = 0;

                    // For usmh, dsmh autocomplete
                    string provinceId_ = "0"; if (hdfProvinceId.Value != "") provinceId_ = hdfProvinceId.Value;
                    string countyId_ = "0"; if (hdfCountyId.Value != "") countyId_ = hdfCountyId.Value;
                    string cityId_ = "0"; if (hdfCityId.Value != "") cityId_ = hdfCityId.Value;

                    aceUsmh.ContextKey = hdfCountryId.Value + "," + provinceId_ + "," + countyId_ + "," + cityId_ + "," + hdfCompanyId.Value;
                    aceDsmh.ContextKey = hdfCountryId.Value + "," + provinceId_ + "," + countyId_ + "," + cityId_ + "," + hdfCompanyId.Value;

                    // Make Wetout tab visible
                    if (ckbxWetOutDataIncludeWetOutInformation.Checked)
                    {
                        pnlVisibleInformation.Visible = true;
                        upnlVisibleInformation.Update();
                    }
                    else
                    {
                        pnlVisibleInformation.Visible = false;
                        upnlVisibleInformation.Update();
                    }

                    // Make inversion tab visible
                    lblInversionDataInversionMissingData.Visible = false;
                    uplInversionDataInversionMissingData.Update();
                    if (ckbxInversionDataIncludeInversionInformation.Checked)
                    {
                        // ... ... visible only if wet out information is provided.
                        if (!ckbxWetOutDataIncludeWetOutInformation.Checked)
                        {
                            pnlInversionVisibleInformation.Visible = false;
                            upnlInversionVisibleInformation.Update();
                        }
                        else
                        {

                            pnlInversionVisibleInformation.Visible = true;
                            upnlInversionVisibleInformation.Update();
                        }
                    }
                    else
                    {
                        pnlInversionVisibleInformation.Visible = false;
                        upnlInversionVisibleInformation.Update();
                    }

                    // Load Materials
                    MaterialInformationGateway materialInformationGateway = new MaterialInformationGateway(materialInformationTDS);
                    materialInformationGateway.LoadAllByAssetId(assetId, companyId);

                    materialInformation = materialInformationTDS.MaterialInformation;
                    Session["materialInformationTDS"] = materialInformationTDS;
                }
            }
            else
            {
                // Restore datasets
                fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];
                flatSectionJlTDSForFLL = (FlatSectionJlTDS)Session["flatSectionJlTDSForFLL"];
                materialInformationTDS = (MaterialInformationTDS)Session["materialInformationTDS"];
                materialInformation = materialInformationTDS.MaterialInformation;

                // Set initial tab
                int activeTab = Int32.Parse(hdfActiveTab.Value);
                tcFlDetails.ActiveTabIndex = activeTab;
            }
        }
Пример #5
0
        protected void grdCatalysts_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Page.Validate("catalystDataEdit");
            if (Page.IsValid)
            {
                int workId = (int)e.Keys["WorkID"];
                int refId = (int)e.Keys["RefID"];
                int companyId = Int32.Parse(hdfCompanyId.Value);

                decimal percentageByWeight = -1;
                if (((TextBox)grdCatalysts.Rows[e.RowIndex].Cells[3].FindControl("tbxPercentageByWeightEdit")).Text.Trim() != "")
                {
                    if ((Validator.IsValidDecimal(((TextBox)grdCatalysts.Rows[e.RowIndex].Cells[3].FindControl("tbxPercentageByWeightEdit")).Text.Trim())))
                    {
                        percentageByWeight = decimal.Round(decimal.Parse(((TextBox)grdCatalysts.Rows[e.RowIndex].Cells[3].FindControl("tbxPercentageByWeightEdit")).Text.Trim()), 2);
                    }
                }

                decimal lbsForMixQuantity = -1;
                if (((Label)grdCatalysts.Rows[e.RowIndex].Cells[4].FindControl("lblLbsForMixQuantityEdit")).Text.Trim() != "")
                {
                    if ((Validator.IsValidDecimal(((Label)grdCatalysts.Rows[e.RowIndex].Cells[4].FindControl("lblLbsForMixQuantityEdit")).Text.Trim())))
                    {
                        lbsForMixQuantity = decimal.Round(decimal.Parse(((Label)grdCatalysts.Rows[e.RowIndex].Cells[4].FindControl("lblLbsForMixQuantityEdit")).Text.Trim()), 2);
                    }
                }

                string lbsForDrum = ((Label)grdCatalysts.Rows[e.RowIndex].Cells[5].FindControl("lblLbsForDrumEdit")).Text.Trim(); ;

                FullLengthLiningWetOutCatalystsDetails model = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                model.Update(workId, refId, percentageByWeight, lbsForMixQuantity, lbsForDrum, companyId);

                // Store dataset
                Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                Session["wetOutCatalystsDetails"] = fullLengthLiningTDS.WetOutCatalystsDetails;
            }
            else
            {
                e.Cancel = true;
            }
        }
Пример #6
0
        protected void grdCatalysts_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            // Catalysts Gridview, if the gridview is edition mode
            if (grdCatalysts.EditIndex >= 0)
            {
                grdCatalysts.UpdateRow(grdCatalysts.EditIndex, true);
            }

            //Delete catalysts
            int workId = (int)e.Keys["WorkID"];
            int refId = (int)e.Keys["RefID"];
            int companyId = Int32.Parse(hdfCompanyId.Value);

            // Delete catalysts
            FullLengthLiningWetOutCatalystsDetails model = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
            model.Delete(workId, refId, companyId);

            // Store dataset
            Session["fullLengthLiningTDS"] = fullLengthLiningTDS;

            grdCatalysts.DataBind();
        }
Пример #7
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_EDIT"])))
                {
                    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_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in fl_summary.aspx");
                }

                // Tag Page
                TagPage();

                Session.Remove("flAddLateralsNewDummy");
                Session.Remove("wetOutCatalystsDetailsDummy");

                // If comming from
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                int assetId = Int32.Parse(hdfAssetId.Value.Trim());
                string workType = hdfWorkType.Value;
                int workId = Int32.Parse(hdfWorkId.Value);

                // ... fl_navigator2.aspx
                if (Request.QueryString["source_page"] == "fl_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";

                    // Set initial tab
                    if ((string)Session["dialogOpenedFll"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];

                        fullLengthLiningTDS = new FullLengthLiningTDS();

                        FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS);
                        fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId);

                        FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS);
                        fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                        FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                        fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId);

                        FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                        fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId);
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabFll"];

                        // Restore datasets
                        fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];
                    }

                    tcFlDetails.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                    // Store dataset
                    Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                }

                // ... fl_delete.aspx or fl_edit.aspx
                if ((Request.QueryString["source_page"] == "fl_delete.aspx") || (Request.QueryString["source_page"] == "fl_edit.aspx"))
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    // Restore dataset
                    fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];

                    // ... Set initial tab
                    if ((string)Session["dialogOpenedFll"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabFll"];
                    }

                    tcFlDetails.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);
                }

                // Prepare initial data
                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Section";

                // ... for wet out section list
                AssetSewerSectionList assetSewerSectionList = new AssetSewerSectionList();
                assetSewerSectionList.LoadAndAddItem(Int32.Parse(hdfCurrentProjectId.Value), hdfWorkType.Value, "-1", "(All)", Int32.Parse(hdfCompanyId.Value));
                cbxlWetOutDataSectionId.DataSource = assetSewerSectionList.Table;
                cbxlWetOutDataSectionId.DataValueField = "SectionID";
                cbxlWetOutDataSectionId.DataTextField = "FlowOrderID";
                cbxlWetOutDataSectionId.DataBind();

                cbxlInversionDataSectionId.DataSource = assetSewerSectionList.Table;
                cbxlInversionDataSectionId.DataValueField = "SectionID";
                cbxlInversionDataSectionId.DataTextField = "FlowOrderID";
                cbxlInversionDataSectionId.DataBind();

                // ... Data for current full length lining work
                LoadFullLengthLiningData(currentProjectId, assetId, companyId);

                // Databind
                Page.DataBind();

                // Especial load for Run details
                string runDetails = hdfRunDetails.Value;
                WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGateway = new WorkFullLengthLiningWetOutGateway();
                workFullLengthLiningWetOutGateway.LoadByWorkId(workId, companyId);

                // ... Verify if work has cipp information to load run details
                if (workFullLengthLiningWetOutGateway.Table.Rows.Count > 0)
                {
                    string[] runDetailsList = runDetails.Split('>');
                    for (int i = 0; i < runDetailsList.Length; i++)
                    {
                        cbxlWetOutDataSectionId.Items.FindByValue(runDetailsList[i]).Selected = true;
                        cbxlInversionDataSectionId.Items.FindByValue(runDetailsList[i]).Selected = true;
                    }
                }
                else
                {
                    if (cbxlWetOutDataSectionId.Items.Count > 1)
                    {
                        cbxlWetOutDataSectionId.Items.FindByValue(hdfSectionId.Value).Selected = true;
                    }
                }
            }
            else
            {
                // Restore datasets
                fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];

                // Set initial tab
                int activeTab = Int32.Parse(hdfActiveTab.Value);
                tcFlDetails.ActiveTabIndex = activeTab;

                // Load summary for inversionfield cure record
                int companyId =Int32.Parse(hdfCompanyId.Value);
                int workId = Int32.Parse(hdfWorkId.Value);

                FlInversionFieldCureRecord FlInversionFieldCureRecordForSummary = new FlInversionFieldCureRecord();
                FlInversionFieldCureRecordForSummary.Load(workId, companyId);
                if (FlInversionFieldCureRecordForSummary.Table.Rows.Count > 0)
                {
                    lblInversionDataFieldCureRecordSummary.Text = FlInversionFieldCureRecordForSummary.GetSummary();
                }

            }
        }