public ActionResult Logout() { try { ClsUser objClsUser = this.objiClsUser as ClsUser; objClsUser = this.objiClsUser.GetUserByUserId(mySession.Current.UserId); //if (objClsUser != null) //{ // objClsUser.blIsLogin = false; // this.objiClsUser.SaveUser(objClsUser); //} this.objiClsUser.InserActivityLogOfUser(objClsUser.strUserName, objClsUser.strPassword.EncryptString(), "User", false); // true => User Logout Functions.LogoutUser(); this.ViewData.Clear(); this.TempData.Clear(); return(this.RedirectToAction("Login")); } catch (Exception ex) { Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.LgCommon); throw; } }
public void GetAllEmployee(string EmpID, string AppLoginKey, string CompanyID) { ClsUser objuser = new ClsUser(); DataSet ds = new DataSet(); GeneralMethod objgen = new GeneralMethod(); if (checkAppKey(EmpID, AppLoginKey)) { objuser.loginid = ""; objuser.name = ""; objuser.companyid = CompanyID; objuser.action = "select"; objuser.activestatus = "active"; ds = objuser.ManageEmployee(); if (ds.Tables[0].Rows.Count > 0) { ResponseData(objGen.serilizeinJson(ds.Tables[0])); } else { ResponseData("[]"); } } else { ResponseError(); } }
public static List <string> getName(string prefixText) { ClsUser objuser = new ClsUser(); DataSet ds1 = new DataSet(); objuser.id = ""; objuser.action = "SearchActiveUsersExceptMe"; objuser.deptid = ""; objuser.fname = ""; objuser.companyid = HttpContext.Current.Session["CompanyId"].ToString(); ds1 = objuser.ManageEmployee(); List <string> items = new List <string>(); if (ds1.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { items.Add(ds1.Tables[0].Rows[i]["username"].ToString().ToUpper()); } } var returnList = items.Where(item => item.Contains(prefixText.ToUpper())).ToList(); returnList.Sort(); return(returnList); }
public ActionResult ChangePassword(string strCurrentPwd, string strNewPwd) { try { if (mySession.Current.Password == strCurrentPwd.EncryptString()) { ClsUser objUser = this.objiClsUser.ChangePassword(mySession.Current.UserId, strNewPwd); Functions.UpdateCookies(mySession.Current.UserName, strNewPwd.EncryptString(), mySession.Current.UserId.ToString(), mySession.Current.Fullname, mySession.Current.Rememberme, mySession.Current.RoleId.ToString(), mySession.Current.BranchId.ToString(), "false", mySession.Current.SessionDurationHour, objUser.strFirstName, objUser.strSurName); return(this.Json("Success", JsonRequestBehavior.AllowGet)); } else { return(this.Json("CurrentWrong", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.LgCommon); throw; } }
public static string saveempFileLink(string nid) { ClsUser objts = new ClsUser(); DataSet ds = new DataSet(); string msg = ""; msg = "failed"; objts.action = "setfilesharelink"; objts.id = nid; try { ds = objts.ManageEmployee(); if (ds.Tables[0].Rows.Count > 0) { msg = ds.Tables[0].Rows[0]["filesharelink"].ToString(); } return(msg); } catch (Exception ex) { msg = ex.Message; return(msg); } }
public void fillusers() { ClsUser objuser = new ClsUser(); objuser.action = "select"; objuser.companyid = Session["companyid"].ToString(); objuser.id = ""; ds = objuser.ManageEmployee(); if (ds.Tables[0].Rows.Count > 0) { //dropemployee.DataSource = ds; //dropemployee.DataTextField = "username"; //dropemployee.DataValueField = "nid"; //dropemployee.DataBind(); objgen.fillActiveInactiveDDL(ds.Tables[0], droppreperedby4, "username", "nid"); objgen.fillActiveInactiveDDL(ds.Tables[0], dropfinilizedby5, "username", "nid"); ListItem li = new ListItem("--Select--", ""); droppreperedby4.Items.Insert(0, li); dropfinilizedby5.Items.Insert(0, li); } droppreperedby4.SelectedIndex = 0; dropfinilizedby5.SelectedIndex = 0; }
public ActionResult DeleteConfirmed(int id) { ClsUser clsUser = db.Users.Find(id); db.Users.Remove(clsUser); db.SaveChanges(); return(RedirectToAction("Index")); }
private string ValidateUser(ClsUser objUser) { try { string strErrorMsg = string.Empty; if (string.IsNullOrEmpty(objUser.strFirstName)) { strErrorMsg += Functions.AlertMessage("First Name", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.strSurName)) { strErrorMsg += Functions.AlertMessage("Surname", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.strMobileNo)) { strErrorMsg += Functions.AlertMessage("Mobile No", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.strEmailID)) { strErrorMsg += Functions.AlertMessage("Email Id", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.strUserName)) { strErrorMsg += Functions.AlertMessage("User Name", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.strPassword)) { strErrorMsg += Functions.AlertMessage("Password", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.strConfirmPassword)) { strErrorMsg += Functions.AlertMessage("Confirm Password", MessageType.InputRequired) + "<br/>"; } if (objUser.strConfirmPassword != objUser.strPassword) { strErrorMsg += Functions.AlertMessage("Password", MessageType.PasswordNotMatch) + "<br/>"; } //if (objUser.lgRoleId == 0) //{ // strErrorMsg += Functions.AlertMessage("Role", MessageType.SelectRequired) + "<br/>"; //} return(strErrorMsg); } catch (Exception ex) { Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.User, mySession.Current.UserId); return(string.Empty); } }
public ActionResult Edit([Bind(Include = "ID,Pass,Name,Address")] ClsUser clsUser) { if (ModelState.IsValid) { db.Entry(clsUser).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(clsUser)); }
//api/TestApi/DeleteById/1 public void DeleteById(string id = "3f2b12b8-2a06-45b4-b057-45949279b4e5") { var filetext = System.IO.File.ReadAllText(pathname); List <ClsUser> lstUser = JsonConvert.DeserializeObject <List <ClsUser> >(filetext); ClsUser objectuser = (from rowobject in lstUser where rowobject.Id == id select rowobject).FirstOrDefault(); lstUser.Remove(objectuser); System.IO.File.WriteAllText(@"C:\Users\Administrator\Desktop\TEST2208\UserDelete.txt", JsonConvert.SerializeObject(lstUser)); }
protected void Page_Load(object sender, EventArgs e) { ClsUser us = new ClsUser(); string user = us.UserId;; if (user == null) { Response.Redirect("FrmLogin.aspx"); } }
async Task InsertUser(ClsUser user) { try { await apiCore.PostUser(user); } catch (Exception ex) { await dialogService.DisplayAlertAsync("There was an error", $"{ex.Message}", "Ok"); } }
public ActionResult Create([Bind(Include = "ID,Pass,Name,Address")] ClsUser clsUser) { if (ModelState.IsValid) { db.Users.Add(clsUser); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(clsUser)); }
public HttpResponseMessage ProjectManagerList() { try { var objuser = new ClsUser(); return(Request.CreateResponse(HttpStatusCode.OK, objuser.ProjectManagerList())); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public HttpResponseMessage CheckUserLogin(PMSModels.CheckLogin checkLogin) { try { var objuser = new ClsUser(); return(Request.CreateResponse(HttpStatusCode.OK, objuser.CheckUserLogin(checkLogin))); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public static string getClient(string companyid) { ClsUser objuser = new ClsUser(); DataSet ds = new DataSet(); GeneralMethod objgen = new GeneralMethod(); objuser.action = "selectforautocompleter"; objuser.companyid = companyid; ds = objuser.client(); string result = objgen.serilizeinJson(ds.Tables[0]); return(result); }
public void sendreschedulemail(DataTable dt, string companyid) { ClsUser objuser = new ClsUser(); DataAccess objda = new DataAccess(); DataSet ds = new DataSet(); string bccemail = ""; string receiver = ""; string cc = ""; string bcc = bccemail; string filename = ""; string message = ""; if (dt != null) { if (dt.Rows.Count > 0) { //Get users who have Access to Add Schedule to Send Email CC cc = objda.GetCompanyProperty("ReceiverMail") + ","; objuser.action = "selectschedulemanager"; objuser.companyid = companyid; objuser.id = ""; ds = objuser.ManageEmployee(); if (ds != null) { if (ds.Tables[1].Rows.Count > 0) { //This will return all managers Email Id separated by comma if (ds.Tables[1].Rows[0]["EmailCC"] != null) { cc = ds.Tables[1].Rows[0]["EmailCC"].ToString(); } } } for (int i = 0; i < dt.Rows.Count; i++) { receiver = dt.Rows[i]["emailid"].ToString() + ","; message = dt.Rows[i]["mailmessage"].ToString(); string subject = dt.Rows[i]["mailsubject"].ToString(); try { objda.SendEmail(receiver, subject, message, cc, bcc, filename); } catch { } } } } }
public ActionResult Login(ClsUser objLogin) { try { _authentication.LoginUser(objLogin.StrUserName, objLogin.StrPassword, objLogin.BlRememberMe.ToString()); return(RedirectToAction("Index", "Home")); } catch (Exception ex) { Logger.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.LgCommon); return(View(objLogin)); } }
public static string getManager(string companyid) { ClsUser objuser = new ClsUser(); DataSet ds = new DataSet(); GeneralMethod objgen = new GeneralMethod(); objuser.action = "selectactive"; objuser.id = ""; objuser.companyid = companyid; ds = objuser.ManageEmployee(); string result = objgen.serilizeinJson(ds.Tables[0]); return(result); }
/////////////////////////////////////////////////////////////////// // Copied from view.aspx.cs /////////////////////////////////////////////////////////////////// private void retrieve(string ID) { ClsUtil u = ClsUtil.Instance(); string strQuery = "SELECT * FROM [User] WHERE ID = " + ClsUtil.sqlEncode(ID); if (ClsUtil._DEBUG) { Response.Write(strQuery); } string strConn = u.strConn(); SqlConnection conn = null; try { conn = new SqlConnection(strConn); SqlCommand comm = new SqlCommand(strQuery, conn); conn.Open(); using (SqlDataReader sdr = comm.ExecuteReader()) { if (sdr.Read()) { this.first_name = ClsUtil.getStrVal(sdr["first_name"]); this.last_name = ClsUtil.getStrVal(sdr["last_name"]); this.email = ClsUtil.getStrVal(sdr["email"]); this.login = ClsUtil.getStrVal(sdr["login"]); this.note = ClsUtil.getStrVal(sdr["note"]); this.gid = ClsUtil.getStrVal(sdr["gid"]); //this.create_by = ClsUser.getUserNameById(ClsUtil.getStrVal(sdr["create_User_id"])); //this.create_datetime = ClsUtil.getStrVal(sdr["create_datetime"]); this.last_update_by = ClsUser.getUserNameById(ClsUtil.getStrVal(sdr["last_update_User_id"])); this.last_update_datetime = ClsUtil.getStrVal(sdr["last_update_datetime"]); this.disabled = ClsUtil.getStrVal(sdr["disabled"]); } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (conn != null) { conn.Close(); } } }
public static string deletedata(string companyid, string nid) { ClsUser objda = new ClsUser(); DataSet ds = new DataSet(); GeneralMethod objgen = new GeneralMethod(); objda.action = "delete"; objda.id = nid; ds = objda.ManageEmployee(); string result = objgen.serilizeinJson(ds.Tables[0]); return(result); }
// GET: Home/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ClsUser clsUser = db.Users.Find(id); if (clsUser == null) { return(HttpNotFound()); } return(View(clsUser)); }
private string ValidateUser(ClsUser objUser) { try { string strErrorMsg = string.Empty; if (string.IsNullOrEmpty(objUser.StrFirstName)) { strErrorMsg += _alertTextProvider.AlertMessage("First Name", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.StrSurName)) { strErrorMsg += _alertTextProvider.AlertMessage("Surname", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.StrMobileNo)) { strErrorMsg += _alertTextProvider.AlertMessage("Mobile No", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.StrEmailID)) { strErrorMsg += _alertTextProvider.AlertMessage("Email Id", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.StrUserName)) { strErrorMsg += _alertTextProvider.AlertMessage("User Name", MessageType.InputRequired) + "<br/>"; } if (string.IsNullOrEmpty(objUser.StrPassword)) { strErrorMsg += _alertTextProvider.AlertMessage("Password", MessageType.InputRequired) + "<br/>"; } if (objUser.LgRoleId == 0) { strErrorMsg += _alertTextProvider.AlertMessage("Role", MessageType.SelectRequired) + "<br/>"; } return(strErrorMsg); } catch (Exception ex) { Logger.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.User, _mySession.UserId); return(string.Empty); } }
void CtlGrid_btnDeleteClicked(int RowID) { try { varID = Convert.ToInt32(objUserCollection[RowID].ID); if (System.Windows.MessageBox.Show("Do You Really Want To Delete This Record ?", "Delete User", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { ClsUser.Delete(varID); System.Windows.MessageBox.Show("Record Deleted!!", "User Deleted", MessageBoxButton.OK, MessageBoxImage.Information); funSetGrid(); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "CtlGrid_btnDeleteClicked", "CtlUserInfo.xaml.cs"); } }
public static string deleteLog(string nid) { string msg = "failure"; GeneralMethod objgen = new GeneralMethod(); DataSet ds = new DataSet(); ClsUser obj = new ClsUser(); try { obj.id = nid; obj.action = "delete"; ds = obj.manageProjectLog(); msg = "1"; return(msg); } catch { return(msg); } }
protected void Page_Load(object sender, EventArgs e) { if (!ClsAuth.IsUser()) { this.msg.Text = "Not a valid user."; return; } string ID = Session["userid"].ToString(); if (this.IsPostBack) { try { this.msg.Text = ""; this.retrieveRequest(); this.retrieveDB(ID); //Response.Write(this.db_old_pwd_hash + "=?=" + this.old_pwd ); if (this.db_old_pwd_hash != this.old_pwd) { this.msg.Text = "<p><font color='red'>Invalid old password.</font></p>"; } else { string check = ClsUser.validate_pwd(this.new_pwd, this.new_pwd2); if (check != "") { this.msg.Text = "<p><font color='red'>" + check + ".</font></p>"; } else { this.update(ID); this.msg.Text = "<p><font color='green'>Your password has been updated.</font> </p>"; } } } catch (Exception ex) { this.msg.Text = "<p><font color='red'>" + ex.Message + "</font></p>"; } } else { this.msg.Text = ""; } }
// api/TestApi/UpdateDataById/1 public IHttpActionResult UpdateDataById(string id = "3f2b12b8-2a06-45b4-b057-45949279b4e5", [FromBody] string strvalues = "Credit") { var filetext = System.IO.File.ReadAllText(pathname); List <ClsUser> lstUser = JsonConvert.DeserializeObject <List <ClsUser> >(filetext); ClsUser objectuser = (from rowobject in lstUser where rowobject.Id == id select rowobject).FirstOrDefault(); lstUser.Remove(objectuser); objectuser.Type = strvalues; lstUser.Add(objectuser); System.IO.File.WriteAllText(@"C:\Users\Administrator\Desktop\TEST2208\UserUpdate.txt", JsonConvert.SerializeObject(lstUser)); return(Ok()); }
protected void fillclients() { ClsUser objuser = new ClsUser(); objuser.action = "select"; objuser.name = ""; objuser.id = ""; objuser.companyid = Session["companyId"].ToString(); DataSet ds = objuser.client(); if (ds.Tables[0].Rows.Count > 0) { dropclient.DataSource = ds; // dropclient.DataTextField = "clientcodewithname"; // dropclient.DataValueField = "nid"; dropclient.DataBind(); } }
protected override void Page_Load(object sender, EventArgs e) { if (!this.CheckIsLoaded()) { this.EOCb_Selection.Execute += new EO.Web.CallbackEventHandler(EOCb_Selection_Execute); this.EOCb_Filter.Execute += new EO.Web.CallbackEventHandler(EOCb_Filter_Execute); this.UcSelection.EvAccept += new Modules_UserControl.Control_Selection.DsAccept(Handle_Selection); //[-] base.Page_Load(sender, e); this.mObj = (ClsUser)this.pObj_Base; if (!this.IsPostBack) { this.SetupPage(); } } }
public static string getdata(string nid, string companyid) { ClsUser objuser = new ClsUser(); DataSet ds = new DataSet(); GeneralMethod objgen = new GeneralMethod(); objuser.fname = ""; objuser.action = "select"; objuser.companyid = companyid; objuser.id = nid; objuser.activestatus = ""; objuser.deptid = ""; ds = objuser.ManageEmployee(); string result = ""; if (nid == "") { result = objgen.serilizeinJson(ds.Tables[0]); } else { result = objgen.serilizeinJson(ds.Tables[0]); if (ds.Tables[1].Rows.Count > 0) { result = result + "##{}##" + objgen.serilizeinJson(ds.Tables[1]); } else { result = result + "##{}##" + ""; } if (ds.Tables[2].Rows.Count > 0) { result = result + "##{}##" + objgen.serilizeinJson(ds.Tables[2]); } else { result = result + "##{}##" + ""; } } return(result); }