Exemple #1
0
        private void UpdateAll(FeedbackContainerControl feedback)
        {
            try
            {
                var errorCount = 0;

                var oldEmail = Politicians.GetPublicEmail(PoliticianKey);
                foreach (var updateAll in _UpdateAllList)
                {
                    errorCount += updateAll(false);
                }
                var newEmail = Politicians.GetPublicEmail(PoliticianKey);
                if (oldEmail != newEmail)
                {
                    LoadContactTabData();
                    UpdatePanelContact.Update();
                    LoadSocialMediaTabData();
                    UpdatePanelSocial.Update();
                }

                feedback.AddInfo(_UpdateCount.ToString(CultureInfo.InvariantCulture) +
                                 _UpdateCount.Plural(" item was", " items were") + " updated.");
                if (errorCount > 0)
                {
                    feedback.AddError(errorCount.ToString(CultureInfo.InvariantCulture) +
                                      errorCount.Plural(" item was", " items were") +
                                      " not updated due to errors.");
                }
            }
            catch (Exception ex)
            {
                feedback.HandleException(ex);
            }
        }
Exemple #2
0
 protected void ButtonSocial_OnClick(object sender, EventArgs e)
 {
     try
     {
         // major kludge to support eamil appearing twice
         var oldEmail = Politicians.GetPublicEmail(PoliticianKey);
         UpdateAllSocialMedia(true);
         var newEmail = Politicians.GetPublicEmail(PoliticianKey);
         if (oldEmail != newEmail)
         {
             LoadContactTabData();
             UpdatePanelContact.Update();
         }
     }
     catch (Exception ex)
     {
         FeedbackSocial.HandleException(ex);
     }
 }
        //protected void GridViewAccounts_RowDeleting(object sender, GridViewDeleteEventArgs e)
        //{
        //    string nric = GridViewAccounts.DataKeys[e.RowIndex].Values["nric"].ToString();

        //    try
        //    {
        //        accountBLL.DeleteAccount(nric);
        //        ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['success']('Account, \"" + nric + "\", was Deleted successfully');", true);
        //    }
        //    catch
        //    {
        //        ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error occured when Deleting an Account');", true);
        //    }

        //    GridViewAccounts.EditIndex = -1;

        //    string term = TextboxSearch.Text.Trim().ToLower();

        //    Bind_GridViewAccounts(term);
        //}
        protected void GridViewAccounts_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string nric = e.CommandArgument.ToString();

            if (e.CommandName.Equals("ViewPersonal"))
            {
                try
                {
                    Classes.Entity.Account account = accountBLL.GetPersonalInformation(nric);
                    labelPersonalNRIC.Text            = nric;
                    inputPersonalNRIC.Value           = account.nric;
                    inputPersonalDoB.Value            = account.dateOfBirth.ToString("dd/MM/yyyy");
                    inputPersonalFirstName.Value      = account.firstName;
                    inputPersonalLastName.Value       = account.lastName;
                    inputPersonalCountryofBirth.Value = account.countryOfBirth;
                    inputPersonalNationality.Value    = account.nationality;
                    inputPersonalSex.Value            = account.sex;
                    inputPersonalGender.Value         = account.gender;
                    inputPersonalMaritalStatus.Value  = account.maritalStatus;

                    UpdatePanelPersonal.Update();
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Personal Modal", "$('#modalPersonal').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Personal Information of " + nric + ".');", true);
                }
            }
            if (e.CommandName.Equals("ViewContact"))
            {
                try
                {
                    Classes.Entity.Account account = accountBLL.GetContactInformation(nric);
                    labelContactNRIC.Text    = nric;
                    inputAddress.Value       = account.address;
                    inputPostalCode.Value    = account.addressPostalCode;
                    inputEmailAddress.Value  = account.email;
                    inputContactNumber.Value = account.contactNumber;

                    UpdatePanelContact.Update();
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Contact Modal", "$('#modalContact').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Contact Information of " + nric + ".');", true);
                }
            }
            if (e.CommandName.Equals("ViewPatient"))
            {
                try
                {
                    Classes.Entity.Account account = accountBLL.GetPatientInformation(nric);
                    // Just info
                    labelPatientNRIC.Text        = nric;
                    inputPatientNokName.Value    = account.nokName;
                    inputPatientNokContact.Value = account.nokContact;

                    //Emergency
                    ViewState["GridViewAccountsSelectedNRIC"] = nric;
                    string therapistTerm = TextboxSearchTherapist.Text.Trim().ToLower();
                    Bind_GridViewTherapists(nric, therapistTerm);
                    Bind_GridViewTherapists2(nric);

                    UpdatePanelPatient.Update();
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Patient Modal", "$('#modalPatient').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Patient Information of " + nric + ".');", true);
                }
            }
            if (e.CommandName.Equals("ViewTherapist"))
            {
                try
                {
                    ViewState["GridViewAccountsSelectedNRIC"] = nric;
                    inputTherapistJobTitle.Attributes.Add("class", "form-control form-control-sm");
                    inputTherapistDepartment.Attributes.Add("class", "form-control form-control-sm");
                    spanMessageTherapistDetailsUpdate.Visible = false;
                    RefreshTherapistModal(nric);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Therapist Modal", "$('#modalTherapist').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Therapist Information of " + nric + ".');", true);
                }
            }
            if (e.CommandName.Equals("ViewResearcher"))
            {
                try
                {
                    ViewState["GridViewAccountsSelectedNRIC"] = nric;
                    inputResearcherJobTitle.Attributes.Add("class", "form-control form-control-sm");
                    inputResearcherDepartment.Attributes.Add("class", "form-control form-control-sm");
                    spanMessageResearcherUpdate.Visible = false;
                    RefreshResearcherModal(nric);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Researcher Modal", "$('#modalResearcher').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Researcher Information of " + nric + ".');", true);
                }
            }
            if (e.CommandName.Equals("ViewStatus"))
            {
                try
                {
                    ViewState["GridViewAccountsSelectedNRIC"] = nric;

                    RefreshStatusModal(nric);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Status Modal", "$('#modalStatus').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Status Information of " + nric + ".');", true);
                }
            }

            string term = TextboxSearch.Text.Trim().ToLower();

            Bind_GridViewAccounts(term);
        }