Exemple #1
0
        /// <summary>
        /// Add new note.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddNewNote_Click(object sender, EventArgs e)
        {
            try
            {
                this.txtNewNote.Text = this.txtNewNote.Text.Trim();
                if (this.txtNewNote.Text.Length > 0)
                {
                    string sNoteText = this.txtNewNote.Text;

                    //v1.0.1 - Add notes the notes collection
                    cProjectNotesTable cNote = Settings.ReturnNoteObject(
                        this.m_cProjectData.SubProjectNo,
                        sNoteText, DateTime.Now,
                        Settings.p_sProjectNoteType_General);
                    this.m_cProjectNotes.Add(cNote);

                    //Save Note
                    bSaveOK = this.SaveProjectNotes();
                    if (bSaveOK == false)
                    {
                        bSaveOK = false;
                    }

                    this.txtNewNote.Text = String.Empty;
                    this.txtNewNote.Focus();

                    this.RefreshNotesList();
                }
            }
            catch (Exception ex)
            {
                //cMain.ReportError(ex, cMain.GetCallerMethodName(), string.Empty);
            }
        }
Exemple #2
0
        public static cProjectNotesTable ReturnNoteObject(string v_sSubProjectNo, string v_sNoteText, DateTime v_dNoteDate, string v_sNoteType)
        {
            cProjectNotesTable cNote = new cProjectNotesTable();

            try
            {
                cNote.AXRecID       = -1;
                cNote.IDKey         = -1;
                cNote.InputDateTime = v_dNoteDate;
                cNote.NoteText      = v_sNoteText;
                cNote.NoteType      = v_sNoteType;
                cNote.SubProjectNo  = v_sSubProjectNo;
                cNote.UserName      = Session.CurrentUserName;
                cNote.UserProfile   = Session.CurrentUserName;

                return(cNote);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemple #3
0
        /// <summary>
        /// Update survey failed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnUpdateSurveyFailed_Click()
        {
            try
            {
                cFailedSurveyReasonsTable oReason = this.ReturnReasonObject();

                //Remove blank spaces from comment box.
                if (this.txtFailedComment.Text != null)
                {
                    this.txtFailedComment.Text = this.txtFailedComment.Text.Trim();
                }

                string sItem = this.cmbFailedSurvey.Items[cmbFailedSurvey.SelectedIndex];
                if (sItem.Equals(Settings.p_sPleaseChoose) == true)
                {
                    await DisplayAlert("Failed Visit Reason Required.", "Please select a reason for the failed visit.", "OK");

                    this.cmbFailedSurvey.Focus();
                    return;
                }
                else if (oReason.MandatoryNote == true)
                {
                    //If other selected then a comment is required.
                    if (this.txtFailedComment.Text.Length == 0)
                    {
                        await DisplayAlert(
                            "Comment Required.",
                            "You need to enter a comment when you select a failed visit reason of " + Settings.p_sNoteIt_Other + ".",
                            "OK");

                        this.txtFailedComment.Focus();
                        return;
                    }
                }

                this.m_cProject.MxmConfirmedAppointmentIndicator = (int)Settings.YesNoBaseEnum.No; //v1.0.1
                Main.p_cDataAccess.AddToUpdateTable(
                    this.m_cProject.SubProjectNo, "MxmConfirmedAppointmentIndicator", ((int)Settings.YesNoBaseEnum.No).ToString());

                //v1.0.19 - If progress status specified we need to update.
                if (oReason.ProgressStatus > -1)
                {
                    this.m_cProject.Mxm1002ProgressStatus = oReason.ProgressStatus;
                    this.m_cProject.ProgressStatusName    = Main.p_cDataAccess.GetEnumValueName("ProjTable", "Mxm1002ProgressStatus", oReason.ProgressStatus);

                    Main.p_cDataAccess.AddToUpdateTable(this.m_cProject.SubProjectNo, "Mxm1002ProgressStatus", oReason.ProgressStatus.ToString());
                }

                //Save sub project.
                bool bSaveOK = Main.p_cDataAccess.UpdateProjectTable(this.m_cProject);
                if (bSaveOK == false)
                {
                    await DisplayAlert("Error When Saving.", "An error occurred when trying to save, please try again.", "OK");

                    return;
                }

                string sNewNote = sItem + ": " + this.txtFailedComment.Text;

                DateTime dtFailedDate = DateTime.Now;
                dtFailedDate = btnUpdateSurveyAttemptDate.Date;

                //v1.0.1 - Return note object
                cProjectNotesTable cNote = Settings.ReturnNoteObject(
                    this.m_cProject.SubProjectNo,
                    sNewNote, dtFailedDate,
                    Settings.p_sProjectNoteType_SurveyFailed);

                //v1.0.1 - Save sub project notes.
                bSaveOK = Main.p_cDataAccess.SaveSubProjectNote(cNote);
                if (bSaveOK == false)
                {
                    await DisplayAlert("Error When Saving.", "An error occurred when trying to save, please try again.", "OK");

                    return;
                }


                //Go back to previous page.
                //navigationHelper.GoBack();
            }
            catch (Exception ex)
            {
                //cMain.ReportError(ex, cMain.GetCallerMethodName(), string.Empty);
            }
        }