Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string encruptedIdValue = "";

            TryGetRouteParameter("Key", out encruptedIdValue);
            _id = encruptedIdValue.DecodeNumber();

            CurrentRequest = _serviceRequests.GetRequest(_id);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string encruptedIdValue = "";

            TryGetRouteParameter("Key", out encruptedIdValue);
            _id = encruptedIdValue.DecodeNumber();

            CurrentRequest = _serviceRequests.GetRequest(_id);
            var method = CurrentRequest.Service.ShippingMethods;

            switch (method)
            {
            case ShippingMethods.None:
                ShippingPrice = 0;
                break;

            case ShippingMethods.OneWay:
                ShippingPrice = 30;
                CurrentRequest.ShippingStatus = ShippingStatus.SentToPartner;
                break;

            case ShippingMethods.TwoWays:
                ShippingPrice = ShippingPrice * 2;
                break;

            default:
                ShippingPrice = 0;
                break;
            }
            if (CurrentRequest.CurrentPrice.HasValue)
            {
                ServicePrice = CurrentRequest.CurrentPrice.Value - ShippingPrice;
            }
            if (!IsPostBack)
            {
                txtShippingAddress.Value = CurrentRequest.ShippingAddress;
                txtShippingPhone.Value   = CurrentRequest.ShippingPhone;
                txtShippingName.Value    = CurrentRequest.ShippingName;
            }
            Summary = string.Format("<span style='display:inline-block;float:right;'><span class='blue'> :عزيزيى </span></span><span style='display:inline-block;' class='text-red'>{0}</span><br>   <span class='blue'>لقد قمت بطلب خدمة :<span class='text-red'>{1}</span></span>   <br> <span class='blue'>والتي تبلغ قيمتها :<span class='text-red'> {2} ريال </span></span> <br> <span class='blue'>ولاكمال الطلب نرجو الضغط على زر إرسال <br>  شكرا لكم لاختياركم خدمات كوم </span>", CurrentUser.FullName, CurrentRequest.Service.LocalizedServices.First(l => l.LanguageId == LanguageId).Title, CurrentRequest.CurrentPrice);
        }
        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);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperPayClient.PaymentManager paymentManager = new HyperPayClient.PaymentManager();
            string           id   = Request.QueryString["id"];
            string           code = paymentManager.GetPaymentStatus(id)["result"]["code"];
            string           accesptedCodesstring = "000.000.100,000.100.110, 000.100.111,000.100.112";
            List <string>    acceptedCodes        = accesptedCodesstring.Split(',').ToList();
            string           url;
            string           message;
            NotificationType notificationType;

            if (acceptedCodes.Contains(code))
            {
                //accept the payment
                int             transactionId   = paymentManager.GetTransactionId(id);
                ServiceRequests serviceRequests = new ServiceRequests();
                serviceRequests.PayRequest(transactionId);

                url              = GetLocalizedUrl("clients/services-requests/inprogress-requests");
                message          = "تم التأكد من عملية الدفع وطلبك جارى تنفيذه...";
                notificationType = NotificationType.Success;

                //send notification
                var request = serviceRequests.GetRequest(transactionId);
                Dictionary <string, string> keysValues = new Dictionary <string, string>
                {
                    { "name", request.Client.FullName },
                    { "no", request.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 to client
                    Servston.MailManager.SendMail("client/request-paid.html", keysValues, "بوابة خدماتكم",
                                                  UserManger.GetEmail(request.Client.UserId.Value), adminEmail, replyToAddress, new List <string>()
                    {
                        siteMasterEmail
                    });
                    //send to provider
                    Servston.MailManager.SendMail("provider/request-paid.html", keysValues, "بوابة خدماتكم",
                                                  UserManger.GetEmail(request.Provider.UserId.Value), adminEmail, replyToAddress, new List <string>()
                    {
                        siteMasterEmail
                    });


                    //send sms to the client
                    if (!string.IsNullOrEmpty(request.Client.MobielNumber) &&
                        request.Client.MobielNumber.Length > 10)
                    {
                        string sms =
                            string.Format(
                                "عميلنا العزيز تم استلام فاتورة طلبكم رقم {0} بقيمة {1} وسيتم البدء بتنفيذها خلال المدة المتفق عليها شكرا لكم لإستخدامكم خدمات كوم.",
                                transactionId, request.CurrentPrice);
                        Servston.SMS smsManager = new Servston.SMS();
                        smsManager.Send(request.Client.MobielNumber, sms + " - https://e-kdmat.com/");
                    }
                    //send to provider
                    keysValues = new Dictionary <string, string>
                    {
                        { "name", request.Provider.FullName },
                        { "no", request.Id.ToString() },
                        { "ServiceName", request.Service.LocalizedServices.First(l => l.LanguageId == 3073).Title }
                    };

                    if (!string.IsNullOrEmpty(request.Provider.MobielNumber) &&
                        request.Provider.MobielNumber.Length > 10)
                    {
                        string sms =
                            string.Format(
                                "شريكنا العزيز تم تأكيد طلب خدمة{0} من قبل العميل يمكنكم البدء بتنفيذ الخدمة",
                                request.Service.LocalizedServices.First(l => l.LanguageId == 3073).Title);
                        Servston.SMS smsManager = new Servston.SMS();
                        smsManager.Send(request.Provider.MobielNumber, sms + " - https://e-kdmat.com/");
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                url              = GetLocalizedUrl("clients/services-requests/approved-requests");
                message          = "حدث خطأ اثناء عملية الدفع رجاءاَ قم بالإتصال بالإدارة.";
                notificationType = NotificationType.Error;
            }

            RedirectAndNotify(url, message, "", notificationType);
        }