コード例 #1
0
        /// *******************************************************
        /// <summary>
        /// 获取当前的工作时间设置
        /// </summary>
        /// <param name="context"></param>
        /// *******************************************************
        private void GetInfo(HttpContext context)
        {
            int    code = 0;
            string msg  = "";
            string json = "";

            #region 验证管理员权限
            if (!UsrAuth.IsAdminister(context.Session))
            {
                code = 0;
                msg  = "没有管理员权限";
                json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
                context.Response.Write(json);
                return;
            }
            #endregion

            WorkDuration workDuration           = WorkDurationService.Instance.GetWorkDuration();
            FeedBackMsg <WorkDuration> feedBack = new FeedBackMsg <WorkDuration>();
            if (WorkDurationService.Instance != null)
            {
                feedBack.Code = 1;
                feedBack.Msg  = "当前的工作时间设置";
                feedBack.Obj  = workDuration;
            }
            json = ObjToJson.ToJson(feedBack);
            context.Response.Write(json);
        }
コード例 #2
0
 private bool IsAdminister(HttpContext context)
 {
     if (!UsrAuth.IsAdminister(context.Session))
     {//无管理员权限
         context.Response.Write("{\"Code\":\"0\",\"Msg\":\"无‘管理员’权限!\"}");
         return(false);
     }
     return(true);
 }
コード例 #3
0
        /**************************************************
        * 获取员工信息列表
        * MODIFY
        * ************************************************/
        private void GetList(HttpContext context)
        {
            string currentEmpName = UsrAuth.GetempName(context.Session);
            string searchName     = context.Request["searchName"];
            string searchDepID    = context.Request["searchDepID"];
            string isDepList      = context.Request["isDepList"];

            if (string.IsNullOrEmpty(searchDepID))
            {
                searchDepID = "0";
            }

            FeedBackMsg <DepartmentAndEmployee> feedBack = new FeedBackMsg <DepartmentAndEmployee>();
            List <EmployeeInfo> empList = new List <EmployeeInfo>();

            if (UsrAuth.IsAdminister(context.Session))
            {
                //管理员或总经理
                empList = EmployeeService.Instance.GetList(searchName, int.Parse(searchDepID));
            }
            else if (UsrAuth.IsDepManager(context.Session))
            {
                //部门经理
                string depID = UsrAuth.GetdepID(context.Session);
                empList = EmployeeService.Instance.GetEmployee(int.Parse(depID), searchName);
            }
            else
            {
                feedBack.Code = 0;
                feedBack.Msg  = "没有相应的权限";
                feedBack.Obj  = null;
            }
            DepartmentAndEmployee depAndEmp;

            if (!string.IsNullOrEmpty(isDepList) && isDepList.Equals("1"))
            {
                List <Department> depList = DepartmentService.Instance.GetDepartment();
                depAndEmp = new DepartmentAndEmployee()
                {
                    DepList = depList,
                    EmpList = empList
                };
            }
            else
            {
                depAndEmp = new DepartmentAndEmployee()
                {
                    EmpList = empList
                };
            }
            feedBack.Code = 1;
            feedBack.Msg  = "员工和部门列表";
            feedBack.Obj  = depAndEmp;
            string json = ObjToJson.ToJson(feedBack);

            context.Response.Write(json);
        }
コード例 #4
0
        /********************************************************
        * 描述:获取当前登录账户的月签到统计
        * 参数:month 查询月份
        *       depName 部门名称
        *       empName 员工姓名
        *       rate    出勤率,全勤1,非全勤0,所有null
        * ******************************************************/
        //月考勤记录查询
        private void GetMonthAttendanceList(HttpContext context)
        {
            string empID         = UsrAuth.GetempID(context.Session);
            string searchMonth   = context.Request["searchMonth"];
            string searchRate    = context.Request["searchRate"];
            string searchEmpName = context.Request["searchName"];
            //MODIFY
            string isSelf = context.Request["isSelf"];

            if (string.IsNullOrEmpty(searchEmpName))
            {
                searchEmpName = null;
            }
            if (string.IsNullOrEmpty(searchRate))
            {
                searchRate = null;
            }
            string depID = "";
            List <MonthAttendance> list = new List <MonthAttendance>();
            FeedBackMsg <List <MonthAttendance> > feedBack = new FeedBackMsg <List <MonthAttendance> >();

            if (!string.IsNullOrEmpty(isSelf) && isSelf.Equals("1"))
            {
                list = MonthAttendanceService.Instance.GetAttendanceStatistics(empID, searchMonth, searchRate);
            }
            else
            {
                if (UsrAuth.IsTopManager(context.Session) || UsrAuth.IsAdminister(context.Session))
                {
                    depID = null;
                    list  = MonthAttendanceService.Instance.GetAttendanceStatistics(searchMonth, depID, searchEmpName, searchRate);
                }
                else if (UsrAuth.IsDepManager(context.Session))
                {
                    //部门经理
                    depID = UsrAuth.GetdepID(context.Session);
                    list  = MonthAttendanceService.Instance.GetAttendanceStatistics(searchMonth, depID, searchEmpName, searchRate);
                }
            }
            if (list != null && list.Count > 0)
            {
                feedBack.Code = 1;
                feedBack.Msg  = "月考勤信息";
                feedBack.Obj  = list;
            }
            else
            {
                feedBack.Code = 1;
                feedBack.Msg  = "沒有数据";
                feedBack.Obj  = null;
            }
            string json = ObjToJson.ToJson(feedBack);

            context.Response.Write(json);
        }
コード例 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!UsrAuth.IsLogin(Session, Request, Response))
     {
         strNoLogin = "******";
         return;
     }
     isAdmin     = UsrAuth.IsAdminister(Session) ? "1" : "0";
     isDepManage = UsrAuth.IsDepManager(Session) ? "1" : "0";
     isTopManage = UsrAuth.IsTopManager(Session) ? "1" : "0";
 }
コード例 #6
0
        /**************************************************
        * 更新部门
        * 功能:添加,修改
        * 页面参数:depID 部门ID,可以为null
        *           depName 添加或者修改后的部门名称
        * ************************************************/
        public void Update(HttpContext context)
        {
            int    code    = 0;
            string msg     = "";
            string json    = "";
            string depID   = context.Request["id"];
            string depName = context.Request["name"];

            #region 验证操作权限
            if (!UsrAuth.IsAdminister(context.Session))
            {//无管理员权限
                code = 0;
                msg  = "无‘管理员’权限";
                json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
                context.Response.Write(json);
                return;
            }
            #endregion

            DepartmentService departmentService = new DepartmentService();
            if (string.IsNullOrEmpty(depID))
            {
                //添加
                int res = departmentService.UpdateDepartment(depName);
                if (res == 0)
                {
                    code = 0; msg = "添加失败";
                }
                else
                {
                    code = 1; msg = "添加成功";
                }
            }
            else
            {
                //修改
                int res = departmentService.UpdateDepartment(depName, int.Parse(depID));
                if (res == 0)
                {
                    code = 0; msg = "修改失败";
                }
                else
                {
                    code = 1; msg = "修改成功";
                }
            }
            json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
            context.Response.Write(json);
        }
コード例 #7
0
        /**********************************************************
        * 更新上班时间
        * ********************************************************/
        private void Update(HttpContext context)
        {
            int          code = 0;
            string       msg  = "";
            string       json = "";
            WorkDuration wd   = new WorkDuration();

            #region 参数值赋给wd对象
            wd.NormalTime        = context.Request["normalTime"];
            wd.AbsentSignInTime  = context.Request["absentTimeSignIn"];
            wd.AbsentSignOutTime = context.Request["absenTimeSignOut"];
            wd.LeaveEarlyTime    = context.Request["leaveEarlyTime"];
            wd.WDFloatTime       = context.Request["floatTime"];
            wd.WDMonthDuration   = int.Parse(context.Request["monthWorkDuration"]);
            wd.WDSignInMonth     = context.Request["month"];
            #endregion

            #region 验证操作权限
            if (!UsrAuth.IsAdminister(context.Session))
            {
                code = 0;
                msg  = "无‘管理员’权限";
                json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
                context.Response.Write(json);
                return;
            }
            #endregion

            int res = WorkDurationService.Instance.UpdateWorkDuration(wd);
            if (res == 0)
            {
                code = 0;
                msg  = "更新失败";
                json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
            }
            else
            {
                code = 1;
                msg  = "更新成功";
                json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
            }
            context.Response.Write(json);
        }
コード例 #8
0
        /**************************************************
         * 部门列表
         * 可用于查询、点击部门管理时显示部门列表
         * 页面参数:depName 部门名称,当为空是获取部门列表
         * ***********************************************/
        public void GetList(HttpContext context)
        {
            int    code    = 0;
            string msg     = "";
            string json    = "";
            string depName = context.Request["searchName"];

            #region 验证操作权限
            if (!UsrAuth.IsAdminister(context.Session))
            {//无管理员权限
                code = 0;
                msg  = "无‘管理员’权限";
                json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
                context.Response.Write(json);
                return;
            }
            #endregion

            DepartmentService departmentService       = new DepartmentService();
            List <Department> depList                 = departmentService.GetDepartment(depName);
            FeedBackMsg <List <Department> > feedBack = new FeedBackMsg <List <Department> >();
            if (depList != null && depList.Count > 0)
            {
                feedBack.Code = 1;
                feedBack.Msg  = "部门列表";
                feedBack.Obj  = depList;
            }
            else
            {
                feedBack.Code = 0;
                feedBack.Msg  = "没有数据";
                feedBack.Obj  = null;
            }
            json = ObjToJson.ToJson(feedBack);
            context.Response.Write(json);
        }
コード例 #9
0
        /**********************************************************
        * 补签到
        * 管理员权限
        * ********************************************************/
        private void UpdateSupplement(HttpContext context)
        {
            int    code = 0;
            string msg  = "";
            string json = "";

            //验证操作权限
            if (!UsrAuth.IsAdminister(context.Session))
            {//无管理员权限
                code = 0;
                msg  = "无‘管理员’权限";
                json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
                context.Response.Write(json);
                return;
            }
            string checkInInfoID  = context.Request["id"];
            string currentEmpID   = UsrAuth.GetempID(context.Session);
            string currentEmpName = UsrAuth.GetempName(context.Session);
            string empID          = context.Request["empID"];
            string empName        = context.Request["empName"];
            string depID          = context.Request["depID"];
            string depName        = context.Request["depName"];
            string date           = context.Request["appendSignDate"];
            string signInTime     = context.Request["signInTime"];
            string signOutTime    = context.Request["signOutTime"];
            string note           = context.Request["ciNote"];
            string allSignInOrOut = context.Request["allSignInOrOut"];
            string signInDate     = DateTime.Parse(date + " " + signInTime).ToString();
            string signOutDate    = DateTime.Parse(date + " " + signOutTime).ToString();

            if (string.IsNullOrEmpty(note))
            {
                code = 0;
                msg  = "补签说明不能为空";
                json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
                context.Response.Write(json);
                return;
            }
            if (!string.IsNullOrEmpty(allSignInOrOut) && allSignInOrOut.Equals("1")) //给所有人补签到补签退
            {
                int res = CheckInInfoService.Instance.UpdateCheckInInfoBySystem(date, signInTime,
                                                                                signOutTime, note, int.Parse(currentEmpID), currentEmpName, int.Parse(empID));
                if (res != 1)
                {
                    code = 0; msg = "补签失败";
                }
                else
                {
                    code = 1; msg = "补签成功";
                }
            }
            else
            {
                if (string.IsNullOrEmpty(checkInInfoID))
                {
                    //补签到
                    if (CheckInInfoService.Instance.hasSignIn(int.Parse(empID), date))
                    {
                        code = 0; msg = "员工已经签过到";
                        json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
                        context.Response.Write(json);
                        return;
                    }
                    int res = CheckInInfoService.Instance.UpdateCheckInInfoBySystem(empID, empName, int.Parse(depID),
                                                                                    depName, signInDate, note, currentEmpID, currentEmpName);
                    if (res != 1)
                    {
                        code = 0; msg = "补签到失败";
                    }
                    else
                    {
                        code = 1; msg = "补签到成功";
                    }
                }
                else
                {
                    //补签退
                    if (CheckInInfoService.Instance.hasSingOut(int.Parse(empID), date))
                    {
                        code = 0; msg = "员工已经签过退";
                        json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
                        context.Response.Write(json);
                        return;
                    }
                    //2. 补签到正常
                    int res = CheckInInfoService.Instance.UpdateCheckInInfoBySystem(empID, empName, int.Parse(depID), depName,
                                                                                    signOutDate, note, currentEmpID, currentEmpName, int.Parse(checkInInfoID));
                    if (res != 1)
                    {
                        code = 0; msg = "补签退失败";
                    }
                    else
                    {
                        code = 1; msg = "补签退成功";
                    }
                }
            }
            json = "{\"Code\":\"" + code + "\",\"Msg\":\"" + msg + "\"}";
            context.Response.Write(json);
        }
コード例 #10
0
        /********************************************************
        * 获取签到信息
        * date:查询日期 可以为null
        * rate:出勤率,全勤1,非全勤0,所有null
        * empName:员工姓名
        * ******************************************************/
        private void GetDetailList(HttpContext context)
        {
            string json = "";
            //验证操作权限
            string empID           = UsrAuth.GetempID(context.Session);
            string searchStartDate = context.Request["searchStartDate"];
            string searchEndDate   = context.Request["searchEndDate"];
            string searchRate      = context.Request["searchRate"];
            string searchName      = context.Request["searchName"];
            //MODIFY
            string isSelf      = context.Request["isSelf"];
            int    searchEmpID = int.Parse(context.Request["searchEmpID"]);

            FeedBackMsg <List <CheckInInfo> > feedBack = new FeedBackMsg <List <CheckInInfo> >();

            if (string.IsNullOrEmpty(searchStartDate))
            {
                searchStartDate = null;
            }
            if (string.IsNullOrEmpty(searchRate))
            {
                searchRate = null;
            }
            if (string.IsNullOrEmpty(searchName))
            {
                searchName = null;
            }
            string depID   = UsrAuth.GetdepID(context.Session);
            string depName = UsrAuth.GetdepName(context.Session);

            if (searchEmpID > 0)
            {
                List <CheckInInfo> checkInInfoList = CheckInInfoService.Instance.GetCheckInInfoList(searchEmpID.ToString(), searchStartDate, searchEndDate, searchRate);
                feedBack.Code = 1;
                feedBack.Msg  = "员工签到信息";//获取某个员工记录
                feedBack.Obj  = checkInInfoList;
            }
            else
            {
                if (!string.IsNullOrEmpty(isSelf) && isSelf.Equals("1"))    //获取登录人记录
                {
                    List <CheckInInfo> checkInInfoList = CheckInInfoService.Instance.GetCheckInInfoList(empID, searchStartDate, searchEndDate, searchRate);
                    feedBack.Code = 1;
                    feedBack.Msg  = "我的签到信息";
                    feedBack.Obj  = checkInInfoList;
                }
                else
                {
                    if (UsrAuth.IsAdminister(context.Session) || UsrAuth.IsTopManager(context.Session))
                    {
                        //总经理或者管理员
                        List <CheckInInfo> allCheckInInfoList = CheckInInfoService.Instance.GetCheckInInfoList(0, searchName, searchStartDate, searchEndDate, searchRate);
                        feedBack.Code = 1;
                        feedBack.Msg  = "所有员工的签到信息";
                        feedBack.Obj  = allCheckInInfoList;
                    }
                    else if (UsrAuth.IsDepManager(context.Session))
                    {
                        //部门经理
                        List <CheckInInfo> allCheckInInfoList = CheckInInfoService.Instance.GetCheckInInfoList(int.Parse(depID), searchName, searchStartDate, searchEndDate, searchRate);
                        feedBack.Code = 1;
                        feedBack.Msg  = "部门" + depName + "员工列表";
                        feedBack.Obj  = allCheckInInfoList;
                    }
                    else
                    {
                        feedBack.Code = 0;
                        feedBack.Msg  = "无相应权限";
                        feedBack.Obj  = null;
                    }
                }
            }
            json = ObjToJson.ToJson(feedBack);
            context.Response.Write(json);
        }