public bool InsertUser(SC_User user) { string sql = " Insert into SC_User (FullName,Email,Password,IsDeleted,OrganizationId,IsAdmin,IsActive," + " EnteredBy,EnteredDate,LastUpdatedBy,LastUpdatedDate) " + " values " + "( @FullName,@Email,@Password,@IsDeleted,@OrganizationId,@IsAdmin,@IsActive," + "@EnteredBy,@EnteredDate,0,null)"; using (var db = DbHelper.GetDBConnection()) { using (var trsn = new TransactionScope()) { //db.Execute(sql); var lst = db.Execute(sql, user); trsn.Complete(); db.Close(); if (lst > 0) { return(true); } else { return(false); } } } }
public bool UpdateUser(SC_User user) { string sql = " Update SC_User set FullName=@FullName,Email=@Email, Password=@Password," + " OrganizationId=@OrganizationId,IsAdmin=@IsAdmin,IsActive=@IsActive, " + " LastUpdatedBy=@LastUpdatedBy,LastUpdatedDate=@LastUpdatedDate " + " where UserId= @UserId"; using (var db = DbHelper.GetDBConnection()) { using (var trsn = new TransactionScope()) { //db.Execute(sql); var lst = db.Execute(sql, user); trsn.Complete(); db.Close(); if (lst > 0) { return(true); } else { return(false); } } } }
public ActionResult Edit(FormCollection frm) { var ses = sesrepo.GetSessionById((User as CustomPrincipal).UserId); int orgid = ses.OrganizationId; SC_User user = db.GetUserById(Convert.ToInt32(frm["UserId"])); user.FullName = frm["FullName"]; user.Email = frm["Email"]; //user.Password = frm["Password"]; user.OrganizationId = Convert.ToInt32(frm["OrganizationId"]); //if (frm["IsAdmin"] == "Y") // user.IsAdmin = true; //else // user.IsAdmin = false; user.IsDeleted = false; user.LastUpdatedBy = (User as CustomPrincipal).UserId; user.LastUpdatedDate = DateTime.Now; if (ModelState.IsValid) { db.UpdateUser(user); return(RedirectToAction("Details")); } ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name"); //ViewBag.UserId = new SelectList(ddl.GetAssetCategoryList(orgid), "Id", "Name", user.UserId); return(View(user)); }
//public SC_User Serialize() { // return new SC_User(Record); //} #endregion #region public SC_User Serialize(); public SC_User Serialize() { SO_User[] _serialisableobject; lock (record__) { int _current = Current; _serialisableobject = new SO_User[Count]; Reset(); while (Read()) { _serialisableobject[Current] = new SO_User( parent_ref_.fields_.IDUser, parent_ref_.fields_.Login, parent_ref_.fields_.Password, parent_ref_.fields_.SomeNullValue ); } Current = _current; } SC_User _serialize_out = new SC_User(); _serialize_out.SO_User = _serialisableobject; return(_serialize_out); }
public void ChangePassword(SC_User personalDetail) { string query = "Update SC_User set Password = @Password where UserId = @UserId"; using (var db = DbHelper.GetDBConnection()) { db.Execute(query, personalDetail); } }
public ActionResult ChangePassword(FormCollection frm) { SC_User user = new SC_User(); user.Password = frm["Password"]; user.UserId = (User as CustomPrincipal).UserId; db.ChangePassword(user); ViewBag.SuccessMessage = "Password was changed successfully"; return(RedirectToAction("LogOut", "Login")); }
public void editUserDetail(SC_User personalDetail) { //string query = "Update SC_User set DOB=@DOB, DOBBS=@DOBBS, Gender=@Gender, MaritalStatus=@MaritalStatus, BloodGroupId=@BloodGroupId," + // " PersonalEmail=@PersonalEmail, NationalityId=@NationalityId, PersonalNumber=@PersonalNumber"; //if (personalDetail.EmployeePhoto != null && personalDetail.EmployeePhoto != "") //{ // query += ", EmployeePhoto = @EmployeePhoto"; //} //query += " where PersonalId=@PersonalId"; //using (var db = DBHelper.GetDbConnection()) //{ // db.Execute(query, personalDetail); //} }
// GET: Category/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var ses = sesrepo.GetSessionById((User as CustomPrincipal).UserId); int orgid = ses.OrganizationId; SC_User user = db.GetUserById((int)id); if (user == null) { return(HttpNotFound()); } ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name"); // ViewBag.UserId = new SelectList(ddl.GetAssetCategoryList(orgid), "Id", "Name", user.UserId); return(View(user)); }
public ActionResult Create(FormCollection frm) { var ses = sesrepo.GetSessionById((User as CustomPrincipal).UserId); int orgid = ses.OrganizationId; SC_User user = new SC_User(); user.FullName = frm["FullName"]; user.Email = frm["Email"]; user.Password = frm["Password"]; user.OrganizationId = Convert.ToInt32(frm["OrganizationId"]); if (frm["IsAdmin"] == "Y") { user.IsAdmin = true; } else { user.IsAdmin = false; } if (frm["IsActive"] == "Y") { user.IsActive = true; } else { user.IsActive = false; } user.IsDeleted = false; user.EnteredBy = (User as CustomPrincipal).UserId; user.EnteredDate = DateTime.Now; if (ModelState.IsValid) { db.InsertUser(user); return(RedirectToAction("Index")); } ViewBag.OrganizationId = new SelectList(ddl.GetOrganizationList(), "Id", "Name"); // ViewBag.UserId = new SelectList(ddl.GetAssetCategoryList(orgid), "Id", "Name", user.UserId); return(View(user)); }
public bool ChangePassword(SC_User user) { string sql = "Update Sc_User set Password=@Password" + " where UserId=@UserId"; using (var db = DbHelper.GetDBConnection()) { using (var trsn = new TransactionScope()) { var lst = db.Execute(sql, user); trsn.Complete(); db.Close(); if (lst > 0) { return(true); } else { return(false); } } } }
public void Open(SC_User serialisablecollection_in) { Open(serialisablecollection_in.SO_User); }