public HomeHealthForm(HCAH HCAH)
 {
     InitializeComponent();
     try
     {
         objHCAH    = HCAH;
         this.Title = objHCAH.name;
         CommonDropDowns objCommonDropDowns = new Models.CommonDropDowns();
         pkrGender.ItemsSource = objCommonDropDowns.Gender();
     }
     catch (Exception ex)
     {
         DependencyService.Get <IMessage>().LongAlert();
     }
 }
示例#2
0
        private async void UpdateDetails()
        {
            lblerrorheader.Text = "";
            lblError.Text       = "";
            if (Validations())
            {
                CommonDropDowns   objCommonDropDowns   = new Models.CommonDropDowns();
                UpdateUserDetails objUpdateUserDetails = new Models.UpdateUserDetails();
                objUpdateUserDetails.name            = txtName.Text.Trim();
                objUpdateUserDetails.email           = txtEmail.Text.Trim();
                objUpdateUserDetails.phone           = txtPhone.Text.Trim();
                objUpdateUserDetails.designation     = txtDesignation.Text.Trim();
                objUpdateUserDetails.date_of_birth   = Convert.ToDateTime(txtDob.Date).ToString("yyyy-MM-dd");
                objUpdateUserDetails.gender          = ((CommonDropDowns)pkrGender.SelectedItem).Name;
                objUpdateUserDetails.blood_group     = pkrBloodGroup.SelectedItem.ToString();
                objUpdateUserDetails.seniority_level = ((CommonDropDowns)pkrseniorityLevel.SelectedItem).ID.ToString();
                UserDetailsInfo objUserDetailsInfo = new Models.UserDetailsInfo()
                {
                    emergency_number = txtEmergencyNumber.Text != null?txtEmergencyNumber.Text.Trim() : "", employee_id = txtId.Text != null?txtId.Text.Trim() : ""
                };
                objUpdateUserDetails.info = objUserDetailsInfo;
                object response = await App.TodoManager.UpdateProfileDetails(objUpdateUserDetails);

                if (response is UserDetais)
                {
                    lblError.TextColor       = Color.Green;
                    lblerrorheader.TextColor = Color.Green;
                    lblerrorheader.Text      = "";
                    lblError.Text            = "Profile Updated successfully";

                    #region ChangeDatainSQL
                    // Change data in sql lite after updating profile
                    LoggedInUser objLogedInUser = new LoggedInUser();
                    objLogedInUser.sso_token     = App.Authorization;
                    objLogedInUser.id            = App.id;
                    objLogedInUser.Name          = txtName.Text;
                    objLogedInUser.photo_url     = App.KyorData.photo_url;
                    objLogedInUser.Designation   = txtDesignation.Text;
                    objLogedInUser.CorporateLogo = App.CorporateImageURl;
                    objLogedInUser.Gender        = objUpdateUserDetails.gender;
                    //objLogedInUser.MaritalStatus = objUpdateUserDetails.marital_status;
                    App.Database.SaveItem(objLogedInUser);
                    App.KyorData.name = txtName.Text;
                    App.Gender        = objUpdateUserDetails.gender;
                    //  App.MaritalStatus = objUpdateUserDetails.marital_status;
                    #endregion
                    DependencyService.Get <IMessage>().LongAlert("Profile Updated successfully");
                }
                else
                {
                    string        ErrorString      = "";
                    PasswordError objPasswordError = (PasswordError)response;
                    foreach (var v in objPasswordError.errors.validation)
                    {
                        ErrorString += string.Join("\n", v.Value);
                    }
                    lblError.TextColor       = Color.Red;
                    lblError.Text            = ErrorString;
                    lblerrorheader.Text      = "Validations";
                    lblerrorheader.TextColor = Color.Red;
                    DependencyService.Get <IMessage>().LongAlert("Unable to pass validations");
                }
            }
        }