protected void login_Click(object sender, EventArgs e) { GetAccountRequest request = new GetAccountRequest(); request.Account = tbAccountName.Text; Response <Account> account = _masterService.GetAccount(request); if (!account.Success) { lblError.Text = (String)GetLocalResourceObject(account.Message); } AccountRecoveryRequest recoverRequest = new AccountRecoveryRequest(); recoverRequest.Email = tbUsername.Text; PasswordRecoveryResponse response = _systemService.RequestPasswordRecovery(recoverRequest); if (response.Success) { X.Msg.Alert("Recovery", "Your Password has been sent to your email!"); //Redirecting.. Response.Redirect("Login.aspx", true); } else { lblError.Text = response.Summary;//(String)GetLocalResourceObject(response.Message); } }
public PasswordRecoveryResponse RequestPasswordRecovery(AccountRecoveryRequest request) { PasswordRecoveryResponse response = new PasswordRecoveryResponse(); Dictionary <string, string> headers = SessionHelper.GetAuthorizationHeadersForUser(); Dictionary <string, string> parameters = new Dictionary <string, string>(); RecordWebServiceResponse <UserInfo> userRecord = childRepo.RequestPasswordRecovery(headers, request.Parameters); response = CreateServiceResponse <PasswordRecoveryResponse>(userRecord); // if (response.Success) return(response); }
public Response <Account> RequestAccountRecovery(AccountRecoveryRequest request) { Response <Account> response; SessionHelper.ClearSession(); SessionHelper.Set("AccountId", "0"); Dictionary <string, string> headers = SessionHelper.GetAuthorizationHeadersForUser(); var webResponse = _accountRepository.GetRecord(headers, request.Parameters); response = CreateServiceResponse <Response <Account> >(webResponse); if (!response.Success) { response.Message = ""; } return(response); }
protected void login_Click(object sender, EventArgs e) { AccountRecoveryRequest request = new AccountRecoveryRequest(); request.Email = tbUsername.Text; //request.Account = tbAccountName.Text; Response <Account> account = _masterService.RequestAccountRecovery(request); if (!account.Success) { lblError.Text = "Error";//(String)GetLocalResourceObject(account.Message); } else { Response.Redirect("~/Login.aspx"); } }
protected void SaveNewRecord(object sender, DirectEventArgs e) { //Getting the id to check if it is an Add or an edit as they are managed within the same form. string id = e.ExtraParams["id"]; string obj = e.ExtraParams["values"]; UserInfo b = JsonConvert.DeserializeObject <UserInfo>(obj); b.recordId = id; // Define the object to add or edit as null if (employeeId.SelectedItem != null) { b.employeeId = employeeId.SelectedItem.Value; } if (string.IsNullOrEmpty(id)) { try { //New Mode //Step 1 : Fill The object and insert in the store PostRequest <UserInfo> request = new PostRequest <UserInfo>(); b.password = "******"; request.entity = b; PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request); if (!r.Success) //check if the insert failed { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, r.Summary).Show(); return; } b.recordId = r.recordId; AccountRecoveryRequest req = new AccountRecoveryRequest(); req.Email = b.email; PasswordRecoveryResponse response = _systemService.RequestPasswordRecovery(req); if (!response.Success) //check if the insert failed { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, response.Summary).Show(); return; } else { //Add this record to the store this.Store1.Insert(0, b); //Display successful notification Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordSavingSucc }); this.EditRecordWindow.Close(); RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel; sm.DeselectAll(); sm.Select(b.recordId.ToString()); } } catch (Exception ex) { //Error exception displaying a messsage box X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show(); } } else { //Update Mode try { int index = Convert.ToInt32(id);//getting the id of the record PostRequest <UserInfo> request = new PostRequest <UserInfo>(); request.entity = b; PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request); //Step 1 Selecting the object or building up the object for update purpose //Step 2 : saving to store //Step 3 : Check if request fails if (!r.Success)//it maybe another check { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show(); return; } else { ModelProxy record = this.Store1.GetById(index); BasicInfoTab.UpdateRecord(record); record.Set("fullName", b.fullName); record.Commit(); Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordUpdatedSucc }); this.EditRecordWindow.Close(); } } catch (Exception ex) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show(); } } }
public static AccountRecoveryRequest CreateAccountRecoveryRequest(int accountRecoveryRequestID, string email, global::System.DateTime dateIssued, bool resolved) { AccountRecoveryRequest accountRecoveryRequest = new AccountRecoveryRequest(); accountRecoveryRequest.AccountRecoveryRequestID = accountRecoveryRequestID; accountRecoveryRequest.Email = email; accountRecoveryRequest.DateIssued = dateIssued; accountRecoveryRequest.Resolved = resolved; return accountRecoveryRequest; }
public void AddToAccountRecoveryRequests(AccountRecoveryRequest accountRecoveryRequest) { base.AddObject("AccountRecoveryRequests", accountRecoveryRequest); }
protected void SaveNewRecord(object sender, DirectEventArgs e) { //Getting the id to check if it is an Add or an edit as they are managed within the same form. string id = e.ExtraParams["id"]; string obj = e.ExtraParams["values"]; UserInfo b = JsonConvert.DeserializeObject <UserInfo>(obj); b.activeStatus = isInactiveCheck.Checked ?Convert.ToInt16(ActiveStatus.INACTIVE) : Convert.ToInt16(ActiveStatus.ACTIVE); b.recordId = id; // Define the object to add or edit as null if (employeeId.SelectedItem != null && employeeId.SelectedItem.Value != null) { b.employeeId = employeeId.SelectedItem.Value; b.fullName = employeeId.SelectedItem.Text; } if (string.IsNullOrEmpty(CurrentUser.Text)) { try { //New Mode //Step 1 : Fill The object and insert in the store PostRequest <UserInfo> request = new PostRequest <UserInfo>(); b.password = EncryptionHelper.encrypt(b.password); request.entity = b; PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request); if (!r.Success) //check if the insert failed { //Show an error saving... X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(r); return; } b.recordId = r.recordId; //elias AccountRecoveryRequest req = new AccountRecoveryRequest(); req.Email = b.email; //PasswordRecoveryResponse response = _systemService.RequestPasswordRecovery(req); //if (!response.Success) //{ // //Show an error saving... // X.MessageBox.ButtonText.Ok = Resources.Common.Ok; // Common.errorMessage(response); // return; //} //else //{ //Add this record to the store Store1.Reload(); CurrentUser.Text = r.recordId; userGroups.Disabled = false; //Display successful notification Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordSavingSucc }); //this.EditRecordWindow.Close(); //RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel; //sm.DeselectAll(); //sm.Select(b.recordId.ToString()); } catch (Exception ex) { //Error exception displaying a messsage box X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show(); } } else { //Update Mode try { int index = Convert.ToInt32(id);//getting the id of the record PostRequest <UserInfo> request = new PostRequest <UserInfo>(); request.entity = b; PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request); //Step 1 Selecting the object or building up the object for update purpose //Step 2 : saving to store //Step 3 : Check if request fails if (!r.Success)//it maybe another check { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; Common.errorMessage(r); return; } else { Store1.Reload(); Notification.Show(new NotificationConfig { Title = Resources.Common.Notification, Icon = Icon.Information, Html = Resources.Common.RecordUpdatedSucc }); this.EditRecordWindow.Close(); } } catch (Exception ex) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show(); } } }