示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            bool result = isTrue(context);

            if (result)
            {
                context.Response.ContentType = "text/html";
                PersonalInfo info = getData(context);

                PersonalService service = new PersonalService();
                if (service.Add(info))
                {
                    Alert.AlertMessage("入职成功");
                    context.Response.Redirect("../asp/Backstage/EmployeeAdd.aspx");
                }
                else
                {
                    Alert.AlertFailed("入职失败");
                }
            }
            else
            {
                Alert.AlertFailed("入职失败,请检查填写数据是否完整");
            }
        }
示例#2
0
 public JsonResult Add(Personal model)
 {
     try
     {
         model.EntryDate = DateTime.Now;
         HttpPostedFile image = (HttpPostedFile)Session["image"];
         if (image == null)
         {
             model.Image = "/Content/Images/default.png";
             personalService.Add(model);
         }
         else
         {
             var path = Path.Combine(Server.MapPath("~/Content/Images/") + image.FileName);
             image.SaveAs(path);
             model.Image = "/Content/Images/" + image.FileName;
             personalService.Add(model);
         }
         Session.Remove("image");
         return(Json("1"));
     }
     catch { return(Json("0")); }
 }