public JsonResult SendBillTypeNumber(string BillTypeNumber)
        {
            StaffApplication staffApplication = new StaffApplication();
            var item = (from p in db.BillProperties where BillTypeNumber == p.Type select p).FirstOrDefault();

            staffApplication.BillTypeName = item.TypeName;
            return Json(staffApplication);
        }
 public JsonResult SendData(string StaffNumber)
 {
     StaffApplication staffApplication = new StaffApplication();
     var itemStaff = (from p in db.Staffs
                      where StaffNumber == p.StaffNumber
                      select p.Name).FirstOrDefault();
     //赋值
     staffApplication.StaffName = itemStaff;
     //staffChange.EffectiveDate = null;
     staffApplication.HopeLeaveDate = null;
     staffApplication.ApplyDate = null;
     return Json(staffApplication);
 }
 public ActionResult Edit(StaffApplication staffApplication)
 {
     if (ModelState.IsValid)
     {
         /*查找预留字段(value)*/
         var fieldValueList = (from sar in db.StaffApplicationReserves
                               join rf in db.ReserveFields on sar.FieldId equals rf.Id
                               where sar.Number == staffApplication.Id
                               select new StaffApplicationViewModel { Id = sar.Id, Description = rf.Description, Value = sar.Value }).ToList();
         /*给预留字段赋值*/
         foreach (var temp in fieldValueList)
         {
             StaffApplicationReserve sar = db.StaffApplicationReserves.Find(temp.Id);
             sar.Value = Request[temp.Description];
             db.SaveChanges();
         }
         db.Entry(staffApplication).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(staffApplication);
 }