private void UserDashborad_Load(object sender, EventArgs e) { this.Dashboard_Click(sender, e); try { String profileId = Properties.Settings.Default.profileId; if (profileId.Equals("")) { List <ProfileModel> profiles = new ProfileApiService().getProfiles(false); if (profiles != null) { Properties.Settings.Default.profileId = profiles.First().profileId.ToString(); } else { UserMessage.showSuccessMessage(CommonMessage.PROFILE_CREATED_MESSAGE); } } new ProfileManagement().loadProfiles(); } catch (Exception msg) { UserMessage.ShowExceptions(msg.Message); } }
private void deleteProfile_bgWorker_DoWork(object sender, DoWorkEventArgs e) { try { String result = new ProfileApiService().deleteProfile(this.userProfile); if (result != null) { UserMessage.showSuccessMessage(CommonMessage.PROFILE_DELETE_SUCCESS_MESSAGE); this.InvokeProfile(); } } catch (Exception msg) { UserMessage.ShowExceptions(msg.Message); } }
private void updateProfile_bgWorker_DoWork(object sender, DoWorkEventArgs e) { try { string userBodyData = JsonConvert.SerializeObject(new { profileId = this.userProfile.profileId, profileName = profileName.Text, type = this.userProfile.type, version = this.userProfile.version }); ProfileModel result = new ProfileApiService().updateProfile(this.userProfile, userBodyData); if (result != null) { UserMessage.showSuccessMessage(CommonMessage.PROFILE_UPDATE_SUCCESS); this.InvokeProfile(); } } catch (Exception msg) { UserMessage.ShowExceptions(msg.Message); } }
private void createProfile_bgWorker_DoWork(object sender, DoWorkEventArgs e) { try { string userBodyData = JsonConvert.SerializeObject(new { profileName = ProfileName.Text, type = this.ProfileTypeValue }); ProfileModel result = new ProfileApiService().createProfile(userBodyData); if (result != null) { UserMessage.showSuccessMessage(CommonMessage.PROFILE_SUCCESS); this.InvokeProfile(); } else { throw new Exception(CommonMessage.PROFILE_NOT_SAVE); } } catch (Exception msg) { UserMessage.ShowExceptions(msg.Message); } }
public void loadProfileTypes() { try { List <ProfileTypes> profileTypesResult = new ProfileApiService().getProfilesType(); if (profileTypesResult.Any()) { infoProfileTabel.Visible = true; this.setDataGridViewValues(profileTypesResult); ProfileTypesComboBox.DisplayMember = "Text"; ProfileTypesComboBox.ValueMember = "Value"; profilePayment.Text = GlobalClass.user.userBalance.ToString() + " /-"; profileTypesResult.ForEach(delegate(ProfileTypes profileType) { ProfileTypesComboBox.Items.Add(new { Text = "Select " + profileType.type.ToString().ToLower() + " profile and pay " + profileType.cost.ToString() + "/- monthly ", Value = profileType.type.ToString() }); }); ProfileTypesComboBox.SelectedIndex = 0; } } catch (Exception msg) { UserMessage.ShowExceptions(msg.Message); } }