Beispiel #1
0
        public ActionResult Login(Employee emplyee)
        {
            //验证账号密码
            short shRet = SystemContext.Instance.EmployeeService.Exists(emplyee.EmpNo, emplyee.Pwd, ref emplyee);

            if (shRet == ExecuteResult.OK)
            {
                Session["CurrentEmployee"] = emplyee;
                return(RedirectToAction("Index"));
            }
            else
            {
                string error = string.Empty;
                if (shRet == ExecuteResult.RES_NO_FOUND)
                {
                    error = "账号或密码错误";
                }
                else
                {
                    error = ExecuteResult.GetResultMessage(shRet);
                }
                ModelState.AddModelError("Message", error);
                return(View());
            }
        }
Beispiel #2
0
        protected void lbtnDelete_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.hfID.Value))
            {
                Response.Write("<script language='javascript'>alert('未添加新需求,无法撤销');</script>");
                return;
            }
            string ids   = "'" + this.hfID.Value + "'";
            short  shRet = SystemContext.Instance.DemandService.Delete(ids);

            Response.Write("<script language='javascript'>alert('" + ExecuteResult.GetResultMessage(shRet) + "');</script>");
            if (shRet == ExecuteResult.OK)
            {
                this.hfID.Value = string.Empty;
            }
            return;
        }
Beispiel #3
0
        public ActionResult Upload()
        {
            HttpFileCollectionBase files = Request.Files;//这里只能用<input type="file" />才能有效果,因为服务器控件是HttpInputFile类型
            string msg        = string.Empty;
            string error      = string.Empty;
            string imgurl     = string.Empty;
            string szTemplate = Request.Form["TemplateType"] == null ? "研究生考试" : Request.Form["TemplateType"].ToString();

            if (files.Count < 0)
            {
                return(Content(""));
            }
            string res = string.Empty;

            if (files[0].FileName == "")
            {
                error = "未选择文件";
                res   = "{ error:'" + error + "', msg:'" + msg + "',imgurl:'" + imgurl + "'}";
            }
            else
            {
                files[0].SaveAs(Server.MapPath(SystemContext.FilePath.Excel) + System.IO.Path.GetFileName(files[0].FileName));
                msg    = " 导入成功!请关闭窗口查看导入结果";
                imgurl = "/" + files[0].FileName;

                //处理数据导入
                try
                {
                    short shRet = SystemContext.Instance.UsersService.Import(Server.MapPath(SystemContext.FilePath.Excel) + System.IO.Path.GetFileName(files[0].FileName), SystemContext.Template.GetTemplate(szTemplate));
                    if (shRet != ExecuteResult.OK)
                    {
                        error = ExecuteResult.GetResultMessage(shRet);
                    }
                }
                catch (Exception ex)
                {
                    error = "导入失败";
                }
                res = "{ error:'" + error + "', msg:'" + msg + "',imgurl:'" + imgurl + "'}";
            }
            return(Content(res));
        }
Beispiel #4
0
        protected void lbtnSubmit_Click(object sender, EventArgs e)
        {
            Employee employee = Session["CurrentEmployee"] as Employee;

            if (employee == null)
            {
                Response.Write("<script language='javascript'>alert('系统未登录,请重新登陆后提交!');</script>");
                return;
            }
            Demand demand = new Demand();

            if (this.FileAttach.HasFile)
            {
                try
                {
                    this.FileAttach.SaveAs(Server.MapPath(SystemContext.FilePath.Demand) + System.IO.Path.GetFileName(this.FileAttach.FileName));
                    demand.FileAttach = string.Format("{0}{1}", SystemContext.FilePath.Demand.Replace("~", ""), this.FileAttach.FileName);
                }
                catch (Exception)
                {
                    Response.Write("<script language='javascript'>alert('附加上传不成功!');</script>");
                    return;
                }
            }

            demand.ID         = SystemContext.Instance.CreatIDs("Demand");
            demand.Product    = this.ddlProduct.Text;
            demand.Creater    = employee.EmpNo;
            demand.SubmitTime = DateTime.Now;
            demand.State      = SystemContext.DemandState.Submit;
            demand.Question   = this.CKEditorControl1.Text;
            demand.Title      = this.txtNewsTitle.Text;
            short  shRet = SystemContext.Instance.DemandService.Add(demand);
            string msg   = ExecuteResult.GetResultMessage(shRet);

            Response.Write("<script language='javascript'>alert('" + msg + "!');</script>");
        }
Beispiel #5
0
        public ActionResult Login(Users users)
        { //验证账号密码
            short shRet = SystemContext.Instance.UsersService.Exists(users.Tel, users.PassWord, ref users);

            if (shRet == ExecuteResult.OK)
            {
                Session["CurrentUser"] = users;
                return(RedirectToAction("UserInfo"));
            }
            else
            {
                string error = string.Empty;
                if (shRet == ExecuteResult.RES_NO_FOUND)
                {
                    error = "账号或密码错误";
                }
                else
                {
                    error = ExecuteResult.GetResultMessage(shRet);
                }
                ModelState.AddModelError("Message", error);
                return(View());
            }
        }
Beispiel #6
0
        protected void lbtnSubmit_Click(object sender, EventArgs e)
        {
            Employee employee = Session["CurrentEmployee"] as Employee;
            Demand   demand   = new Demand();

            if (employee == null)
            {
                Response.Write("<script language='javascript'>alert('系统未登录,请重新登陆后提交!');</script>");
                return;
            }


            if (this.FileAttach.HasFile)
            {
                try
                {
                    this.FileAttach.SaveAs(Server.MapPath(SystemContext.FilePath.Demand) + System.IO.Path.GetFileName(this.FileAttach.FileName));
                    demand.FileAttach = string.Format("{0}{1}", SystemContext.FilePath.Demand.Replace("~", ""), this.FileAttach.FileName);
                }
                catch (Exception)
                {
                    Response.Write("<script language='javascript'>alert('附加上传不成功!');</script>");
                    return;
                }
            }
            else
            {
                demand.FileAttach = this.linkFileAttach.Text;
            }
            if (string.IsNullOrEmpty(this.txtCreater.Text))
            {
                demand.Creater = employee.EmpNo;
            }
            else
            {
                demand.Creater = this.txtCreater.Text;
            }
            demand.Product = this.ddlProduct.Text;
            if (!string.IsNullOrEmpty(this.txtSubmitTime.Text.Trim()))
            {
                demand.SubmitTime = DateTime.Parse(this.txtSubmitTime.Text.Trim());
            }
            demand.Owener = this.txtOwener.Text.Trim();
            if (!string.IsNullOrEmpty(this.txtSoluteTime.Text.Trim()))
            {
                demand.SoluteTime = DateTime.Parse(this.txtSoluteTime.Text);
            }
            demand.State       = this.ddlState.Text;
            demand.Question    = this.CKEditorControl1.Text;
            demand.Title       = this.txtTitle.Text;
            demand.Expense     = this.txtExpense.Text;
            demand.Solution    = this.CKEditorControl2.Text;
            this.hfState.Value = demand.State;
            short shRet;

            if (string.IsNullOrEmpty(this.hfID.Value))
            {
                demand.SubmitTime  = DateTime.Now;
                demand.ID          = SystemContext.Instance.CreatIDs("Demand");
                shRet              = SystemContext.Instance.DemandService.Add(demand);
                this.hfID.Value    = demand.ID.ToString();
                this.hfState.Value = demand.State;
            }
            else
            {
                demand.ID = hfID.Value;
                shRet     = SystemContext.Instance.DemandService.Update(demand);
            }
            string msg = ExecuteResult.GetResultMessage(shRet);

            Response.Write("<script language='javascript'>alert('" + msg + "!');</script>");
            if (shRet == ExecuteResult.OK)
            {
                this.linkFileAttach.Text        = demand.FileAttach;
                this.linkFileAttach.NavigateUrl = demand.FileAttach;
                GetStateMap();
            }
        }