protected void lvServiceRequest_OnItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (e.CommandName == "UpdateModel")
     {
         int id       = int.Parse(e.CommandArgument.ToString());
         int duration = int.Parse(Request.Form["txtDuration"]);
         _serviceRequests.IncreaceRequestDuration(id, duration);
     }
 }
        public bool IncreaseProviderRequest(int id, int duration)
        {
            try
            {
                ServiceRequests _serviceRequests = new ServiceRequests();
                _serviceRequests.IncreaceRequestDuration(id, duration);
                // send notification to the first provider

                var request = _serviceRequests.GetRequest(id);
                var client  = _serviceRequests.GetRequest(id).Client;
                Dictionary <string, string> keysValues = new Dictionary <string, string>
                {
                    { "name", client.FullName },
                    { "no", id.ToString() },
                    { "ServiceName", request.Service.LocalizedServices.First(l => l.LanguageId == 3073).Title }
                };

                string replyToAddress  = WebConfigurationManager.AppSettings["ContactUsEmail"];
                string adminEmail      = WebConfigurationManager.AppSettings["AdminEmail"];
                string siteMasterEmail = WebConfigurationManager.AppSettings["SiteMasterEmail"];
                try
                {
                    //send email
                    Servston.MailManager.SendMail("client/request-time.html", keysValues,
                                                  "تم تمديد مدة تنفيذ طلبكم ببوابة خدماتكم",
                                                  UserManger.GetEmail(client.UserId.Value), adminEmail, replyToAddress, new List <string>()
                    {
                        siteMasterEmail
                    });


                    Servston.SMS smsManager = new Servston.SMS();
                    //send sms to client
                    string sms =
                        string.Format(
                            "تمديد مدة تنفيذ طلبكم رقم {0} الخاص ب  {1} بمدة {2} يوم",
                            id, request.Service.LocalizedServices.First(l => l.LanguageId == 3073).Title, duration);
                    if (!string.IsNullOrEmpty(request.Client.MobielNumber) && request.Client.MobielNumber.Length > 10)
                    {
                        smsManager.Send(request.Client.MobielNumber, sms + " - https://e-kdmat.com/");
                    }

                    //send sms to admins
                    sms =
                        string.Format(
                            "تمديد مدة تنفيذ طلب رقم {0} الخاص بشريك الخدمة {1} بمدة {2} يوم",
                            id, request.Provider.CompanyName, duration);

                    smsManager.SendToAdmin(sms);
                }
                catch (Exception ex)
                {
                }

                return(true);
            }
            catch (Exception ex)
            {
                // todo:log the exception
                return(false);
            }
        }