Ejemplo n.º 1
0
 public object Employeepayslip(Employeepayslip employeepayslip)
 {
     using (webdevContext webdev = new webdevContext())
     {
         string msg       = "";
         bool   IsSuccess = true;
         try
         {
             MongoDBServer mongoDB = new MongoDBServer();
             var           model   = webdev.Employeepayslip.Where(a => a.BillId == employeepayslip.BillId).FirstOrDefault();
             if (model != null)
             {
                 model.BasePay      = employeepayslip.BasePay;
                 model.Deduction    = employeepayslip.Deduction;
                 model.Subsidy      = employeepayslip.Subsidy;
                 model.WagesPayable = employeepayslip.WagesPayable;
                 model.Other        = employeepayslip.Other;
                 model.PayDate      = employeepayslip.PayDate;
                 model.Remarks      = employeepayslip.Remarks;
                 model.UserId       = employeepayslip.UserId;
                 webdev.Employeepayslip.Update(model);
             }
             else
             {
                 webdev.Employeepayslip.Add(employeepayslip);
             }
             var i = webdev.SaveChanges();
             if (i <= 0)
             {
                 msg       = "发生未知错误";
                 IsSuccess = false;
             }
             if (model != null)
             {
                 mongoDB.db.GetCollection <Employeepayslip>("Employeepayslip").ReplaceOneAsync(a => a.BillId == employeepayslip.BillId, employeepayslip);
             }
             else
             {
                 mongoDB.InsertOne <Employeepayslip>(employeepayslip, "Employeepayslip");
             }
         }
         catch (Exception ex)
         {
             msg       = ex.Message;
             IsSuccess = false;
         }
         return(new { IsSuccess = IsSuccess, msg = msg });
     }
 }
Ejemplo n.º 2
0
        public IActionResult Employeepayslip(Employeepayslip employeepayslip)
        {
            var r = Iemployee.Employeepayslip(employeepayslip);

            return(Json(r));
        }