public string CheckFiledsUpdated(LoginDetail lgCheckDetails) { LoginDetail oldLogindetails = new Models.LoginDetail(); StringBuilder UpdatedStaus = new StringBuilder(); oldLogindetails = (LoginDetail)Session["lgReadDetails"]; if (oldLogindetails.UserName != lgCheckDetails.UserName) { UpdatedStaus.Append("Updated UserName" + lgCheckDetails.UserName + "\n"); } if (oldLogindetails.EmailId != lgCheckDetails.EmailId) { UpdatedStaus.Append("Your Updated Email Id:" + lgCheckDetails.EmailId + "\n"); } if (oldLogindetails.RoleId != lgCheckDetails.RoleId) { UpdatedStaus.Append("Your Role has been Changed to:" + lgCheckDetails.RoleId + "\n"); } if (oldLogindetails.Password != lgCheckDetails.Password) { UpdatedStaus.Append("Your Updated Password is:" + lgCheckDetails.Password + "\n"); } if (Convert.ToBoolean(oldLogindetails.IsActive) != lgCheckDetails.IsActive) { UpdatedStaus.Append("Your Acccount is Blocked Please Contact to Administrator"); } return(UpdatedStaus.ToString()); }
public ActionResult EditLogin(int?Id) { ViewBag.UserTypeId = new SelectList(db.Doctors, "DoctorId", "Name"); SqlCommand cmd = new SqlCommand("sp_get_ROLES", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); List <MedicosRX.Models.Roles> GetRoles = new List <MedicosRX.Models.Roles>(); foreach (DataRow dr in ds.Tables[0].Rows) { GetRoles.Add(new MedicosRX.Models.Roles { RoleId = Convert.ToInt32(dr["RoleId"]), RoleName = Convert.ToString(dr["RoleName"]), }); ViewBag.Roles = new SelectList(GetRoles.ToList(), "RoleId", "RoleName"); } SqlCommand cmd1 = new SqlCommand("sp_Update_LoginUsers", con); cmd1.CommandType = CommandType.StoredProcedure; cmd1.Parameters.AddWithValue("@UserId", Id); SqlDataAdapter da1 = new SqlDataAdapter(cmd1); DataSet ds1 = new DataSet(); da1.Fill(ds1); LoginDetail lgReadDetails = new Models.LoginDetail(); foreach (DataRow dr1 in ds1.Tables[0].Rows) { lgReadDetails.UserId = Convert.ToInt32(dr1["UserId"]); lgReadDetails.UserName = Convert.ToString(dr1["UserName"]); lgReadDetails.EmailId = Convert.ToString(dr1["EmailId"]); lgReadDetails.RoleId = Convert.ToInt32(dr1["RoleId"]); lgReadDetails.Password = Convert.ToString(dr1["Password"]); lgReadDetails.IsActive = Convert.ToBoolean(dr1["IsActive"]); } Session["lgReadDetails"] = lgReadDetails; return(View(lgReadDetails)); }