Exemple #1
0
        /// <summary>
        /// Entry method for the Custom Command Modal interface.
        /// </summary>
        public void Activate()
        {
            // Perform Job Property Validations.
            if (!JobPropertiesAreValid())
            {
                return;
            }

            // Check/Resolve any alternate jobs with pending Approval status.
            if (AlternatesPendingApprovalExist())
            {
                return;
            }

            // Validate pending job edits
            if (!ResolveJobValidationErrors())
            {
                return;
            }

            // Check for existing conflicts
            if (ConflictsExist())
            {
                return;
            }

            // Check for concurrent edits involving jobs that are pending approval and exit if any found.
            if (ConcurrentEditsExistWithApprovalPending())
            {
                return;
            }

            // Check for out of synch WPs and exit if they are not synchronized
            SharedWriteBackLibrary swbl = new SharedWriteBackLibrary();

            if (!swbl.ValidateWorkPoints())
            {
                return;
            }
            // If plotting boundaries exist, then attempt plot sheet generation; however,
            // if they don't exist, then bypass generating and storing the archival prints completely.

            IGTApplication app = GTClassFactory.Create <IGTApplication>();
            string         sql = "select count(1) from plotbnd_n where job_id=? and product_type='Construction Print'";
            Recordset      rs  = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, app.DataContext.ActiveJob);
            // This SQL will always return a record.
            short boundaryCount = Convert.ToInt16(rs.Fields[0].Value);

            rs.Close();
            rs = null;

            if (0 < boundaryCount)
            {
                // Generate the construction prints
                string constructionPrints = string.Empty;

                if (GenerateConstructionPrints(out constructionPrints))
                {
                    // There is currently no provision in the design to check whether the construction prints
                    // are generated.  Provided there is no processing failure (which will be trapped in an exception
                    // and cause the previous call to generate the prints to return a false),
                    // then since the validations have already checked for the existence of a plotting boundary,
                    // it will be assumed that at least one plot was generated.

                    // Attach the construction prints generated above
                    if (!AttachConstructionPrints(constructionPrints))
                    {
                        string msg = string.Format("Failed to upload construction prints for archival.{0}{0}Proceed anyway?", System.Environment.NewLine);

                        if (DialogResult.No == MessageBox.Show(msg, "G/Technology", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        {
                            return;
                        }
                    }
                }
                else
                {
                    string msg = string.Format("Failed to generate construction prints for archival.{0}{0}Proceed anyway?", System.Environment.NewLine);

                    if (DialogResult.No == MessageBox.Show(msg, "G/Technology", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                    {
                        return;
                    }
                }
            }

            // Cache these here for use with the SetJobStatus interface (in case something deactivates the job before then).
            JobManager jm = new JobManager();

            this.ActiveWRNbr = jm.WRNumber;
            this.ActiveJobID = jm.ActiveJob;

            if (jm.NullNumericFieldValue)
            {
                throw new Exception("The WR value for this job is NULL");
            }

            // Check for writeback flag and perform writeback if set
            if (!DoWriteBack(swbl))
            {
                return;
            }

            // Request job status change to ApprovalPending
            // and set job status to ApprovalPending if request is successful.
            WMISStatus wMISStatus = new WMISStatus();

            wMISStatus.SetJobStatus(this.ActiveJobID, this.ActiveWRNbr.ToString(), approvalPending);
        }
Exemple #2
0
        /// <summary>
        /// Returns true if job properties are valid; otherwise, false.
        /// </summary>
        public bool JobPropertiesAreValid()
        {
            try
            {
                JobManager jobManager = new JobManager();

                // Comparing this way to prevent making multiple calls to the database to get the job type.
                string[] invalidJobtypes = new string[] { "NON-WR", "WR-ESTIMATE" };

                if (invalidJobtypes.Contains(jobManager.JobType.Trim().ToUpper()))
                {
                    MessageBox.Show("This command applies only to WR jobs (excluding graphic estimates).", "G/Technology", MessageBoxButtons.OK);
                    return(false);
                }

                if (jobManager.JobStatus.ToUpper() != "DESIGN")
                {
                    MessageBox.Show("Job Status must be Design in order to mark for approval.", "G/Technology", MessageBoxButtons.OK);
                    return(false);
                }

                string wmisStatus = jobManager.WMISStatus.ToUpper().Trim();

                if (wmisStatus == "ERROR")
                {
                    MessageBox.Show("Interface error must be resolved before proceeding.", "G/Technology", MessageBoxButtons.OK);
                    return(false);
                }

                if (!string.IsNullOrEmpty(wmisStatus) && wmisStatus != "SUCCESS" && wmisStatus != "FAILURE")
                {
                    MessageBox.Show("Interface is in use for this WR.", "G/Technology", MessageBoxButtons.OK);
                    return(false);
                }

                IGTApplication app = GTClassFactory.Create <IGTApplication>();

                string    sql = "select count(1) from designarea_p where job_id=?";
                Recordset rs  = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, jobManager.ActiveJob);
                // This SQL will always return a record.
                if (0 == Convert.ToInt16(rs.Fields[0].Value))
                {
                    MessageBox.Show("This command requires a Design Area to be placed for the active job.", "G/Technology", MessageBoxButtons.OK);
                    rs.Close();
                    rs = null;
                    return(false);
                }


                sql = "select count(1) from plotbnd_n where job_id=? and product_type='Construction Print'";
                rs  = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, jobManager.ActiveJob);
                // This SQL will always return one record with one non-null field.
                short boundaryCount = Convert.ToInt16(rs.Fields[0].Value);
                rs.Close();
                rs = null;

                if (0 == boundaryCount)
                {
                    //MessageBox.Show("At least one Plotting Boundary is required prior to marking for approval.", "G/Technology", MessageBoxButtons.OK);
                    //return false;

                    string msg = string.Format("{0}{1}{1}{2}{1}{1}{3}",
                                               "No Construction Print Plotting Boundaries exist for the active WR job.",
                                               System.Environment.NewLine,
                                               "Without at least one Construction Print Plotting Boundary, Archival Prints will not be generated/uploaded.",
                                               "Proceed anyway?");
                    return(DialogResult.Yes == MessageBox.Show(msg, "G/Technology", MessageBoxButtons.YesNo, MessageBoxIcon.Question));
                }

                return(true);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
Exemple #3
0
        /// <summary>
        /// Entry point for the Custom Command Modal interface.
        /// </summary>
        public void Activate()
        {
            try
            {
                // Check for out of synch WPs and exit if they are not synchronized
                SharedWriteBackLibrary swbl = new SharedWriteBackLibrary();
                if (!swbl.ValidateWorkPoints())
                {
                    return;
                }

                TransactionManager.Begin("Post Job");

                // PendingEditsExist builds this recordset and we can use it again in
                // ValidateNetworkDrawings to keep from querying for it again there.
                Recordset pendingEdits = null;

                // If there are no pending edits, then nothing else to do here.
                // PendingEditsExist will close/null the recordset object if there are no pending edits.
                if (!PendingEditsExist(ref pendingEdits))
                {
                    MessageBox.Show("There are no pending edits in the active job.  Exiting command.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                // Validate pending job edits
                if (!ResolveJobValidationErrors())
                {
                    return;
                }

                // Perform Job Validations.  Return if any fail.
                if (!JobAttributesAreValid)
                {
                    return;
                }

                // Check for existing conflicts
                if (ConflictsExist())
                {
                    return;
                }



                // Allow user to validate the pertinent network drawings attached to the active job.
                // ValidateNetworkDrawings will close/null the recordset object when finished with it.
                if (!ValidateNetworkDrawings(ref pendingEdits))
                {
                    return;
                }

                TransactionManager.Commit(true);

                // Post edits for active job
                if (!PostJobEdits())
                {
                    return;
                }

                // Since nothing else is updated in this command from here to the end,
                // a transaction here should not be necessary; however, leaving it just in case.
                TransactionManager.Begin("Post Job");

                // If indicated, then invoke a Writeback
                // ALM 1566 - Requests removal of the check for the write back flag.
                //            Future design change will check for this in a different way
                //            but leaving the clause in the conditional statement for clarity
                //            until that change is implemented.
                JobManager jobManager = new JobManager();

                if (nonWR != jobManager.JobType /*&& jobManager.WriteBackNeeded*/)
                {
                    DoWriteBack(swbl);
                }

                if (TransactionManager.TransactionInProgress)
                {
                    TransactionManager.Commit(true);
                }
            }
            catch (Exception ex)
            {
                if (TransactionManager.TransactionInProgress)
                {
                    TransactionManager.Rollback();
                }

                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
Exemple #4
0
        /// <summary>
        /// Handleblanketunitizationactivity will handle the records which have pending activity related to blanket unitization (i.e.- where Activity = UR or UX).
        /// </summary>
        /// <returns></returns>
        public bool Handleblanketunitizationactivity()
        {
            Recordset pendingEdits = null;

            string strRFC         = null;
            string strActivity    = null;
            String strServiceCode = null;

            try
            {
                bool retVal = true;

                IGTApplication app = GTClassFactory.Create <IGTApplication>();

                IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                jobService.DataContext = app.DataContext;

                pendingEdits = jobService.FindPendingEdits();

                if (null == pendingEdits || 0 >= pendingEdits.RecordCount)
                {
                    retVal = false;
                    return(retVal);
                }
                pendingEdits.MoveFirst();
                pendingEdits.Filter = string.Format("g3e_cno={0} or g3e_cno={1}", 21, 22);

                if (pendingEdits != null && pendingEdits.RecordCount > 0)
                {
                    JobManager jobManager = new JobManager();
                    strRFC = jobManager.DesignerRACFID;
                    pendingEdits.MoveFirst();

                    while (!pendingEdits.EOF)
                    {
                        strActivity = GetActivityOftheFeature(Convert.ToInt32(pendingEdits.Fields["G3E_FID"].Value),
                                                              Convert.ToInt32(pendingEdits.Fields["G3E_CNO"].Value),
                                                              Convert.ToInt32(pendingEdits.Fields["G3E_CID"].Value), app);
                        strServiceCode = null;

                        if (strActivity == "UX")
                        {
                            strServiceCode = "RP";
                        }
                        else if (strActivity == "UR")
                        {
                            strServiceCode = "RM";
                        }
                        if (!String.IsNullOrEmpty(strServiceCode))
                        {
                            Command cmd = new Command();
                            cmd.CommandType = CommandTypeEnum.adCmdStoredProc;
                            Parameter param = cmd.CreateParameter("p_FID", DataTypeEnum.adDecimal, ParameterDirectionEnum.adParamInput, 20, Convert.ToInt32(pendingEdits.Fields["G3E_FID"].Value));
                            cmd.Parameters.Append(param);
                            param = cmd.CreateParameter("p_serviceInfoCode", DataTypeEnum.adLongVarChar, ParameterDirectionEnum.adParamInput, 20, strServiceCode);
                            cmd.Parameters.Append(param);
                            param = cmd.CreateParameter("p_userID", DataTypeEnum.adLongVarChar, ParameterDirectionEnum.adParamInput, 20, strRFC);
                            cmd.Parameters.Append(param);
                            param = cmd.CreateParameter("P_CNO", DataTypeEnum.adDecimal, ParameterDirectionEnum.adParamInput, 20, Convert.ToInt32(pendingEdits.Fields["G3E_CNO"].Value));
                            cmd.Parameters.Append(param);
                            param = cmd.CreateParameter("p_CID", DataTypeEnum.adDecimal, ParameterDirectionEnum.adParamInput, 20, Convert.ToInt32(pendingEdits.Fields["G3E_CID"].Value));
                            cmd.Parameters.Append(param);


                            cmd.CommandText = "GISPKG_SERVICEACTIVITY.InsertServiceActivity";
                            app.Application.DataContext.ExecuteCommand(cmd, out int recordsAffected);

                            IGTKeyObject gTKeyObject = null;

                            gTKeyObject = app.Application.DataContext.OpenFeature(Convert.ToInt16(pendingEdits.Fields["G3E_FNO"].Value),
                                                                                  Convert.ToInt32(pendingEdits.Fields["G3E_FID"].Value));



                            if (gTKeyObject.Components["COMP_UNIT_N"] != null)
                            {
                                if (gTKeyObject.Components["COMP_UNIT_N"].Recordset != null && gTKeyObject.Components["COMP_UNIT_N"].Recordset.RecordCount > 0)
                                {
                                    gTKeyObject.Components["COMP_UNIT_N"].Recordset.MoveFirst();
                                    while (!gTKeyObject.Components["COMP_UNIT_N"].Recordset.EOF)
                                    {
                                        if (Convert.ToInt32(pendingEdits.Fields["G3E_CNO"].Value) ==
                                            Convert.ToInt32(gTKeyObject.Components["COMP_UNIT_N"].Recordset.Fields["G3E_CNO"].Value)
                                            &&
                                            Convert.ToInt32(gTKeyObject.Components["COMP_UNIT_N"].Recordset.Fields["g3e_cid"].Value) ==
                                            Convert.ToInt32(pendingEdits.Fields["G3E_CID"].Value))
                                        {
                                            gTKeyObject.Components["COMP_UNIT_N"].Recordset.Fields["ACTIVITY_C"].Value = "";
                                        }
                                        gTKeyObject.Components["COMP_UNIT_N"].Recordset.Update();
                                        gTKeyObject.Components["COMP_UNIT_N"].Recordset.MoveNext();
                                    }
                                }
                            }

                            if (gTKeyObject.Components["COMMON_N"] != null)
                            {
                                if (gTKeyObject.Components["COMMON_N"].Recordset != null && gTKeyObject.Components["COMMON_N"].Recordset.RecordCount > 0)
                                {
                                    gTKeyObject.Components["COMMON_N"].Recordset.MoveFirst();
                                    gTKeyObject.Components["COMMON_N"].Recordset.Fields["FEATURE_STATE_C"].Value = "CLS";
                                    gTKeyObject.Components["COMMON_N"].Recordset.Update();
                                }
                            }
                        }

                        pendingEdits.MoveNext();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                if (TransactionManager.TransactionInProgress)
                {
                    TransactionManager.Rollback();
                }

                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
Exemple #5
0
        /// <summary>
        /// Checks pending edits for AsBuilt/NET jobs containing hyperlinked documents.  If any exist, invoke a validation form allowing the user to OK each attachment.
        /// </summary>
        /// <param name="pendingEdits">Recordset containing pending edits for active job</param>
        /// <returns>true if no documents or if user reconciles all documents; else, false</returns>
        private bool ValidateNetworkDrawings(ref Recordset PendingEdits)
        {
            try
            {
                // Return value will be false only if the user Cancels the dialog
                bool retVal = true;

                JobManager jobManager = new JobManager();

                // If the properties aren't valid, then nothing to do here.
                if (!(asBuilt == jobManager.JobStatus && network == jobManager.JobType))
                {
                    return(retVal);
                }

                // This should never fail here but checking anyway.
                if (null != PendingEdits && 0 < PendingEdits.RecordCount)
                {
                    // Build the list of NetworkDrawing objects
                    List <NetworkDrawing> drawingList = BuildNetworkDrawingList(PendingEdits);

                    // Instantiate the form
                    PostJobNetworkDrawings networkDrawingForm = new PostJobNetworkDrawings();

                    // Set the forms drawing list
                    networkDrawingForm.DrawingList = drawingList;

                    // Show the form.  If OK, then process updates and removals.
                    if (DialogResult.OK == networkDrawingForm.ShowDialog())
                    {
                        //********************************************************************************************************************************************
                        //************************ Complete these two actions after Document Management interface is complete. ***************************************
                        //********************************************************************************************************************************************

                        // Perform updates
                        foreach (NetworkDrawing nd in drawingList.FindAll(NetworkDrawing => NetworkDrawing.Action.ToLower() == "update"))
                        {
                            OpenFileDialog ofd = new OpenFileDialog();
                            ofd.Title = string.Format(@"Select new drawing file for: {0}", string.IsNullOrEmpty(nd.Description) ? "<No description given>" : nd.Description);
                            ofd.ShowDialog();

                            string updateMsg = string.Format(@"Replace file: {0}{1}With file: {2}{1}For: {3}", nd.Link, Environment.NewLine, ofd.FileName, string.IsNullOrEmpty(nd.Description) ? "<No description given>" : nd.Description);
                            updateMsg += string.Format(@"{0}{0}This functionality is waiting on completion of the Document Management interface.", Environment.NewLine);
                            MessageBox.Show(updateMsg, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }

                        // Perform removals
                        foreach (NetworkDrawing nd in drawingList.FindAll(NetworkDrawing => NetworkDrawing.Action.ToLower() == "remove"))
                        {
                            string updateMsg = string.Format(@"Remove file: {0}{1}For: {2}", nd.Link, Environment.NewLine, string.IsNullOrEmpty(nd.Description) ? "<No description given>" : nd.Description);
                            updateMsg += string.Format(@"{0}{0}This functionality is waiting on completion of the Document Management interface.", Environment.NewLine);
                            MessageBox.Show(updateMsg, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }

                    networkDrawingForm.Dispose();
                    drawingList.Clear();
                    drawingList = null;
                }
                else
                {
                    // No pending edits so nothing to check for in this case.
                    retVal = true;
                }

                // Finished with the PendingEdits recordset
                if (null != PendingEdits)
                {
                    if (PendingEdits.State != Convert.ToInt32(ObjectStateEnum.adStateClosed))
                    {
                        PendingEdits.Close();
                    }

                    PendingEdits = null;
                }

                return(retVal);
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }