public JsonResult SaveBankAccount(int OrgBankAccountId, int BankBranchId, int OrganizationId, string BankAccountNo) { try { if (BankBranchId == 0) { return(Json(new { Result = "ERROR", Message = "Select Bank Branch" }, JsonRequestBehavior.AllowGet)); } else if (OrganizationId == 0) { return(Json(new { Result = "ERROR", Message = "Select Organization" }, JsonRequestBehavior.AllowGet)); } else if (BankAccountNo == "" || BankAccountNo == null) { return(Json(new { Result = "ERROR", Message = "Insert Bank Account No" }, JsonRequestBehavior.AllowGet)); } else { if (OrgBankAccountId == 0) { spService.GetDataBySqlCommand("INSERT INTO OrganizationBankAccount(BankBranchId,OrganizationId,BankAccountNo,EntryDate,EntryUserId,IsActive)Values(" + BankBranchId + "," + OrganizationId + ",'" + BankAccountNo + "','" + DateTime.Now + "'," + SessionHelper.LoggedInUserId + ",1)"); return(Json(new { Result = "Success", Message = "Save Successfull." }, JsonRequestBehavior.AllowGet)); } else { spService.GetDataBySqlCommand("UPDATE OrganizationBankAccount SET BankBranchId = " + BankBranchId + ",OrganizationId = " + OrganizationId + ",BankAccountNo = '" + BankAccountNo + "',UpdateDate = GETDATE(),UpdateUserId= " + SessionHelper.LoggedInUserId + " WHERE Id = " + OrgBankAccountId + ""); return(Json(new { Result = "Success", Message = "Update Successfull." }, JsonRequestBehavior.AllowGet)); } } } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult RegisterInfoResetPassword(string UserId) { try { var entity = aspNetUserService.GetByUserId(Convert.ToInt32(UserId)); string EmployeeName = string.Empty; EmployeeName = officeExecutiveService.GetByEmail(entity.UserName).ExecutiveName; Random rnd = new Random(); int myRandomNo = rnd.Next(10000000, 99999999); //var myRandomNo = "12345678"; userManager.RemovePassword(entity.Id); userManager.AddPassword(entity.Id, myRandomNo.ToString()); sPService.GetDataBySqlCommand("UPDATE AspNetUsers SET Hashing='" + myRandomNo.ToString() + "' WHERE UserId=" + UserId); ReportHelper.SendEmail(entity.UserName, "Password Reset Confirmation", PopulateBody(EmployeeName, myRandomNo.ToString())); return(Json(new { Result = "Ok", Message = "Password changed successfull" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Result = "Error", Message = ex.Message }, JsonRequestBehavior.AllowGet)); } }