Exemple #1
0
        public string StaffMangeBack(string id, string datas, string dataIds, string comId)
        {
            string mark = Request["mark"];//请求类型

            StaffHanding         sh  = new StaffHanding();
            staff                s   = new staff();
            JavaScriptSerializer ssj = new JavaScriptSerializer();
            JsonModel            jm  = new JsonModel();

            if (mark == "add")
            {
                jm.state = sh.AddStaff(datas, comId, out s);
                jm.datas = new string[] { s.staff_Id.ToString(), s.staff_TrueName, s.staff_Username, s.staff_Password, s.staff_Email, s.staff_Department, s.staff_IsWrite.ToString() };
                string json = ssj.Serialize(jm);
                return(json);
            }
            else if (mark == "modify")
            {
                jm.state = sh.ModifyStaffs(datas, dataIds);
                return(ssj.Serialize(jm));
            }
            else if (mark == "remove")
            {
                string[] ids = null;
                jm.state = sh.RemoveStaffs(id, datas, out ids);
                jm.datas = ids;
                return(ssj.Serialize(jm));
            }
            return("{\"data\":\"未知错误\"}");
        }
Exemple #2
0
        public string ReSendEmail(string id, string datas)
        {
            StaffHanding sh = new StaffHanding();


            return("{\"state\":\"" + sh.ReSendEmailBystaffsId(datas, id) + "\"}");
        }
        public ActionResult Index(string id)
        {
            long ID = 1;

            try
            {
                ID = Convert.ToInt64(id);
            }
            catch
            {
                ID = 1;
            }
            ID = ID > 0 ? ID : 1;
            int         pageSize = 20;
            staff       sf       = new StaffHanding().GetStaffMsg(Convert.ToInt64(sc.GetStaffSession()));
            testInfo    ti       = new TestInfoOperation().GetTestInfo(sf.staff_OwnCompanyId)[0];
            List <test> tests    = new TestHanding().GetTests(ti.testInfo_Id, (int)ID, pageSize);

            ViewBag.tests    = tests;
            ViewBag.title    = ti.testInfo_Name;
            ViewBag.dataSize = new TestHanding().GetTestCount(Convert.ToInt32(ti.testInfo_Id));
            int maxPage = new TestHanding().GetMaxPage(pageSize, Convert.ToInt32(ti.testInfo_Id));;

            ViewBag.maxDataSize = maxPage;
            ViewBag.index       = ID < maxPage?ID:maxPage;
            ViewBag.staffId     = sf.staff_Id;
            ViewBag.cookies     = sf.staff_Spare;
            ViewBag.msg         = sf;
            ViewBag.companyName = new Companyhandling().GetOwnCompanyName(sf.staff_OwnCompanyId);
            return(sf.staff_Password == Md5.GetMd5Word("123456")?View("/Views/Staff/sureMsg.cshtml"):View());
        }
        public string SubmitKey(string key)
        {
            staff         sf  = new StaffHanding().GetStaffMsg(Convert.ToInt64(sc.GetStaffSession()));
            testInfo      ti  = new TestInfoOperation().GetTestInfo(sf.staff_OwnCompanyId)[0];
            List <object> res = new KeyOperation().SubmitKey(key, Convert.ToInt64(sc.GetStaffSession()), ti.testInfo_Id);

            if (res.Contains(1))
            {
                sc.ClearSession();
            }
            return(res.ToJson());
        }
        public string LoginIn(string user, string pwd, string yzm)
        {
            List <object> result = new StaffHanding().Login(user, pwd, yzm, (string)Session["ver"]);

            if (result.Contains(1))
            {
                sc.ClearSession();
                sc.SetStaffSession(result[2].ToString());
            }

            return(result.ToJson());
        }
Exemple #6
0
        public string SendEmailing(string id, string data)
        {
            StaffHanding sh = new StaffHanding();

            return(sh.SendEmail(id).ToJson());
        }
Exemple #7
0
        /// <summary>
        /// 员工管理
        /// </summary>
        /// <returns></returns>
        public ActionResult StaffManage(string id)
        {
            string comId     = Request["parameter0"];
            int    pageIndex = Convert.ToInt32(Request["parameter1"]);
            int    pageSize  = Convert.ToInt32(Request["parameter2"]);
            string pageClass = Request["parameter3"];
            long   totalNum  = 0;

            ViewBag.searchVal = "all";
            Companyhandling ch = new Companyhandling();

            //编号为COmid的公司不存在
            if (!ch.IsCompanyIdExist(comId))
            {
                return(View("NotFind"));
            }
            StaffHanding sh = new StaffHanding();

            //如果请求公司下属全部员工
            if (pageClass == "all")
            {
                List <staff> staffs = sh.SelectAllStaffByComID(comId, pageIndex, pageSize, out totalNum);
                ViewBag.staffs = staffs;
            }
            else if (pageClass == "search")
            {
                string name  = Request["parameter4"];
                string value = Request["parameter5"];
                if (name == "trueName")
                {
                    //按名称搜,返回所有结果
                    List <staff> staffs = sh.SearchAllStaffsByValue(comId, value);
                    pageIndex = 1;

                    totalNum       = staffs.Count;
                    ViewBag.staffs = staffs;
                }
                else if (name == "email")
                {
                    //按邮件搜,,返回所有结果
                    List <staff> staffs = sh.SearchAllStaffsByEmail(comId, value);
                    pageIndex      = 1;
                    totalNum       = staffs.Count;
                    ViewBag.staffs = staffs;
                }
            }
            else if (pageClass == "dep")
            {
                string       value  = Request["parameter4"];
                List <staff> staffs = sh.GetStaffByDepartment(comId, value);
                pageIndex = 1;

                totalNum       = staffs.Count;
                ViewBag.staffs = staffs;
            }
            else
            {//请求本公司员工
                List <staff> staffs = sh.SelectStaffByComID(comId, pageIndex, pageSize, out totalNum);
                ViewBag.staffs    = staffs;
                ViewBag.searchVal = "notAll";
            }
            ViewBag.pageIndex = pageIndex;

            ViewBag.pageSize = pageSize;

            ViewBag.totNum  = totalNum;
            ViewBag.id      = Request["dataId"].Split('#')[1];
            ViewBag.tableId = ViewBag.id + "1";
            ViewBag.ComId   = comId;
            return(PartialView());
        }