public ActionResult WorkerRoleSave(B_WORKER_ROLE entity)
        {
            //string WokerID = Request.Form["WokerID"];
            //string RoleID = Request.Form["RoleID"];
            //string EmpNo = Request.Form["EmpNo"];
            //string OrgID = Request.Form["OrgID"];
            //string ID = Request.Form["ID"];


            //B_WORKER_ROLE workerRole = new B_WORKER_ROLE();

            //workerRole.EmpNo = EmpNo;
            //workerRole.WorkerID = int.Parse(WokerID);
            //workerRole.RoleID = int.Parse(RoleID);
            //workerRole.OrgID = int.Parse(OrgID);
            //workerRole.ID = int.Parse(ID);

            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            if (ModelState.IsValid)
            {
                bool save = worker.SaveWorkerRole(entity);

                if (save)
                {
                    return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Message = "保存失败" }, "text/html", JsonRequestBehavior.AllowGet));
                }
            }

            return(View());
        }
        public ActionResult WorkerRoleDel(int id)
        {
            //string WorkerID = Request.QueryString["Rworkerid"];
            //string RoleID = Request.QueryString["RoleID"];
            //string EmpNo = Request.QueryString["EmpNo"];

            //B_WORKER_ROLE workerRole = new B_WORKER_ROLE();

            //workerRole.WorkerID = int.Parse(WorkerID);
            //workerRole.RoleID = int.Parse(RoleID);
            //workerRole.EmpNo = EmpNo;

            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            if (ModelState.IsValid)
            {
                bool save = worker.DelWorkerRole(id);

                if (save)
                {
                    return(Json(new { IsSuccess = true, Message = "删除成功" }));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Message = "删除失败" }));
                }
            }

            return(View());
        }
        public ActionResult WorkerRoleLoad(int workerId)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();
            object listWorkerRole      = worker.LoadWorkerRole(workerId);

            return(Json(listWorkerRole));
        }
        //public ActionResult WorkerPersonnel()
        //{

        //    var result = CommonData.GetDataByType("Personnel");
        //    return Json(result);
        //}
        //public ActionResult WorkerPost()
        //{
        //    BLL.Organize.Position position = new BLL.Organize.Position();

        //    var result = position.LoadAllPost();

        //    return Json(result);
        //}

        public ActionResult WorkerSave(B_WORKER entity)
        {
            entity.Sex = Request.Form["sex"];
            //entity.IsQuota = Request.Form["quota"];
            entity.IsActive = Request.Form["active"];
            entity.IsAllowInternetAccess = Request.Form["isAllowInternetAccess"];
            entity.LoginName             = entity.Name;

            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            if (ModelState.IsValid)
            {
                entity.ID = worker.Save(entity);

                if (entity.ID > 0)
                {
                    return(Json(new { IsSuccess = true, WorkerId = entity.ID, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { IsSuccess = false, WorkerId = entity.ID, Message = "保存失败" }, "text/html", JsonRequestBehavior.AllowGet));
                }
            }

            return(View());
        }
Exemple #5
0
        public ActionResult DeskLogin(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;

            ViewData["Version"] = AppConfig.Version;

            //从调度台登陆
            string name = Request.QueryString["Name"];     //登录名或者TPerson人员编码
            string pwd  = Request.QueryString["passWord"]; //密码

            if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(pwd))
            {
                BLL.Organize.Worker bllWorker = new BLL.Organize.Worker();

                B_WORKER worker = bllWorker.DeskLogin(name, pwd);

                if (worker != null)
                {
                    FormsAuthentication.SetAuthCookie(worker.ID.ToString() + "|" + worker.Name + "|" + name, true);

                    if (Regex.IsMatch(pwd, CodeRule.Replace("/", "")))
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        return(RedirectToAction("ChangePassword", "Home"));
                    }
                }
            }

            return(View());
        }
        public ActionResult WorkerEdit(string workerId)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            if (string.IsNullOrEmpty(workerId))
            {
                B_WORKER wo = worker.GetWorkerById(null);
                ViewData["workerId"] = wo.ID;
                ViewData["entity"]   = wo;

                ViewData["title"]   = null;
                ViewData["IsQuota"] = null;

                this.ViewData["type"] = "add";
            }
            else
            {
                int intWorkerId = int.Parse(workerId);  //去掉"Worker-"前缀

                B_WORKER wo = worker.GetWorkerById(intWorkerId);

                ViewData["entity"]   = wo;
                ViewData["workerId"] = intWorkerId;
                ViewData["title"]    = wo.TitleTechnicalID;
                ViewData["JobLevel"] = wo.JobLevel;

                ViewData["IsQuota"] = wo.IsQuota;

                this.ViewData["type"] = "update";
            }

            ViewData["display"] = AppConfig.GetStringConfigValue("WorkerExtendedAttribute") == "N" ? "display: none" : "";

            return(View());
        }
        public ActionResult WorkerLoadupdo(string name, int?orgId, int?roleId, string empNo)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();


            DataSet dsReport = worker.LoadAllWorkerByPageUpdo(name, orgId, roleId, empNo);

            string folderPath = Server.MapPath("~/ExcelFile");

            if (!folderPath.EndsWith("/") && !folderPath.EndsWith("\\"))
            {
                folderPath += "/";
            }
            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            string fileName  = DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xls";
            string excelPath = folderPath + "\\" + fileName;

            Utility.Excel.ExportToExcel(dsReport, excelPath);

            return(File(excelPath, "application/ms-excel", fileName));
        }
        /// <summary>
        /// 保存兼职信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public ActionResult WorkerSidelineSave(B_WORKER_ORGANIZATION entity)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            //string type = Request.Form["type"];   //判断新增/修改
            entity.Type = int.Parse(Request.Form["type"]);   //判断新增/修改
            //string update_unit = Request.Form["update_unit"];    //修改的机构

            if (ModelState.IsValid)
            {
                bool save;

                try
                {
                    save = worker.SaveSideline(entity);
                }
                catch (Exception ex)
                {
                    Log4Net.LogError("WorkerSidelineSave", ex.ToString());
                    save = false;
                }

                if (save)
                {
                    return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Message = "保存失败" }, "text/html", JsonRequestBehavior.AllowGet));
                }
            }

            return(View());
        }
Exemple #9
0
        public ActionResult Default(int?loginID)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            ViewData["Login"] = worker.LoginCheck(User.Identity.Name.Split('|')[2]);

            BLL.Office.Office office = new BLL.Office.Office();

            IList <TDictionary> listDic = office.GetAllInfoType();

            foreach (TDictionary dic in listDic)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["orgId"]))
                {
                    this.ViewData[dic.编码] = office.GetOfficeByType(dic.编码, int.Parse(Request.QueryString["OrgId"]));  //办公新闻
                }
                else
                {
                    //IStorehouse storehouse = ctx["Storehouse"] as IStorehouse;
                    //List<B_ORGANIZATION> listUnit = storehouse.GetUnit((int)loginID);
                    this.ViewData[dic.编码] = office.GetOfficeByTypeAndLogin(dic.编码, (int)loginID);
                }
            }

            return(View());
        }
Exemple #10
0
        //public ActionResult WorkerTree(int? id)
        //{
        //    try
        //    {
        //        BLL.Organize.Worker worker = new BLL.Organize.Worker();
        //        List<C_ORGANIZE_TREE> cot = worker.GetTree(id);
        //        return this.Json(cot);
        //    }
        //    catch (Exception e)
        //    {
        //        Dictionary<string, string> dict = new Dictionary<string, string>();
        //        dict.Add("InfoID", "0");
        //        dict.Add("InfoMessage", e.Message);
        //        return this.Json(dict);
        //    }
        //}

        //public ActionResult GetGoupJson(int? id)
        //{
        //    BLL.Organize.Worker worker = new BLL.Organize.Worker();

        //    int parentId = -1;  //默认为-1,如果请求参数不正确,将不返回任何值
        //    string resultStr = string.Empty;
        //    if (id != null)
        //    {
        //        Int32.TryParse(id.ToString(), out parentId);
        //    }
        //    if (parentId >= 0)
        //    {
        //        List<C_ORGANIZE_TREE> cot = worker.GetTree(id);
        //        resultStr = "";
        //        resultStr += "[";
        //        foreach (var item in cot)
        //        {
        //            resultStr += "{";
        //            resultStr += string.Format("\"id\": \"{0}\", \"text\": \"{1}\", \"iconCls\": \"icon-ok\", \"state\": \"closed\"", item.id.ToString(), item.text);
        //            resultStr += "},";
        //        }
        //        resultStr = resultStr.Substring(0, resultStr.Length - 1);
        //        resultStr += "]";
        //    }
        //    return this.Json(resultStr);
        //}

        public ActionResult WorkerSideline(int workerId)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            var result = worker.GetWorkerSideline(workerId);

            return(Json(result));
        }
Exemple #11
0
        public ActionResult GetAllWorker()
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            List <B_WORKER> cot = worker.GetAllWorker();

            return(Json(cot));
        }
Exemple #12
0
        public ActionResult WorkerLoadByOrg(int orgId)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            var result = worker.GetWorkerByOrg(orgId);

            return(Json(result));
        }
Exemple #13
0
        public ActionResult SmsWorkerLoad(int page, int rows, string order, string sort, string name, string orgId, int?roleId)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            var result = worker.LoadAllWorkerByPage(page, rows, order, sort, name, orgId, roleId, true, "");

            return(Json(result));
        }
Exemple #14
0
        public ActionResult IsExistEmpNo(string empNo)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            bool result = worker.IsExistEmpNo(empNo);

            if (result)
            {
                return(Json(new { IsSuccess = true }));
            }
            else
            {
                return(Json(new { IsSuccess = false }));
            }
        }
Exemple #15
0
        public ActionResult IsExistID(string tableName, int id)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            bool result = Anchor.FA.Utility.PrimaryKeyUtility.IsExistID(tableName, id);

            if (result)
            {
                return(Json(new { IsSuccess = true }));
            }
            else
            {
                return(Json(new { IsSuccess = false }));
            }
        }
Exemple #16
0
        //判断登录名是否已经存在
        public ActionResult IsExistName(string name, int workerId)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            B_WORKER result = worker.GetAllWorker().FirstOrDefault(t => t.Name == name && t.ID != workerId);

            if (result == null)
            {
                return(Json(new { IsSuccess = false }));
            }
            else
            {
                return(Json(new { IsSuccess = true }));
            }
        }
Exemple #17
0
        /// <summary>
        /// 申请页面
        /// </summary>
        /// <returns></returns>
        public ActionResult A()
        {
            Flow     flow = new Flow();
            Activity d    = new Activity();

            BLL.Organize.Worker worker = new BLL.Organize.Worker();
            this.ViewData["applyWorkerID"] = User.Identity.Name.Split('|')[0];    //申请人ID
            this.ViewData["applyWorker"]   = User.Identity.Name.Split('|')[1];    //申请人
            this.ViewData["createTime"]    = DateTime.Now.ToString("yyyy-MM-dd"); //创建时间

            B_WORKER_ORGANIZATION org = worker.GetWorkerDefaultUnit(int.Parse(User.Identity.Name.Split('|')[0]));

            if (org != null)
            {
                this.ViewData["applyWorkerDepartID"] = org.OrgID;//申请人部门
            }

            ViewData["FlowId"] = Request.QueryString["FlowId"];

            if (!string.IsNullOrEmpty(Request.QueryString["flowInstId"]))
            {
                ViewData["Url"] = string.Format("/FLOW{0}/Page/Submit/?{1}",
                                                Request.QueryString["flowId"],
                                                Request.QueryString);

                ViewData["FlowNo"] = Request.QueryString["flowNo"];

                GetTaskListHTML();

                return(LoadData(int.Parse(Request.QueryString["flowNo"])));
            }
            else
            {
                Engine engine = new Engine();

                int flowNo = engine.CreateFlowNo(int.Parse(Request.QueryString["flowId"]));

                ViewData["Url"] = string.Format("/FLOW{0}/Page/Submit/?{1}&flowNo={2}",
                                                Request.QueryString["flowId"],
                                                Request.QueryString,
                                                flowNo);

                ViewData["FlowNo"] = flowNo;

                return(View());
            }
        }
Exemple #18
0
        public ActionResult WorkerSidelinDelete(int id)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();
            bool delete;

            try
            {
                delete = worker.DeleteSideline(id);
            }
            catch (Exception)
            {
                delete = false;
            }

            if (delete)
            {
                return(Json(new { IsSuccess = true, Message = "删除成功" }));
            }
            else
            {
                return(Json(new { IsSuccess = false, Message = "删除失败" }));
            }
        }
Exemple #19
0
        public ActionResult ChangePassword(int workerId, string newPassWord)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            bool reslut;

            try
            {
                reslut = worker.UpdatePassword(workerId, newPassWord);
            }
            catch (Exception)
            {
                reslut = false;
            }

            if (reslut)
            {
                return(Json(new { IsSuccess = true, Message = "删除成功" }));
            }
            else
            {
                return(Json(new { IsSuccess = false, Message = "删除失败" }));
            }
        }
Exemple #20
0
        public ActionResult Login(string userName, string passWord, string validateCode)
        {
            BLL.Organize.Worker bllWorker = new BLL.Organize.Worker();
            BLL.Organize.Action action    = new BLL.Organize.Action();

            if (ModelState.IsValid)
            {
                //检查登录失败次数
                if (FailCount >= FailedLogin)
                {
                    return(Json(new { IsSuccess = false, Message = string.Format("您登录失败{0}次,{1}分钟内不能再登陆!",
                                                                                 FailedLogin,
                                                                                 NoLoginTime) },
                                "text/html", JsonRequestBehavior.AllowGet));
                }

                //检查验证码
                if (Session["ValidateCode"] != null && validateCode != Session["ValidateCode"].ToString())
                {
                    FailCount++;
                    return(Json(new { IsSuccess = false, Message = "验证码错误!" }, "text/html", JsonRequestBehavior.AllowGet));
                }

                //B_WORKER worker = bllWorker.Login(HttpUtility.UrlDecode(userName), HttpUtility.UrlDecode(passWord));
                B_WORKER worker = bllWorker.Login(userName, passWord);

                if (worker != null)
                {
                    if (FailCount > 0)
                    {
                        FailCount = 0;
                    }

                    //判断登陆者有无权限
                    List <C_MENU_TREE> isAuth = action.GetMenu("0", worker.ID.ToString());
                    if (isAuth == null)
                    {
                        return(Json(new { IsSuccess = false, Message = "您没有任何权限,请联系管理员!" }));
                    }

                    //判断是否是Internet访问并且允许此人Internet访问
                    //bool isInternetAccess = Convert.ToBoolean(ConfigurationManager.AppSettings["IsInternetAccess"]);

                    //if (isInternetAccess && worker.IsAllowInternetAccess.ToUpper() == "N")
                    //{
                    //    return Json(new { IsSuccess = false, Message = "您没有Internet访问权限,请联系管理员!" }, "text/html", JsonRequestBehavior.AllowGet);
                    //}

                    //写登录日志
                    BLL.Organize.Worker w = new BLL.Organize.Worker();

                    B_LOGIN_LOG log = new B_LOGIN_LOG();
                    log.Name      = userName;
                    log.IP        = Request.UserHostAddress;
                    log.LoginTime = DateTime.Now;

                    w.LoginLog(log);

                    //登录成功,写cookie
                    FormsAuthentication.SetAuthCookie(worker.ID.ToString() + "|" + worker.Name + "|" + userName, true);

                    Session.Remove("ValidateCode");

                    return(Json(new { IsSuccess = true, Message = "登录成功" }, "text/html", JsonRequestBehavior.AllowGet));
                }
                else
                {
                    FailCount++;
                    return(Json(new { IsSuccess = false, Message = "账号或密码错误,请联系管理员!" }, "text/html", JsonRequestBehavior.AllowGet));
                }
            }

            return(View());
        }
Exemple #21
0
        private B_WORKER GetCurrentUser()
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            return(worker.GetWorkerById(int.Parse(User.Identity.Name.Split('|')[0])));
        }
Exemple #22
0
        private C_WorkerDetail GetUserInfo()
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            return(worker.GetWorkerDetailById(int.Parse(User.Identity.Name.Split('|')[0])));
        }
Exemple #23
0
        public ActionResult GetID(string tableName)
        {
            BLL.Organize.Worker worker = new BLL.Organize.Worker();

            return(Json(Anchor.FA.Utility.PrimaryKeyUtility.GetID(tableName)));
        }