Beispiel #1
0
 public ActionResult Create(OutsourcingCostVo entity)
 {
     try
     {
         var obj = new OutsourcingCost
         {
             Contract              = db.Contracts.Find(entity.ContractId),
             BeginTime             = entity.BeginTime,
             EndTime               = entity.EndTime,
             Days                  = entity.Days,
             Pay                   = entity.Pay,
             OutsourcingPeopleName = entity.OutsourcingPeopleName,
             Memo                  = entity.Memo,
             Subtotal              = entity.Days * entity.Pay * (1 + ManageHelper.Rate)
         };
         obj.AuditAmount = obj.Subtotal;
         db.OutsourcingCosts.Add(obj);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         return(Json(new { IsSuccess = false, Message = ex.Message }, "text/html", JsonRequestBehavior.AllowGet));
     }
     return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet));
 }
Beispiel #2
0
 public ActionResult Delete(IList <int> idList)
 {
     foreach (var id in idList)
     {
         OutsourcingCost obj = db.OutsourcingCosts.Find(id);
         db.OutsourcingCosts.Remove(obj);
         db.SaveChanges();
     }
     return(Json(new { IsSuccess = true, Message = "保存成功" }));
 }
Beispiel #3
0
 public ActionResult Audit(OutsourcingCost model)
 {
     try
     {
         var entity = db.OutsourcingCosts.Find(model.Id);
         entity.AuditAmount     = model.AuditAmount;
         db.Entry(entity).State = EntityState.Modified;
         db.SaveChanges();
         return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { IsSuccess = false, Message = ex.Message }, "text/html", JsonRequestBehavior.AllowGet));
     }
 }
Beispiel #4
0
 public ActionResult Edit(OutsourcingCost model, int ContractId)
 {
     try
     {
         model.Contract        = db.Contracts.Find(ContractId);
         model.Subtotal        = model.Days * model.Pay * (1 + ManageHelper.Rate);
         model.AuditAmount     = model.Subtotal;
         db.Entry(model).State = EntityState.Modified;
         db.SaveChanges();
         return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { IsSuccess = false, Message = ex.Message }, "text/html", JsonRequestBehavior.AllowGet));
     }
 }