/// <summary>
        /// Update - JLiner
        /// </summary>
        public void Update()
        {
            Fix1JlinerGateway jlinerGateway = new Fix1JlinerGateway(Data);

            DataTable sectionChanges = Table.GetChanges();

            if (sectionChanges == null ) return;

            try
            {
                DB.Open();
                DB.BeginTransaction();

                Adapter.InsertCommand.Transaction = DB.Transaction;
                Adapter.UpdateCommand.Transaction = DB.Transaction;
                Adapter.DeleteCommand.Transaction = DB.Transaction;

                if ((sectionChanges != null) && (sectionChanges.Rows.Count > 0))
                {
                    Adapter.Update(sectionChanges);
                }

                DB.CommitTransaction();
            }
            catch (DBConcurrencyException dBConcurrencyException)
            {
                DB.RollbackTransaction();
                throw new Exception("Concurrency error: Another user already updated the data you are working on.  Your operation has been cancelled.", dBConcurrencyException);
            }
            catch (SqlException sqlException)
            {
                DB.RollbackTransaction();
                byte severityLevel = sqlException.Class;
                if (severityLevel <= 16)
                {
                    throw new Exception("Low severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
                if ((severityLevel >= 17) && (severityLevel <= 19))
                {
                    throw new Exception("Mid severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
                if (severityLevel >= 20)
                {
                    throw new Exception("High severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
            }
            catch (Exception e)
            {
                DB.RollbackTransaction();
                throw new Exception("Unknow error. Your operation has been cancelled.", e);
            }
            finally
            {
                DB.Close();
            }
        }
Example #2
0
        protected void btnFixCommentsAndHistory_Click(object sender, EventArgs e)
        {
            Fix1JlinerGateway fix1JlinerGateway = new Fix1JlinerGateway();

            // Load all jliners
            fix1JlinerGateway.LoadAll();

            Fix1Jliner fix1Jliner = new Fix1Jliner(fix1JlinerGateway.Data);
            fix1Jliner.UpdateCommentsHistory();

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

                Fix1Jliner fix1Jliner = new Fix1Jliner(fix1JlinerGateway.Data);

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

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

                // Update IssueWithtLaterals
                Guid rowId = masterAreaRow.ID;
                if (liningPlanGateway.IsLateralsIssueNo(rowId))
                {
                    masterAreaRow.IssueWithLaterals = "No";
                }
                else
                {
                    if (liningPlanGateway.IsLateralsIssueOutOfScope(rowId))
                    {
                        masterAreaRow.IssueWithLaterals = "Out Of Scope";
                    }
                    else
                    {
                        if (liningPlanGateway.IsLateralsIssueYesOutOfScope(rowId))
                        {
                            masterAreaRow.IssueWithLaterals = "Yes, Out Of Scope";
                        }
                        else
                        {
                            if (liningPlanGateway.IsLateralsIssueYes(rowId))
                            {
                                masterAreaRow.IssueWithLaterals = "Yes";
                            }
                        }
                    }
                }
            }
        }
Example #4
0
        /// <summary>
        /// LoadAll
        /// </summary>
        public void LoadAll()
        {
            Fix1JlinerGateway fix1JlinerGateway = new Fix1JlinerGateway(Data);
            fix1JlinerGateway.LoadAll();

               //Load comments and History
            UpdateCommentsHistory();
        }