예제 #1
0
        private void UpdateDatabase()
        {
            DB.Open();
            DB.BeginTransaction();
            try
            {
                Guid id = new Guid(hdfSelectedId.Value);
                int companyId = Int32.Parse(Session["companyID"].ToString());

                // Save jliner2
                JlinerAddJunctionLiner2 jlinerAddJunctionLiner2 = new JlinerAddJunctionLiner2(jlinerAddTDS);
                jlinerAddJunctionLiner2.Save(id, companyId);

                // Save section
                JlinerAddMasterArea jlinerAddMasterArea = new JlinerAddMasterArea(jlinerAddTDS);
                jlinerAddMasterArea.Save(id, companyId);

                // Save jliner2comments
                JlinerAddJunctionLiner2Comment jlinerAddJunctionLiner2Comment = new JlinerAddJunctionLiner2Comment(jlinerAddTDS);
                jlinerAddJunctionLiner2Comment.Save(id, companyId);

                DB.CommitTransaction();

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

                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }
예제 #2
0
        // ////////////////////////////////////////////////////////////////////////
        // STEP3 - JLINER - PRIVATE METHODS
        //
        private void StepJlinerIn()
        {
            // Set instruction
            mWizard2 master = (mWizard2)this.Master;
            master.WizardInstruction = "Please add laterals";

            // Prepare initial data
            Session.Remove("jliner2Dummy");

            // ... for Section
            string recordId = hdfRecordId.Value;
            Guid id = new Guid(hdfSelectedId.Value);

            hdfID.Value = id.ToString();
            tbxRecordId.Text = recordId;
            tbxStreet.Text = hdfStreet.Value;
            tbxActualLength.Text = hdfActualLength.Value;
            tbxUSMH.Text = hdfUsmh.Value;
            tbxDSMH.Text = hdfDsmh.Value;

            // ... for Jliner
            int companyId = Int32.Parse(Session["companyID"].ToString());
            JlinerAddJunctionLiner2 jlinerAddJunctionLiner2 = new JlinerAddJunctionLiner2(jlinerAddTDS);
            jlinerAddJunctionLiner2.LoadForAdd(id, companyId);

            Session["jlinerAddTDS"] = jlinerAddTDS;
            jliner2 = jlinerAddTDS.JunctionLiner2;
            Session["jliner2"] = jliner2;
            grdJliner2.DataBind();
        }
예제 #3
0
        protected void grdJliner2_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Page.Validate("dataEdit");
            if (Page.IsValid)
            {
                Guid id = new Guid(((Label)grdJliner2.Rows[e.RowIndex].Cells[0].FindControl("lblIDEdit")).Text);
                int refId = Int32.Parse(((Label)grdJliner2.Rows[e.RowIndex].Cells[1].FindControl("lblRefIDEdit")).Text);
                int companyId = Int32.Parse(((Label)grdJliner2.Rows[e.RowIndex].Cells[2].FindControl("lblCOMPANY_IDEdit")).Text);
                string detailId = ((TextBox)grdJliner2.Rows[e.RowIndex].Cells[4].FindControl("tbxDetailIdEdit")).Text.Trim();
                string address = ""; if (((TextBox)grdJliner2.Rows[e.RowIndex].Cells[5].FindControl("tbxAddressEdit")).Text.Trim() != "") address = ((TextBox)grdJliner2.Rows[e.RowIndex].Cells[5].FindControl("tbxAddressEdit")).Text.Trim();
                double? distanceFromUSMH = null; if (((TextBox)grdJliner2.Rows[e.RowIndex].Cells[6].FindControl("tbxDistanceFromUSMHEdit")).Text.Trim() != "") distanceFromUSMH = double.Parse(((TextBox)grdJliner2.Rows[e.RowIndex].Cells[6].FindControl("tbxDistanceFromUSMHEdit")).Text.Trim());

                // Calculate fields
                double? distanceFromDSMH = null;
                if (distanceFromUSMH.HasValue)
                {
                    Distance length = new Distance(tbxActualLength.Text.Trim()) - new Distance(distanceFromUSMH.ToString());
                    distanceFromDSMH = length.ToDoubleInEng3();
                }

                JlinerAddJunctionLiner2 model = new JlinerAddJunctionLiner2(jlinerAddTDS);
                model.Update(id, refId, companyId, detailId, address, distanceFromUSMH, distanceFromDSMH );

                Session["jlinerAddTDS"] = jlinerAddTDS;
            }
            else
            {
                e.Cancel = true;
            }
        }
예제 #4
0
        private void GrdJLinerAdd()
        {
            Page.Validate("dataFooter");
            if (Page.IsValid)
            {
                if (ValidateJlinerFooter())
                {
                    Guid id = new Guid(hdfSelectedId.Value);
                    int companyId = Convert.ToInt32(Session["companyID"]);
                    string detailId = ""; if (((TextBox)grdJliner2.FooterRow.FindControl("tbxDetailIdFooter")).Text.Trim() != "") detailId = ((TextBox)grdJliner2.FooterRow.FindControl("tbxDetailIdFooter")).Text.Trim();
                    string address = ""; if (((TextBox)grdJliner2.FooterRow.FindControl("tbxAddressFooter")).Text.Trim() != "") address = ((TextBox)grdJliner2.FooterRow.FindControl("tbxAddressFooter")).Text.Trim();
                    double? distanceFromUSMH = null; if (((TextBox)grdJliner2.FooterRow.FindControl("tbxDistanceFromUSMHFooter")).Text.Trim() != "") distanceFromUSMH = double.Parse(((TextBox)grdJliner2.FooterRow.FindControl("tbxDistanceFromUSMHFooter")).Text.Trim());
                    int buildRebuild = 0;
                    bool inDatabase = false;
                    string issue = "No";

                    // Calculate fields
                    double? distanceFromDSMH = null;
                    if (distanceFromUSMH.HasValue)
                    {
                        Distance length = new Distance(tbxActualLength.Text.Trim()) - new Distance(distanceFromUSMH.ToString());
                        distanceFromDSMH = length.ToDoubleInEng3();
                    }

                    JlinerAddJunctionLiner2 model = new JlinerAddJunctionLiner2(jlinerAddTDS);
                    model.Insert(id, companyId, detailId, address, null, null, null, null, null, null, null, null, null, "", null, null, null, buildRebuild, null, null, null, distanceFromUSMH, distanceFromDSMH, "", issue, null, false, null, false, false, "", false, "", "", null, null, "", "", false, "", null, inDatabase);

                    Session.Remove("jliner2Dummy");
                    Session["jlinerAddTDS"] = jlinerAddTDS;
                    jliner2 = jlinerAddTDS.JunctionLiner2;
                    masterArea = jlinerAddTDS.MasterArea;
                    Session["masterArea"] = masterArea;

                    grdJliner2.DataBind();
                    grdJliner2.PageIndex = grdJliner2.PageCount - 1;
                }
            }
        }
예제 #5
0
        // /////////////////////////////////////////////////////////////////////////////////////////////////////
        // STEP3 - JLINER
        //
        // ////////////////////////////////////////////////////////////////////////
        // STEP3 - JLINER - EVENTS
        //
        protected void grdJliner2_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            // grdJliner2 Gridview, if the gridview is edition mode
            if (grdJliner2.EditIndex >= 0)
            {
                grdJliner2.UpdateRow(grdJliner2.EditIndex, true);
            }

            // Delete jliner
            Guid id = new Guid(((Label)grdJliner2.Rows[e.RowIndex].Cells[0].FindControl("lblId")).Text);
            int refId = Int32.Parse(((Label)grdJliner2.Rows[e.RowIndex].Cells[1].FindControl("lblRefId")).Text);
            int companyId = Int32.Parse(((Label)grdJliner2.Rows[e.RowIndex].Cells[2].FindControl("lblCOMPANY_ID")).Text);

            JlinerAddJunctionLiner2 model = new JlinerAddJunctionLiner2(jlinerAddTDS);
            model.Delete(id, refId, companyId);

            // ... delete comments
            JlinerAddJunctionLiner2CommentGateway jlinerAddJunctionLiner2CommentGateway = new JlinerAddJunctionLiner2CommentGateway(jlinerAddTDS);
            jlinerAddJunctionLiner2CommentGateway.LoadAllByIdRefId(id, refId, companyId);
            JlinerAddJunctionLiner2Comment jlinerAddJunctionLiner2Comment = new JlinerAddJunctionLiner2Comment(jlinerAddJunctionLiner2CommentGateway.Data);
            jlinerAddJunctionLiner2Comment.DeleteAllCommentsForAJliner(id, refId, companyId);

            // Save dataset
            Session["jlinerAddTDS"] = jlinerAddTDS;
        }