コード例 #1
0
        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);
            }
        }
コード例 #2
0
        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            string paymentMethod = Request.Form["cars"];
            string payId         = "";

            CurrentRequest.ModifiedDate = DateTime.Now;
            SetShippingInfo();
            // save uploaded files
            List <string> fileNames  = new List <string>();
            List <string> errorsList = new List <string>();

            SaveUploadedFile(fup1, fileNames, errorsList);
            SaveUploadedFile(fup2, fileNames, errorsList);
            SaveUploadedFile(fup3, fileNames, errorsList);
            SaveUploadedFile(fup4, fileNames, errorsList);
            if (errorsList.Count > 0)
            {
                Notify(string.Join("\r\n", errorsList.ToArray()), "حدث خطأ أثناء الطلب", NotificationType.Error);
                return;
            }
            else
            if (fileNames.Count > 0)
            {
                _serviceRequests.AddRequestAttchments(fileNames, CurrentRequest.Id, false);
            }

            switch (paymentMethod)
            {
            case "1":    //online payment
                CurrentRequest.PaymentMethod = 1;
                _serviceRequests.UpdateServiceRequest(CurrentRequest);
                //PaymentManager paymentManager = new PaymentManager();
                //string brand = hfCardBrand.Value.Length > 1 ? hfCardBrand.Value : "";
                //if (brand == "mastercard") brand = "MASTER";
                if (CurrentRequest.CurrentPrice != null)
                {
                    // paymentManager.Checkout(CurrentRequest.CurrentPrice.Value, CurrentRequest.Id.ToString(),1,Servston.Utilities.GetCurrentClientIPAddress());
                    //var _return = paymentManager.Pay(CurrentRequest.CurrentPrice.Value, CurrentRequest.Id.ToString(), txtCardNo.Value, txtCardHolder.Value, txtExpiryDate.Value.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)[0], "20" + txtExpiryDate.Value.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries)[1], txtCvv.Value, 1, Servston.Utilities.GetCurrentClientIPAddress(), brand.ToUpper());
                    // payId = _return["id"];
                    // CurrentRequest.PaymentReferanceCode = payId;
                    // fire the javascript function to pay online payOnline()
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "payOnline();", true);
                }
                break;

            case "2":    //transfare payment...set to in progress if saved
                CurrentRequest.PaymentMethod        = 2;
                CurrentRequest.PaymentProviderName  = ddlBanks.Value;
                CurrentRequest.PaymentDate          = DateTime.ParseExact(txtDate.Value, "dd/MM/yyyy", new System.Globalization.CultureInfo("en-GB")); // DateTime.Parse(txtDate.Value);
                CurrentRequest.PaymentReferanceCode = txtRefNumber.Value;
                CurrentRequest.PaymentAccountNumber = txtBakAccountNum.Value;
                CurrentRequest.StatusId             = (int)RequestStatus.Paid;

                _serviceRequests.UpdateServiceRequest(CurrentRequest);

                //send sms to admin
                string sms =
                    string.Format(
                        "تحويل بنكي جديد على طلب رقم {0} الخاص بخدمة {1} بقيمة {2}",
                        CurrentRequest.Id, CurrentRequest.Service.Name, CurrentRequest.CurrentPrice);
                Servston.SMS smsManager = new Servston.SMS();
                smsManager.SendToAdmin(sms);
                RedirectAndNotify(GetLocalizedUrl("clients/services-requests/approved-requests"), "رجاءاَ قم بالإتصال بالإدارة للتأكد من وصول الحوالة.");
                break;

            default:

                break;
            }


            //if (paymentMethod == "1" && payId.Length > 3)
            //    Response.Redirect(HyperPayClient.MerchantConfiguration.Config.ReturnUrl, false);
        }