예제 #1
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_POINTREPAIRS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_DELETE"])))
                {
                    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))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in pr_delete.aspx");
                }

                // Tag Page
                TagPage();

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

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                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";

                // If coming from
                // ... pr_navigator2.aspx
                if (Request.QueryString["source_page"] == "pr_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";

                    pointRepairsTDS = new PointRepairsTDS();

                    int workId = Int32.Parse(hdfWorkId.Value);
                    int assetId = Int32.Parse(hdfAssetId.Value);

                    PointRepairsSectionDetails pointRepairsSectionDetails = new PointRepairsSectionDetails(pointRepairsTDS);
                    pointRepairsSectionDetails.LoadByWorkId(workId, companyId);

                    PointRepairsWorkDetails pointRepairsWorkDetails = new PointRepairsWorkDetails(pointRepairsTDS);
                    pointRepairsWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                    PointRepairsRepairDetails pointRepairsRepairDetails = new PointRepairsRepairDetails(pointRepairsTDS);
                    pointRepairsRepairDetails.LoadAllByWorkId(workId, companyId);

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

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

                    // Restore dataset
                    pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"];
                }
            }
            else
            {
                // Restore datasets
                pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"];
            }
        }
예제 #2
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_POINTREPAIRS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_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 pr_summary.aspx");
                }

                // Tag Page
                TagPage();

                // 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);

                Session.Remove("pointRepairsRepairsTempDummy");
                Session.Remove("pointRepairsCommentsTempDummy");

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

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

                        pointRepairsTDS = new PointRepairsTDS();
                        pointRepairsRepairsTemp = new PointRepairsTDS.RepairDetailsDataTable();
                        pointRepairsCommentsTemp = new PointRepairsTDS.CommentDetailsDataTable();

                        PointRepairsSectionDetails pointRepairsSectionDetails = new PointRepairsSectionDetails(pointRepairsTDS);
                        pointRepairsSectionDetails.LoadByWorkId(workId, companyId);

                        PointRepairsWorkDetails pointRepairsWorkDetails = new PointRepairsWorkDetails(pointRepairsTDS);
                        pointRepairsWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                        PointRepairsRepairDetails pointRepairsRepairDetails = new PointRepairsRepairDetails(pointRepairsTDS);
                        pointRepairsRepairDetails.LoadAllByWorkId(workId, companyId);

                        PointRepairsCommentDetails pointRepairsCommentDetails = new PointRepairsCommentDetails(pointRepairsTDS);
                        pointRepairsCommentDetails.LoadAllByWorkIdWorkType(workId, companyId, "Point Repairs");
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabPr"];

                        // Restore datasets
                        pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"];
                        pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"];
                        pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"];
                    }

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

                    Session["filterExpression"] = "Deleted = 0";

                    // Store dataset
                    Session["pointRepairsTDS"] = pointRepairsTDS;
                    Session["pointRepairsRepairsTemp"] = pointRepairsRepairsTemp;
                    Session["pointRepairsCommentsTemp"] = pointRepairsCommentsTemp;
                }

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

                    // Restore dataset
                    pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"];
                    pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"];
                    pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"];

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

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

                    ApplyFilter();

                    switch ((string)Session["filterExpression"])
                    {
                        case "Deleted = 0":
                            ddlFilter.SelectedIndex = 0;
                            break;

                        case "Type='Robotic Reaming' AND Deleted = 0":
                            ddlFilter.SelectedIndex = 1;
                            break;

                        case "Type='Point Lining' AND Deleted = 0":
                            ddlFilter.SelectedIndex = 2;
                            break;

                        case "Type='Grouting' AND Deleted = 0":
                            ddlFilter.SelectedIndex = 3;
                            break;

                        default:
                            ddlFilter.SelectedIndex = 0;
                            break;
                    }
                }

                // 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";

                // ... Data for current point repairs work
                LoadPointRepairsData(currentProjectId, assetId, companyId);
            }
            else
            {
                // Restore datasets
                pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"];
                pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"];
                pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"];

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

                ApplyFilter();
            }
        }
예제 #3
0
        private void Save()
        {
            try
            {
                // Validate page
                // Add data if exist at grid's foot
                GrdSizeAdd();

                string sizeSelected = GetSize_();

                int workId = Int32.Parse(hdfWorkId.Value);
                int companyId = Int32.Parse(hdfCompanyId.Value);
                string repairPointId = hdfRepairPointId.Value;

                if (sizeSelected != "")
                {
                    PointRepairsRepairDetails model = new PointRepairsRepairDetails(pointRepairsTDS);
                    model.UpdateSizePointLining(workId, repairPointId, sizeSelected);
                }

                // Update data
                UpdateDatabase();

                Session["pointRepairsTDS"] = pointRepairsTDS;

                // If coming from
                // ... pr_edit.aspx
                if (Request.QueryString["source_page"] == "pr_edit.aspx")
                {
                    ViewState["update"] = "yes";
                    Response.Write("<script language='javascript'> {window.close();}</script>");
                }
            }
            catch
            {
                if (Request.QueryString["source_page"] == "pr_edit.aspx")
                {
                    ViewState["update"] = "yes";
                    Response.Write("<script language='javascript'> {window.close();}</script>");
                }
            }
        }
예제 #4
0
        private void Delete()
        {
            Page.Validate();

            if (Page.IsValid)
            {
                // Delete Point Repairs
                int workId = Int32.Parse(hdfWorkId.Value);

                PointRepairsSectionDetails pointRepairsSectionDetails = new PointRepairsSectionDetails(pointRepairsTDS);
                pointRepairsSectionDetails.Delete(workId);

                PointRepairsRepairDetails pointRepairsRepairDetails = new PointRepairsRepairDetails(pointRepairsTDS);
                pointRepairsRepairDetails.DeleteAll();

                PointRepairsWorkDetails pointRepairsWorkDetails = new PointRepairsWorkDetails(pointRepairsTDS);
                pointRepairsWorkDetails.Delete(workId);

                // Update database
                UpdateDatabase();

                // Store datasets
                Session["pointRepairsTDS"] = pointRepairsTDS;

                // Redirect
                string url = "";
                url = "./pr_navigator2.aspx?source_page=pr_delete.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + GetNavigatorState() + "&update=yes";
                Response.Redirect(url);
            }
        }
예제 #5
0
        protected void grdRepairs_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Page.Validate("repairsDataEdit");

            if (Page.IsValid)
            {
                PointRepairsRepairDetails model = new PointRepairsRepairDetails(pointRepairsTDS);

                int workId = (int)e.Keys["WorkID"];
                string repairPointId = e.Keys["RepairPointID"].ToString();
                string type = ((Label)grdRepairs.Rows[e.RowIndex].Cells[2].FindControl("lblRepairType")).Text.Trim();

                switch (type)
                {
                    case "Robotic Reaming":
                        string rmReamDistance = ((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxRmReamDistanceEdit")).Text.Trim();
                        DateTime? rmReamDate = null; if (((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpRmReamDateEdit")).SelectedDate.HasValue) rmReamDate = ((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpRmReamDateEdit")).SelectedDate.Value;
                        bool rmExtraRepair = ((CheckBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("cbxRmExtraRepairEdit")).Checked;
                        bool rmCancelled = ((CheckBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("cbxRmCancelledEdit")).Checked;
                        string rmApproval = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlRmApprovalEdit")).SelectedValue.ToString().Trim();
                        string rmComments = ((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxRmCommentsEdit")).Text.Trim();
                        string rmDefectQualifier = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlRmDefectQualifierEdit")).SelectedValue;
                        string rmDefectDetails = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlRmDefectDetailsEdit")).SelectedValue;
                        DateTime? rmReinstateDate = null; if (((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpRmReinstateDateEdit")).SelectedDate.HasValue) rmReinstateDate = ((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpRmReinstateDateEdit")).SelectedDate.Value;

                        model.UpdateRoboticReaming(workId, repairPointId, rmReamDistance, rmReamDate, rmExtraRepair, rmCancelled, rmApproval, rmComments, rmDefectQualifier, rmDefectDetails, rmReinstateDate);
                        break;

                    case "Point Lining":
                        string plLinerDistance = ((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxPlLinerDistanceEdit")).Text.Trim();
                        string plDirection = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlDirectionEdit")).SelectedValue.ToString().Trim();
                        int? plReinstates = null; if (((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxPlReinstatesEdit")).Text.Trim() != "") plReinstates = Int32.Parse(((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxPlReinstatesEdit")).Text.Trim());
                        string plLtmh = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlLtmhEdit")).SelectedValue;
                        string plVtmh = "";
                        if (plLtmh != "")
                        {
                            int selectedIndex = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlLtmhEdit")).SelectedIndex;

                            if (selectedIndex == 1)
                            {
                                plVtmh = hdfDSMH.Value;
                            }
                            else
                            {
                                plVtmh = hdfUSMH.Value;
                            }
                        }
                        string plDistance = ((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxPlDistanceEdit")).Text.Trim();
                        string plSize_ = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlSize_Edit")).SelectedValue.ToString().Trim();
                        DateTime? plInstallDate = null; if (((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpPlInstallDateEdit")).SelectedDate.HasValue) plInstallDate = ((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpPlInstallDateEdit")).SelectedDate.Value;
                        string plMhShot = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlMhShotEdit")).SelectedValue.ToString().Trim();
                        bool plExtraRepair = ((CheckBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("cbxPlExtraRepairEdit")).Checked;
                        bool plCancelled = ((CheckBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("cbxPlCancelledEdit")).Checked;
                        string plApproval = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlAprovalEdit")).SelectedValue.ToString().Trim();
                        string plComments = ((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxPlCommentsEdit")).Text.Trim();
                        string plDefectQualifier = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlDefectQualifierEdit")).SelectedValue;
                        string plDefectDetails = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlDefectDetailsEdit")).SelectedValue;
                        string plLength = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlPlLengthEdit")).SelectedValue.ToString().Trim();
                        DateTime? plReinstateDate = null; if (((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpPlReinstateDateEdit")).SelectedDate.HasValue) plReinstateDate = ((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpPlReinstateDateEdit")).SelectedDate.Value;

                        model.UpdatePointLining(workId, repairPointId, plLinerDistance, plDirection, plReinstates, plLtmh, plVtmh, plDistance, plSize_, plInstallDate, plMhShot, plExtraRepair, plCancelled, plApproval, plComments, plDefectQualifier, plDefectDetails, plLength, plReinstateDate);
                        break;

                    case "Grouting":
                        string gtGroutDistance = ((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxGtGroutDistanceEdit")).Text.Trim();
                        DateTime? gtInstallDate = null;
                        DateTime? gtGroutDate = null; if (((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpGtGroutDateEdit")).SelectedDate.HasValue) gtGroutDate = ((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpGtGroutDateEdit")).SelectedDate.Value;
                        bool gtExtraRepair = ((CheckBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("cbxGtExtraRepairEdit")).Checked;
                        bool gtCancelled = ((CheckBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("cbxGtCancelledEdit")).Checked;
                        string gtApproval = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlGtApprovalEdit")).SelectedValue.ToString().Trim();
                        string gtComments = ((TextBox)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tbxGtCommentsEdit")).Text.Trim();
                        string gtDefectQualifier = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlGtDefectQualifierEdit")).SelectedValue;
                        string gtDefectDetails = ((DropDownList)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("ddlGtDefectDetailsEdit")).SelectedValue;
                        DateTime? gtReinstateDate = null; if (((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpGtReinstateDateEdit")).SelectedDate.HasValue) gtReinstateDate = ((RadDatePicker)grdRepairs.Rows[e.RowIndex].Cells[3].FindControl("tkrdpGtReinstateDataEdit")).SelectedDate.Value;

                        model.UpdateGrouting(workId, repairPointId, gtGroutDistance, gtInstallDate, gtGroutDate, gtExtraRepair, gtCancelled, gtApproval, gtComments, gtDefectQualifier, gtDefectDetails, gtReinstateDate);
                        break;
                }

                // Store dataset
                Session["pointRepairsTDS"] = pointRepairsTDS;
            }
            else
            {
                e.Cancel = true;
            }
        }
예제 #6
0
        protected void grdRepairs_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            // Repair Gridview, if the gridview is edition mode
            if (grdRepairs.EditIndex >= 0)
            {
                grdRepairs.UpdateRow(grdRepairs.EditIndex, true);
            }

            // Delete repairs
            int workId = (int)e.Keys["WorkID"];
            string repairPointId = e.Keys["RepairPointID"].ToString();

            PointRepairsRepairDetails model = new PointRepairsRepairDetails(pointRepairsTDS);

            // Delete repair
            model.Delete(workId, repairPointId);

            // Store dataset
            Session["pointRepairsTDS"] = pointRepairsTDS;
        }
예제 #7
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 workIdFll = Int32.Parse(hdfWorkIdFll.Value);
            int sectionAssetId = Int32.Parse(hdfAssetId.Value);

            DB.Open();
            DB.BeginTransaction();
            try
            {
                // Save repair details
                PointRepairsRepairDetails pointRepairsRepairDetails = new PointRepairsRepairDetails(pointRepairsTDS);
                pointRepairsRepairDetails.Save(companyId);

                // Save comment details
                PointRepairsCommentDetails pointRepairsCommentDetails = new PointRepairsCommentDetails(pointRepairsTDS);
                pointRepairsCommentDetails.Save(companyId);

                // Save section details
                PointRepairsSectionDetails pointRepairsSectionDetails = new PointRepairsSectionDetails(pointRepairsTDS);
                pointRepairsSectionDetails.Save(countryId, provinceId, countyId, cityId, projectId, companyId);

                // Save work details
                PointRepairsWorkDetails pointRepairsWorkDetails = new PointRepairsWorkDetails(pointRepairsTDS);
                pointRepairsWorkDetails.Save(countryId, provinceId, countyId, cityId, projectId, sectionAssetId, companyId);

                DB.CommitTransaction();

                // Store datasets
                pointRepairsTDS.AcceptChanges();
                Session["pointRepairsTDS"] = pointRepairsTDS;
            }
            catch (Exception ex)
            {
                DB.RollbackTransaction();

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }
예제 #8
0
        private void GrdRepairsAdd()
        {
            if (ValidateRepairsFooter())
            {
                Page.Validate("repairsDataAdd");

                if (Page.IsValid)
                {
                    PointRepairsRepairDetails model = new PointRepairsRepairDetails(pointRepairsTDS);

                    // static values
                    int workId = Int32.Parse(hdfWorkId.Value);
                    int companyId = Int32.Parse(hdfCompanyId.Value);
                    bool inDatabase = false;

                    // Repair Type
                    string repairType = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlRepairTypeNew")).SelectedValue;

                    // Auto-generate value
                    string repairPointId = GetRepairPointIdIncrement(repairType);

                    switch (repairType)
                    {
                        case "Robotic Reaming":
                            string rmReamDistance = ((TextBox)grdRepairs.FooterRow.FindControl("tbxRmReamDistanceNew")).Text.Trim();
                            DateTime? rmReamDate = null; if (((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpRmReamDateNew")).SelectedDate.HasValue) rmReamDate = ((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpRmReamDateNew")).SelectedDate.Value;
                            bool rmExtraRepair = ((CheckBox)grdRepairs.FooterRow.FindControl("cbxRmExtraRepairNew")).Checked;
                            bool rmCancelled = ((CheckBox)grdRepairs.FooterRow.FindControl("cbxRmCancelledNew")).Checked;
                            string rmApproval = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlRmApprovalNew")).SelectedValue.ToString().Trim();
                            string rmComments = ((TextBox)grdRepairs.FooterRow.FindControl("tbxRmCommentsNew")).Text.Trim();
                            string rmDefectQualifier = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlRmDefectQualifierNew")).SelectedValue;
                            string rmDefectDetails = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlRmDefectDetailsNew")).SelectedValue;
                            DateTime? rmReinstateDate = null; if (((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpRmReinstateDateNew")).SelectedDate.HasValue) rmReinstateDate = ((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpRmReinstateDateNew")).SelectedDate.Value;

                            model.Insert(workId, repairPointId, repairType, rmReamDistance, rmReamDate, "", null, null, "", "", "", "", null, "", "", null, rmApproval, rmExtraRepair, rmCancelled, rmComments, false, companyId, inDatabase, rmDefectQualifier, rmDefectDetails, "", rmReinstateDate);
                            break;

                        case "Point Lining":
                            string plLinerDistance = ((TextBox)grdRepairs.FooterRow.FindControl("tbxPlLinerDistanceNew")).Text.Trim();
                            string plDirection = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlDirectionNew")).SelectedValue.ToString().Trim();
                            int? plReinstates = null; if (((TextBox)grdRepairs.FooterRow.FindControl("tbxPlReinstatesNew")).Text.Trim() != "") plReinstates = Int32.Parse(((TextBox)grdRepairs.FooterRow.FindControl("tbxPlReinstatesNew")).Text.Trim());
                            string plLtmh = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlLtmhNew")).SelectedValue;
                            string plVtmh = "";
                            if (plLtmh != "")
                            {
                                int selectedIndex = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlLtmhNew")).SelectedIndex;

                                if (selectedIndex == 1)
                                {
                                    plVtmh = hdfDSMH.Value;
                                }
                                else
                                {
                                    plVtmh = hdfUSMH.Value;
                                }
                            }
                            string plDistance = ((TextBox)grdRepairs.FooterRow.FindControl("tbxPlDistanceNew")).Text.Trim();
                            string plSize_ = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlSize_New")).SelectedValue.ToString().Trim();
                            DateTime? plInstallDate = null; if (((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpPlInstallDateNew")).SelectedDate.HasValue) plInstallDate = ((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpPlInstallDateNew")).SelectedDate.Value;
                            string plMhShot = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlMhShotNew")).SelectedValue.ToString().Trim();
                            bool plExtraRepair = ((CheckBox)grdRepairs.FooterRow.FindControl("cbxPlExtraRepairNew")).Checked;
                            bool plCancelled = ((CheckBox)grdRepairs.FooterRow.FindControl("cbxPlCancelledNew")).Checked;
                            string plApproval = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlAprovalNew")).SelectedValue.ToString().Trim();
                            string plComments = ((TextBox)grdRepairs.FooterRow.FindControl("tbxPlCommentsNew")).Text.Trim();
                            string plDefectQualifier = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlDefectQualifierNew")).SelectedValue;
                            string plDefectDetails = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlDefectDetailsNew")).SelectedValue;
                            string plLength = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlPlLengthNew")).SelectedValue;
                            DateTime? plReinstateDate = null; if (((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpPlReinstateDateNew")).SelectedDate.HasValue) plReinstateDate = ((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpPlReinstateDateNew")).SelectedDate.Value;

                            model.Insert(workId, repairPointId, repairType, "", null, plLinerDistance, plDirection, plReinstates, plLtmh, plVtmh, plDistance, plSize_, plInstallDate, plMhShot, "", null, plApproval, plExtraRepair, plCancelled, plComments, false, companyId, inDatabase, plDefectQualifier, plDefectDetails, plLength, plReinstateDate);
                            break;

                        case "Grouting":
                            string gtGroutDistance = ((TextBox)grdRepairs.FooterRow.FindControl("tbxGtGroutDistanceNew")).Text.Trim();
                            DateTime? gtInstallDate = null;
                            DateTime? gtGroutDate = null; if (((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpGtGroutDateNew")).SelectedDate.HasValue) gtGroutDate = ((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpGtGroutDateNew")).SelectedDate.Value;
                            bool gtExtraRepair = ((CheckBox)grdRepairs.FooterRow.FindControl("cbxGtExtraRepairNew")).Checked;
                            bool gtCancelled = ((CheckBox)grdRepairs.FooterRow.FindControl("cbxGtCancelledNew")).Checked;
                            string gtApproval = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlGtApprovalNew")).SelectedValue.ToString().Trim();
                            string gtComments = ((TextBox)grdRepairs.FooterRow.FindControl("tbxGtCommentsNew")).Text.Trim();
                            string gtDefectQualifier = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlGtDefectQualifierNew")).SelectedValue;
                            string gtDefectDetails = ((DropDownList)grdRepairs.FooterRow.FindControl("ddlGtDefectDetailsNew")).SelectedValue;
                            DateTime? gtReinstateDate = null; if (((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpGtReinstateDateNew")).SelectedDate.HasValue) gtReinstateDate = ((RadDatePicker)grdRepairs.FooterRow.FindControl("tkrdpGtReinstateDateNew")).SelectedDate.Value;

                            model.Insert(workId, repairPointId, repairType, "", null, "", "", null, "", "", "", "", gtInstallDate, "", gtGroutDistance, gtGroutDate, gtApproval, gtExtraRepair, gtCancelled, gtComments, false, companyId, inDatabase, gtDefectQualifier, gtDefectDetails, "", gtReinstateDate);
                            break;
                    }

                    Session.Remove("pointRepairsRepairsTempDummy");
                    Session["pointRepairsTDS"] = pointRepairsTDS;

                    switch (ddlFilter.SelectedValue)
                    {
                        case "(All)":
                            SetFilter("Deleted = 0");
                            break;

                        case "Robotic Reaming":
                            SetFilter("Type='Robotic Reaming' AND Deleted = 0");
                            break;

                        case "Point Lining":
                            SetFilter("Type='Point Lining' AND Deleted = 0");
                            break;

                        case "Grouting":
                            SetFilter("Type='Grouting' AND Deleted = 0");
                            break;
                    }

                    grdRepairs.DataBind();
                }
            }
        }
예제 #9
0
        private string GetRepairPointIdIncrement(string type)
        {
            string repairPointIdIncrement = "";

            switch (type)
            {
                case "Robotic Reaming":
                    repairPointIdIncrement = "RM-";
                    break;

                case "Point Lining":
                    repairPointIdIncrement = "PL-";
                    break;

                case "Grouting":
                    repairPointIdIncrement = "GT-";
                    break;
            }

            // Generate increment
            PointRepairsRepairDetails pointRepairsRepairDetails = new PointRepairsRepairDetails(pointRepairsTDS);

            repairPointIdIncrement += Convert.ToChar(pointRepairsRepairDetails.GetMaxRepairPointId(type) + 1).ToString();

            return repairPointIdIncrement;
        }