Пример #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Employee model)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Insert<Employee>(model);
     }
 }
Пример #2
0
 public ActionResult AddEmployee(Employee emp)
 {
     AjaxResult result = new AjaxResult();
     emp.ID = Guid.NewGuid().ToString("N");
     emp.PY = Pinyin.GetPinyin(emp.Name);
     emp.Status = 1;
     try
     {
         new EmployeeRule().Add(emp);
         result.Success = true;
         result.Message = "职员信息新增成功。";
     }
     catch (Exception ex)
     {
         result.Success = false;
         result.Message = "职员信息新增失败。" + ex.Message;
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Пример #3
0
 public ActionResult Search(EasyUIGridParamModel param, Employee emp)
 {
     int ItemCount = 0;
     List<dynamic> list = new EmployeeRule().GetSearchJson(param, emp, out ItemCount);
     var listResult = from m in list.ToList()
                      select new
                      {
                          ID = m.ID,
                          NAME = m.NAME,
                          SEX = m.SEX,
                          BIRTHDATE = m.BIRTHDATE,
                          CARDTYPE = m.CARDTYPE,
                          CARDID = m.CARDID,
                          ADDRESS = m.ADDRESS,
                          OfficePhone = m.OFFICEPHONE,
                          DEPTNAME = m.DEPTNAME,
                          CURRENTSTATUS = m.STATUS.Replace("1", "在职").Replace("3", "停职")
                      };
     return Json(new { total = ItemCount, rows = listResult.ToList() }, JsonRequestBehavior.AllowGet);
 }
Пример #4
0
 public ActionResult ModifyEmployee(Employee emp)
 {
     AjaxResult result = new AjaxResult();
     try
     {
         emp.PY = Pinyin.GetPinyin(emp.Name);
         bool flag = new EmployeeRule().Update(emp);
         if (flag)
         {
             result.Success = true;
             result.Message = "客户信息更新成功。";
         }
     }
     catch (Exception ex)
     {
         result.Success = false;
         result.Message = "客户信息更新失败:" + ex.Message;
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Пример #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Ajax.Model.Employee model)
 {
     return(dal.Update(model));
 }
Пример #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Ajax.Model.Employee model)
 {
     dal.Add(model);
 }
Пример #7
0
 /// <summary>
 /// 获取职员管理列表json
 /// </summary>
 /// <param name="param"></param>
 /// <param name="emp"></param>
 /// <param name="itemCount"></param>
 /// <returns></returns>
 public List<object> GetSearchJson(EasyUIGridParamModel param, Employee emp, out int itemCount)
 {
     return new DAL.EmployeeDAL().GetSearchJson(param, emp, out itemCount);
 }
Пример #8
0
        /// <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);
            }
        }
Пример #9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Employee model)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Update<Employee>(model);
         return true;
     }
 }
Пример #10
0
        /// <summary>
        /// 获取职员查询列表
        /// </summary>
        /// <param name="param"></param>
        /// <param name="emp"></param>
        /// <param name="itemCount"></param>
        /// <returns></returns>
        public List<object> GetSearchJson(EasyUIGridParamModel param, Employee emp, out int itemCount)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select te.ID,te.Name,te.PY,BirthDate,Sex,DeptID,Job,'' as CardType,te.ICCardID as CardID,Address,te.OfficePhone,td.Name as DEPTNAME,WorkTime,FireTime,te.Status
                            FROM T_Employee te
                            LEFT JOIN T_Dept td ON td.ID = te.DeptID
                            where 1=1 and te.Status!=2 ");
            StringBuilder strSqlCount = new StringBuilder();
            strSqlCount.Append(@"select count(0) from t_employee te where 1=1 ");
            Dictionary<string, object> paramm = new Dictionary<string, object>();

            if (!string.IsNullOrEmpty(emp.Name))
            {
                strSql.Append(" and te.Name like @Name ");
                strSqlCount.Append(" and te.Name like @Name ");
                paramm.Add("Name", "%" + emp.Name + "%");
                strSql.Append(" and te.PY like @PY ");
                strSqlCount.Append(" and te.Name like @Name ");
                paramm.Add("PY", "%" + Pinyin.GetPinyin(emp.Name) + "%");
            }
            int pageIndex = Convert.ToInt32(param.page) - 1;
            int pageSize = Convert.ToInt32(param.rows);
            using (DBHelper db = DBHelper.Create())
            {
                string sql = strSql.ToString();
                itemCount = db.GetCount(strSqlCount.ToString(), paramm);
                return db.GetDynaminObjectList(sql, pageIndex, pageSize, "Name", paramm);
            }
        }
Пример #11
0
 /// <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);
 }
Пример #12
0
 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);
 }