Esempio n. 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);
        }
        /********************************************************
        * 获取用户签到状态
        * date:查询日期 可以为null
        * rate:出勤率,全勤1,非全勤0,所有null
        * ******************************************************/
        private void GetSignStatus(HttpContext context)
        {
            //登录账号的ID
            string empID = UsrAuth.GetempID(context.Session);
            FeedBackMsg <CheckInInfo> feedBackMsg = new FeedBackMsg <CheckInInfo>();
            //获取当前的考勤信息
            CheckInInfo checkInInfo = CheckInInfoService.Instance.GetCurrentCheckInInfo(int.Parse(empID));

            if (checkInInfo != null)
            {
                //已经签过到
                feedBackMsg.Code = 1;
                feedBackMsg.Msg  = "已经签到";
                feedBackMsg.Obj  = checkInInfo;
            }
            else
            {
                //还没有签到
                feedBackMsg.Code = 1;
                feedBackMsg.Msg  = "还没签到";
                feedBackMsg.Obj  = null;
            }
            string json = ObjToJson.ToJson(feedBackMsg);

            context.Response.Write(json);
        }
Esempio n. 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);
        }
        /********************************************************
        * 描述:获取当前登录账户的月签到统计
        * 参数: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);
        }
        private void GetInfo(HttpContext context)
        {
            int selectedCheckInInfoID = int.Parse(context.Request["id"]);

            CheckInInfo checkInInfo = CheckInInfoService.Instance.GetCheckInInfo(selectedCheckInInfoID);

            FeedBackMsg <CheckInInfo> feedBack = new FeedBackMsg <CheckInInfo>()
            {
                Code = 1,
                Msg  = "选中的签到项的具体信息",
                Obj  = checkInInfo
            };
            string json = ObjToJson.ToJson(feedBack);

            context.Response.Write(json);
        }
Esempio n. 6
0
        private void GetInfo(HttpContext context)
        {
            int selectedEmpID = int.Parse(context.Request["id"]);

            EmployeeInfo empInfo = EmployeeService.Instance.GetEmployee(selectedEmpID);


            FeedBackMsg <EmployeeInfo> feedBack = new FeedBackMsg <EmployeeInfo>()
            {
                Code = 1,
                Msg  = "选中员工信息",
                Obj  = empInfo
            };
            string json = ObjToJson.ToJson(feedBack);

            context.Response.Write(json);
        }
Esempio n. 7
0
        public void GetInfo(HttpContext context)
        {
            string json  = "";
            int    depId = int.Parse(context.Request["id"]);

            DepartmentService        departmentService = new DepartmentService();
            Department               dep      = departmentService.GetInfo(depId);
            FeedBackMsg <Department> feedBack = new FeedBackMsg <Department>();

            if (dep != null)
            {
                feedBack.Code = 1;
                feedBack.Msg  = "部门列表";
                feedBack.Obj  = dep;
            }
            else
            {
                feedBack.Code = 0;
                feedBack.Msg  = "没有数据";
                feedBack.Obj  = null;
            }
            json = ObjToJson.ToJson(feedBack);
            context.Response.Write(json);
        }
Esempio n. 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);
        }
        /********************************************************
        * 获取签到信息
        * 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);
        }