示例#1
0
 public ActionResult ChangeStatus(LeaveStatusModel obj)
 {
     obj.UserId = UserId;
     using (var client = new LeaveClient())
     {
         string Status = client.ChangeStatus(obj);
         if (Status == "Saved")
         {
             string action = string.Empty;
             if (obj.Status == "R")
             {
                 action = "Rejected";
             }
             else if (obj.Status == "A")
             {
                 action = "Approved";
             }
             else if (obj.Status == "C")
             {
                 action = "Cancelled";
             }
             try
             {
                 EmailHelper emailHelper = new EmailHelper();
                 //#if DEBUG
                 emailHelper.SendRequestEmail(Convert.ToInt64(obj.LeaveId), action);
                 //#else
                 //    BackgroundJob.Enqueue(() => emailHelper.SendEmail(Convert.ToInt64(obj.LeaveId), action));
                 //#endif
             }
             catch
             {
                 throw;
             }
         }
         return(Json(Status));
     }
 }