/// <summary> /// 增加一条数据 /// </summary> public void Add(Operator model) { using (DBHelper db = DBHelper.Create()) { db.Insert<Operator>(model); } }
/// <summary> /// 实例化当前登录用户的登录凭证 /// </summary> /// <param name="userID">操作用户ID</param> /// <param name="areaID">区域ID</param> /// <param name="userName">操作用户登录名称</param> /// <param name="employeeID">职员ID</param> /// <param name="employeeName">职员名称</param> /// <param name="groupID">权限组ID</param> /// <param name="deptID">部门ID</param> /// <param name="deptName">部门名称</param> public Ticket(string userID, string areaID, string userName, bool isAdmin, string employeeID, string employeeName, string groupID, string deptID, string deptName, Operator opr) { UserID = userID; UserName = userName; AreaID = areaID; IsAdmin = isAdmin; //VoteList = voteList; EmployeeID = employeeID; employeeName = EmployeeName; GroupID = groupID; DeptID = deptID; DeptName = deptName; //this.CurrentOperator = opr; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Operator model) { using (DBHelper db = DBHelper.Create()) { db.Update<Operator>(model); return true; } }
/// <summary> /// 系统用户管理json /// </summary> /// <param name="param"></param> /// <param name="oper"></param> /// <param name="emp"></param> /// <param name="itemCount"></param> /// <returns></returns> public List<dynamic> SearchOperator(EasyUIGridParamModel param, Operator oper, Employee emp, out int itemCount) { List<SqlParameter> paramList = new List<SqlParameter>(); StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT oper.ID, oper.EmployeeID AS empid,oper.status ,"); strSql.Append("case oper.[Status] WHEN 1 THEN '启用' WHEN 0 THEN '<font color=''Gray''>已禁用</font>' else '<font color=''red''>已删除</font>' end AS STATUSNAME, "); strSql.Append("oper.Name, case oper.IsAdmin WHEN 1 THEN '是' ELSE '否' end as isAdmin,oper.createdate,oper.groupid,"); strSql.Append("emp.name AS empname,G.NAME AS GROUPNAME "); strSql.Append("FROM T_Operator oper "); strSql.Append("LEFT JOIN T_Employee emp ON emp.ID = oper.EmployeeID "); strSql.Append("LEFT JOIN T_GROUP G ON G.ID=OPER.GROUPID "); strSql.Append("where 1=1 and oper.status <3"); Dictionary<string, object> paramss = new Dictionary<string, object>(); if (!string.IsNullOrEmpty(oper.Name)) { strSql.Append("and (oper.name like @name or emp.name like @name) "); paramss.Add("name", string.Format("%{0}%", oper.Name)); } int pageIndex = Convert.ToInt32(param.page) - 1; int pageSize = Convert.ToInt32(param.rows); using (DBHelper db = DBHelper.Create()) { itemCount = db.GetCount(strSql.ToString(), paramss); return db.GetDynaminObjectList(strSql.ToString(), pageIndex, pageSize, "Status", paramss); } }
/// <summary> /// 禁用操作员 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool DisableOperator(string id) { using (DBHelper db = DBHelper.Create()) { Operator opr = new Operator(); opr = db.GetById<Operator>(id); // 管理员不能被禁用 if (opr.IsAdmin == 1) { return false; } // 禁用启用切换 if (opr.Status == 2) { opr.Status = 1; } else { opr.Status = 2; } // 已删除的点击禁用、启用时默认启用 if (opr.Status == 3) { opr.Status = 1; } db.Update<Operator>(opr); return true; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Ajax.Model.Operator model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="model">新增账号实体类</param> public void Add(Ajax.Model.Operator model) { dal.Add(model); }
/// <summary> /// 系统用户管理json /// </summary> /// <param name="param"></param> /// <param name="oper"></param> /// <param name="emp"></param> /// <param name="itemCount"></param> /// <returns></returns> public List<object> SearchOperator(EasyUIGridParamModel param, Operator oper, Employee emp, out int itemCount) { return dal.SearchOperator(param, oper, emp, out itemCount); }
public ActionResult ModifyOperator(Operator opr) { AjaxResult result = new AjaxResult(); opr.PY = Pinyin.GetPinyin(opr.Name); opr.Status = 1; opr.Pwd = Ajax.Common.DEncrypt.DESEncrypt.Encrypt(opr.Pwd); try { new OperatorRule().Update(opr); result.Success = true; result.Message = "修改成功。"; } catch (Exception ex) { result.Success = false; result.Message = "修改失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult AddOperator(Operator opr, string EMPNAME) { AjaxResult result = new AjaxResult(); opr.PY = Pinyin.GetPinyin(opr.Name); opr.ID = Guid.NewGuid().ToString("N"); opr.CreateDate = DateTime.Now; opr.Status = 1; opr.Pwd = Ajax.Common.DEncrypt.DESEncrypt.Encrypt(opr.Pwd); OperatorRule rule = new OperatorRule(); try { rule.Add(opr); result.Success = true; result.Message = "添加成功。"; } catch (Exception ex) { result.Success = false; result.Message = "添加失败:" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
public ActionResult SearchOperator(EasyUIGridParamModel param, Operator oper, Employee emp) { int itemCount = 0; List<dynamic> operList = new OperatorRule().SearchOperator(param, oper, emp, out itemCount); var showList = from opers in operList select new { ID = opers.ID, EMPID = opers.EMPID, STATUS = opers.STATUSNAME, NAME = opers.NAME, EMPNAME = opers.EMPNAME, ISADMIN = opers.ISADMIN, CREATEDATE = opers.CREATEDATE, GROUPNAME = opers.GROUPNAME, }; return Json(new { total = itemCount, rows = showList }, JsonRequestBehavior.AllowGet); }