Beispiel #1
0
        private void sbtnSave_Click(object sender, System.EventArgs e)
        {
            if (!ValidateBeforeSave())
            {
                DialogResult = DialogResult.None;
                return;
            }
            ACMSLogic.Staff.Appointment myAppointment = new ACMSLogic.Staff.Appointment();
            // New

            StartDateTime = Convert.ToDateTime(dateedtStartTime.Text);
            EndDateTime   = Convert.ToDateTime(dateedtEndTime.Text);

            string strMembershipID;
            int    intContact;

            intContact      = 0;
            strMembershipID = "";
            if (rbExisting.Checked)
            {
                strMembershipID = ucMemberID1.EditValue.ToString();
            }
            else
            {
                intContact = Convert.ToInt32(luedtContact.EditValue);
            }

            int nServedBy = Convert.ToInt32(luedtServedBy.EditValue);

            if (nAppointmentID < 0)
            {
                myAppointment.NewAppoinment(nEmployeeID, dateedtDate.DateTime, StartDateTime,
                                            EndDateTime, "", txtBranchCode.Text, intContact, memoedtRemark.Text, strMembershipID, nServedBy);
                DialogResult = DialogResult.OK;
            }
            else

            {
                myAppointment.EditAppointment(nAppointmentID, nEmployeeID, dateedtDate.DateTime, StartDateTime,
                                              EndDateTime, "", txtBranchCode.Text, intContact, memoedtRemark.Text, 1, strMembershipID, nServedBy);
                DialogResult = DialogResult.OK;
            }
        }
Beispiel #2
0
 private void sbtnSave_Click(object sender, System.EventArgs e)
 {
     if (!ValidateBeforeSave())
     {
         DialogResult = DialogResult.None;
         return;
     }
     ACMSLogic.Staff.Appointment myAppointment = new ACMSLogic.Staff.Appointment();
     // New
     if (nAppointmentID < 0)
     {
         myAppointment.NewAppoinment(nEmployeeID, dateedtDate.DateTime, dateedtStartTime.DateTime,
                                     dateedtEndTime.DateTime, txtOrganization.Text, Convert.ToInt32(luedtAppointmetType.EditValue),
                                     Convert.ToInt32(luedtContact.EditValue), memoedtRemark.Text);
         DialogResult = DialogResult.OK;
     }
     else
     {
         myAppointment.EditAppointment(nAppointmentID, dateedtDate.DateTime, dateedtStartTime.DateTime,
                                       dateedtEndTime.DateTime, txtOrganization.Text, Convert.ToInt32(luedtAppointmetType.EditValue),
                                       Convert.ToInt32(luedtContact.EditValue), memoedtRemark.Text);
         DialogResult = DialogResult.OK;
     }
 }
Beispiel #3
0
        private void sbtnSave_Click(object sender, System.EventArgs e)
        {
            //bool isSuccess = false; // return value
            int myContactId = 0;
            string strContactName = txtContactPerson.Text.ToString().Trim();
            string strNRICFIN = txtNRICFIN.Text.ToString().Trim().ToUpper();
            string strMobileNo = txtMobileNo.Text.ToString().Trim();
            string strEmail = txtEmail.Text.ToString().Trim();
            string strGender = "";
            Nullable<DateTime> dtDOB = null;  //DateTime?
            int nMediaSourceID = -1;
            string strBranchCode = txtBranchCode.Text.ToString().Trim();
            string strRemarks = rtxtRemarks.Text.ToString().Trim();
            bool fPhoneCall = false;
            bool fSMS = false;
            bool fEmail = false;
            int fDNC = -1;
            string nEntryBy = nEmployeeID.ToString();
            int nStatus;

            ACMSLogic.Staff.Contacts myContact = new ACMSLogic.Staff.Contacts();

            if (rbMale.Checked)
            {
                strGender = "M";
            }
            else if (rbFemale.Checked)
            {
                strGender = "F";
            }

            if (cbStatus.Text == "Active")
            {
                nStatus = 1;
            }
            else
            {
                nStatus = 0;
            }

            #region Validation
            if (strContactName.Length == 0)
            {
                UI.ShowErrorMessage(this, "Contact person is required.", "Error");

                //txtContactPerson.Focus();
                DialogResult = DialogResult.None;

                return;
            }

            if (strNRICFIN.Length != 0)
            {
                if (!IsSingaporeNric_S(strNRICFIN) && !IsSingaporeNric_T(strNRICFIN) && !IsFinValid(strNRICFIN))
                {
                    UI.ShowErrorMessage(this, "Invalid NRIC/FIN.", "Error");
                    //luedtMediaSource.Focus();

                    DialogResult = DialogResult.None;

                    return;
                }

                //if (strStatus == "New")
                //{
                //    if (myContact.CheckDupNRIC(strNRICFIN))
                //    {
                //        UI.ShowErrorMessage(this, "NRIC/FIN already exists in Lead Management System or Members' database.", "Error");

                //        DialogResult = DialogResult.None;

                //        return;
                //    }
                //}
            }

            if (strMobileNo.Length == 0)
            {
                UI.ShowErrorMessage(this, "Mobile No. is required.", "Error");

                //txtMobileNo.Focus();
                DialogResult = DialogResult.None;

                return;
            }

            //Mobile No invalid
            if (!IsMobileNoValid(strMobileNo))
            {
                UI.ShowErrorMessage(this, "Invalid Mobile No.", "Error");
                //luedtMediaSource.Focus();

                DialogResult = DialogResult.None;

                return;
            }

            //if (strStatus == "New")
            //{
            //    if (myContact.CheckDupMobileNo(strMobileNo))
            //    {
            //        UI.ShowErrorMessage(this, "Mobile No already exists in system.", "Error");

            //        DialogResult = DialogResult.None;

            //        return;
            //    }
            //}

            //Email Address invalid
            if (strEmail.Length != 0)
            {
                if (!IsEmailValid(strEmail))
                {
                    UI.ShowErrorMessage(this, "Invalid Email Address.", "Error");
                    //luedtMediaSource.Focus();

                    DialogResult = DialogResult.None;

                    return;
                }
            }

            if (rbMale.Checked == false && rbFemale.Checked == false)
            {
                UI.ShowErrorMessage(this, "Gender is required.", "Error");

                DialogResult = DialogResult.None;

                return;
            }

            if (cbPhoneCall.Checked == false && cbSMS.Checked == false && cbEmail.Checked == false)
            {
                UI.ShowErrorMessage(this, "Media preference is required.", "Error");

                DialogResult = DialogResult.None;

                return;
            }

            //if (rbDNCYes.Checked == false && rbDNCNo.Checked == false)
            //{
            //    UI.ShowErrorMessage(this, "DNC status is required.", "Error");

            //    DialogResult = DialogResult.None;

            //    return;
            //}

            if (luedtMediaSourceCategory.Text.Length == 0 || luedtMediaSource.Text.Length == 0)
            {
                UI.ShowErrorMessage(this, "Media Source is required.", "Error");
                //luedtMediaSource.Focus();

                DialogResult = DialogResult.None;

                return;
            }

            if (luedtAssigntoStaff.Text.Length == 0)
            {
                UI.ShowErrorMessage(this, "Please assign this new contact to a staff.", "Error");
                //luedtMediaSource.Focus();

                DialogResult = DialogResult.None;

                return;
            }
            if (chkMakeAppt.Checked) // Save Appointment
            {
                if (luedtServedBy.EditValue == "")
                {
                    UI.ShowErrorMessage(this, "Please assign this new contact serve by which staff.", "Error");
                    return;
                }
            }
            #endregion

            if (cbPhoneCall.Checked == true)
            {
                fPhoneCall = true;
            }

            if (cbSMS.Checked == true)
            {
                fSMS = true;
            }

            if (cbEmail.Checked == true)
            {
                fEmail = true;
            }

            if (rbDNCYes.Checked == true)
                fDNC = 1;

            if (rbDNCNo.Checked == true)
                fDNC = 0;

            nEmployeeID = Convert.ToInt32(luedtAssigntoStaff.EditValue);
            nMediaSourceID = Convert.ToInt32(luedtMediaSource.EditValue);

            if (dateedtDOB.Text.Length != 0)
            {
                dtDOB = dateedtDOB.DateTime;
            }

            if (nContactID < 0)
            {
                TblContacts myContacts = new TblContacts();

                myContacts.AddNewLead(ref myContactId, strContactName, strNRICFIN, strMobileNo, strEmail,
                                           strGender, dtDOB, nMediaSourceID, nEmployeeID,
                                           strBranchCode, strRemarks, fPhoneCall, fSMS,
                                           fEmail, fDNC, nEntryBy);

                if (myContactId > 0)
                {
                    try
                    {
                        SendConfirmation(myContactId.ToString().Trim(), strContactName.Trim(), strEmail.Trim(), ref myContacts);
                    }
                    catch (Exception ex)
                    {
                    }

                }

                DialogResult = DialogResult.OK;
            }
            else
            {
                TblContacts myContacts = new TblContacts();

                myContacts.UpdateLead(nContactID, strContactName, strNRICFIN, strMobileNo, strEmail,
                                        strGender, dtDOB, nMediaSourceID, nEmployeeID,
                                        strBranchCode, strRemarks, Convert.ToBoolean(nStatus), fPhoneCall, fSMS,
                                        fEmail, fDNC, nEntryBy);

                DialogResult = DialogResult.OK;
                myContactId = nContactID;
            }

            if (chkMakeAppt.Checked) // Save Appointment
            {
                ACMSLogic.Staff.Appointment myAppointment = new ACMSLogic.Staff.Appointment();
                DateTime StartDateTime = Convert.ToDateTime(dateedtStartTime.Text);
                DateTime EndDateTime = Convert.ToDateTime(dateedtEndTime.Text);
                int nServedBy = Convert.ToInt32(luedtServedBy.EditValue);

                myAppointment.NewAppoinment(nEmployeeID, dateedtDate.DateTime, StartDateTime,
                   EndDateTime, "", txtBranchCode.Text, myContactId, "", "", nServedBy);
            }
        }
Beispiel #4
0
        private void sbtnSave_Click(object sender, System.EventArgs e)
        {
            if (!ValidateBeforeSave())
            {
                DialogResult = DialogResult.None;
                return;
            }
            ACMSLogic.Staff.Appointment myAppointment = new ACMSLogic.Staff.Appointment();
            // New

            StartDateTime = Convert.ToDateTime(dateedtStartTime.Text);
            EndDateTime = Convert.ToDateTime(dateedtEndTime.Text);

            string strMembershipID;
            int intContact;
            intContact = 0;
            strMembershipID = "";
            if (rbExisting.Checked )
            {
                strMembershipID = ucMemberID1.EditValue.ToString();
            }
            else
            {
                intContact = Convert.ToInt32(luedtContact.EditValue);
            }

            if (nAppointmentID < 0)
            {
                myAppointment.NewAppoinment(nEmployeeID, dateedtDate.DateTime, StartDateTime,
                   EndDateTime, "", txtBranchCode.Text, intContact, memoedtRemark.Text, strMembershipID);
                DialogResult = DialogResult.OK;
            }
            else

            {
                myAppointment.EditAppointment(nAppointmentID, nEmployeeID, dateedtDate.DateTime, StartDateTime,
                    EndDateTime, "", txtBranchCode.Text, intContact, memoedtRemark.Text, 1, strMembershipID);
                DialogResult = DialogResult.OK;
            }
        }
Beispiel #5
0
 private void sbtnSave_Click(object sender, System.EventArgs e)
 {
     if (!ValidateBeforeSave())
     {
         DialogResult = DialogResult.None;
         return;
     }
     ACMSLogic.Staff.Appointment myAppointment = new ACMSLogic.Staff.Appointment();
     // New
     if (nAppointmentID < 0)
     {
         myAppointment.NewAppoinment(nEmployeeID, dateedtDate.DateTime, dateedtStartTime.DateTime,
             dateedtEndTime.DateTime, txtOrganization.Text, Convert.ToInt32(luedtAppointmetType.EditValue),
             Convert.ToInt32(luedtContact.EditValue), memoedtRemark.Text);
         DialogResult = DialogResult.OK;
     }
     else
     {
         myAppointment.EditAppointment(nAppointmentID, dateedtDate.DateTime, dateedtStartTime.DateTime,
             dateedtEndTime.DateTime, txtOrganization.Text, Convert.ToInt32(luedtAppointmetType.EditValue),
             Convert.ToInt32(luedtContact.EditValue), memoedtRemark.Text);
         DialogResult = DialogResult.OK;
     }
 }