Exemple #1
0
        public void Execute(IJobExecutionContext context)
        {
            ServiceRequests requestsManager = new ServiceRequests();
            //get all the unreplaied requests and has new state
            List <RequestProvider> requests = requestsManager.GetAvalibaleRequests();

            //check if there is new requests
            if (requests.Any())
            {
                //update those requests state to expired if it has expired time
                foreach (RequestProvider request in requests.Where(request => request.ExpiryTime <= DateTime.Now))
                {
                    requestsManager.UpdateProviderRequest(request.RequestId, request.ProviderId, (int)RequestStutus.Expired,
                                                          "", request.Price ?? 0, 0);
                }

                /*  foreach (RequestProvider request in requests)
                 * {
                 *    if (request.ExpiryTime <= Servston.Utilities.GetCurrentClientDateTime())
                 *    {
                 *        requestsManager.UpdateProviderRequest(request.RequestId, request.ProviderId, (int)RequestStutus.Expired, "", request.Price ?? 0, 0);
                 *    }
                 * }*/
            }
        }
 public bool UpdateProviderRequest(int userId, int id, int status, string reason, decimal price, int duration = 0)
 {
     try
     {
         ServiceRequests _serviceRequests = new ServiceRequests();
         _serviceRequests.UpdateProviderRequest(id, userId, status, reason, price, duration);
         return(true);
     }
     catch (Exception ex)
     {
         // todo:log the exception
         return(false);
     }
 }
Exemple #3
0
        protected void lvServiceRequest_OnItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "UpdateModel")
            {
                int     id       = int.Parse(e.CommandArgument.ToString());
                int     status   = int.Parse(Request.Form["status"]);
                string  reason   = Request.Form["txtReason" + id.ToString()];
                decimal price    = decimal.Parse(Request.Form["txtPrice" + id.ToString()]);
                int     duration = int.Parse(Request.Form["txtDuration"] + id.ToString());
                try
                {
                    _serviceRequests.UpdateProviderRequest(id, CurrentUser.Id, status, reason, price, duration);

                    //finsh session
                    RedirectAndNotify(Request.RawUrl, "تم تنفيذ أمرك", "شكرا لك", NotificationType.Success);
                    //Notify("تم تنفيذ أمرك", "شكرا لك", NotificationType.Success);
                }
                catch
                {
                    RedirectAndNotify(Request.RawUrl, "هناك خطأ  أثناء إرسال أمرك...فضلا حاول لاحقا.", "حدث خطأ", NotificationType.Error);
                    //Notify("هناك خطأ  أثناء إرسال أمرك...فضلا حاول لاحقا.", "حدث خطأ", NotificationType.Error);
                }
            }
        }