public ActionResult Return(FormCollection form)
        {
            try
            {
                string transaction_id = string.Empty;
                string order_id       = string.Empty;

                string[] keys = Request.Form.AllKeys;
                Array.Sort(keys);


                string hash = gethash(keys, form);
                if (form["hash"] == hash)
                {
                    if (form["response_code"] == "0")
                    {
                        transaction_id = Request.Form["transaction_id"];
                        order_id       = Request.Form["order_id"];

                        ViewData["Message"] = "Transaction is successful. Your tranaction ID is: " + transaction_id + " and order id is: " + order_id + ". Please save it for future reference.";
                        HelpingMethods hm = new HelpingMethods();

                        var resulttovisitor = hm.SendMailSales(Request.Form["email"], "eBrickKiln- Payment Successful", mailcontent(transaction_id, order_id), "eBrickKiln- Sales");

                        //  Response.Write("<br/>Transaction is successful. Hash value is matched");
                    }
                    else if (form["response_message"] == "Transaction Failed")
                    {
                        ViewData["Message"] = "Transaction is unsuccessful. Please try again.";
                    }
                    else
                    {
                        string response_message = Request.Form["response_message"];
                        int    startIndex       = response_message.IndexOf(" - ") + 2;
                        int    length           = response_message.Length - startIndex;
                        response_message = response_message.Substring(startIndex, length);
                        //Response.Write("Correct the below error <br />");
                        //Response.Write(response_message);
                        ViewData["Message"] = "To continue to transaction, please correct the error: " + response_message;
                    }
                }
                else
                {
                    ViewData["Message"] = "Transaction is unsuccessful. Please try again.";

                    //Response.Write("<br/>Hash value Not matched");
                }
            }
            catch (Exception ex)
            {
                Response.Write("<span style='color:red'>" + ex.Message + "</span>");
            }
            return(View("../Onlinepay/Return"));
        }
Exemple #2
0
        public string StringFrequency()
        {
            if (Frequency == 1)
            {
                return("1 пост каждый день");
            }
            else
            {
                var correspondingEnding = HelpingMethods.ChoosingTheCorrespondingEnding(" день", " дня", " дней", Frequency);

                return("1 пост раз в " + Frequency.ToString() + correspondingEnding);
            }
        }
        private bool CheckingWhetherNonImagedInformationIsFilledCorrectly()
        {
            if (NameTextBox.Text == defaultName)
            {
                MessageBox.Show("Укажите название для рубрики.", "Ошибка");

                NameTextBox.Focus();

                return(false);
            }
            if (SpecialProjectRadioButton.IsChecked == false && _storage.Rubrics.Items.Count(rubr => !rubr.SpecialProject && rubr != _rubric && rubr.Name == NameTextBox.Text) > 0)
            {
                MessageBox.Show("В системе уже существует рубрика с таким названием.", "Ошибка");

                NameTextBox.Text = "";
                NameTextBox.Focus();

                return(false);
            }
            if (SpecialProjectRadioButton.IsChecked == true && _storage.Rubrics.Items.Count(rubr => rubr.SpecialProject && rubr != _rubric && rubr.Name == NameTextBox.Text) > 0)
            {
                MessageBox.Show("В системе уже существует спецпроект с таким названием.", "Ошибка");

                NameTextBox.Text = "";
                NameTextBox.Focus();

                return(false);
            }
            if (SpecialProjectRadioButton.IsChecked == false && EditorsRubricRadioButton.IsChecked == false)
            {
                MessageBox.Show("Укажите тип рубрики.", "Ошибка");

                return(false);
            }
            if (ActualRubricCheckBox.IsChecked == false)
            {
                var numberOfEditors = _storage.Users.Items.Count(u => u.WorkingNow && (u.Editor || u.Special) && u.EditorsRubrics.Exists(r => r.Rubric == _rubric));

                if (numberOfEditors > 0)
                {
                    MessageBox.Show("Эта рубрика не может быть назначена устаревшей, поскольку есть " + numberOfEditors.ToString() + " редактор" +
                                    HelpingMethods.ChoosingTheCorrespondingEnding(ending1, ending234, ending5, numberOfEditors) +
                                    " данной рубрикой в настоящий момент.", "Ошибка");

                    return(false);
                }
            }

            return(true);
        }
        public ActionResult RequestQuote(QuoteModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    HelpingMethods hm = new HelpingMethods();
                    //if (!hm.CheckReCaptcha(Request["g-recaptcha-response"]))
                    //{
                    //    ViewBag.resultmail = "Captcha is not valid. Please try again.";
                    //    return View();
                    //}


                    StringBuilder sbEmailBodyl = new StringBuilder();
                    sbEmailBodyl.Append("<table border='1' style='width:100%;'>");
                    sbEmailBodyl.Append("<tr><th colspan='2'>Owner Details</th></tr>");
                    sbEmailBodyl.Append("<tr><td>Name </td><td>" + model.Name + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>Designation </td><td>" + model.Designation + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>Contact Number </td><td>" + model.Mobile + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>Email </td><td>" + model.Email + "</td></tr>");
                    sbEmailBodyl.Append("<tr><th colspan='2'>Business Details</th></tr>");
                    sbEmailBodyl.Append("<tr><td>BKO or Business Name </td><td>" + model.Org_Name + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>Brick Kiln or Business Type </td><td>" + model.busiess_type + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>Location </td><td>" + model.City_village + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>City or Village </td><td>" + model.District + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>State </td><td>" + model.State + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>Country</td><td>" + model.Country + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>See the Vedio Demo First</td><td>" + model.seen_video + "</td></tr>");
                    sbEmailBodyl.Append("<tr><td>Interested For</td><td>" + model.Interested_for + "</td></tr>");
                    sbEmailBodyl.Append("</table>");
                    //var result = hm.SendMail("*****@*****.**", "Request Quote", sbEmailBodyl.ToString(), "eBrickKiln- " + model.Interested_for + ", Request Quote by vistor");

                    var result          = hm.SendMailSales("*****@*****.**", "eBrickKiln- " + model.Interested_for, sbEmailBodyl.ToString(), "eBrickKiln- Sales");
                    var resulttovisitor = hm.SendMailSales(model.Email, "eBrickKiln- Greetings", MailToClient(), "eBrickKiln- Sales");

                    var resultsms = hm.sendsmsany("Thanks from 'uSofts' to show your interest in our eBrickkiln product for your business. Detail sent on your mail Id Soon you will get call from sale executive.", model.Mobile);

                    if (result)
                    {
                        //ViewBag.resultmail = "Your message sent.";
                        return(View("ContactSuccess"));
                    }
                }
            }
            catch { }
            return(View());
        }
        public ActionResult ResendOTP()
        {
            var status = false;

            try
            {
                HelpingMethods hm = new HelpingMethods();
                Session["otp"] = hm.RandomNumber();
                string message = "OTP is " + Session["otp"].ToString() + " for login to brick kiln support.";
                var    r       = hm.sendsmsany(message, Session["mobilenumber"].ToString());
                status = true;
            }
            catch { }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
        public ActionResult Index(Contact model)
        {
            ViewBag.resultmail = null;

            try
            {
                if (ModelState.IsValid)
                {
                    HelpingMethods hm = new HelpingMethods();
                    //if (!hm.CheckReCaptcha(Request["g-recaptcha-response"]))
                    //{
                    //    ViewBag.resultmailhome = "Captcha is not valid. Please try again.";
                    //    return View();
                    //}

                    ViewBag.resultmailhome = "Message not sent";

                    StringBuilder sbEmailBodyl = new StringBuilder();

                    sbEmailBodyl.Append("Name: " + model.Name + "<br/>");
                    sbEmailBodyl.Append("Email: " + model.Email + "<br/>");
                    sbEmailBodyl.Append("Mobile: " + model.Mobile + "<br/>");
                    sbEmailBodyl.Append("Message: " + model.Message + "<br/>");
                    var result = hm.SendMail("*****@*****.**", "Message", sbEmailBodyl.ToString(), "eBrickKiln, Message by visitor");
                    //var result = hm.SendMail("*****@*****.**", "Message", sbEmailBodyl.ToString(), "Usofts, Message by visitor");

                    if (result)
                    {
                        ViewBag.resultmailhome = "Message succesfully sent.";
                    }
                    //return View("SuccessMessage");
                    //return View();
                }
            }
            catch { }

            return(View());
        }
        //[ValidateAntiForgeryToken]
        public ActionResult Login(LoginModel model, string byotp, string bypassword)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var localusermobile = model.MobileLogin.Trim();

                    if (localusermobile.All(char.IsDigit))
                    {
                        if (localusermobile.Length == 10)
                        {
                            var userdetail = _mainobj.GetByMobile(localusermobile);
                            if (userdetail == null)
                            {
                                ModelState.AddModelError("MobileLogin", "Mobile is not registered with us, please contact us to get registerd.");
                                return(View());
                            }
                            else
                            {
                                if (userdetail.userblocked)
                                {
                                    ModelState.AddModelError("MobileLogin", "Your account is blocked by admin.");
                                    return(View());
                                }
                                var currentwebsite        = "Brick Kiln,";
                                var userforcuurentwebsite = userdetail.formodule.Contains(currentwebsite);
                                if (!userforcuurentwebsite)
                                {
                                    ModelState.AddModelError("MobileLogin", "Mobile is not registered with us for current website, please contact us to get registerd.");
                                    return(View());
                                }
                            }

                            if (!string.IsNullOrEmpty(byotp))
                            {
                                HelpingMethods hm = new HelpingMethods();

                                Session["otp"] = hm.RandomNumber();
                                //Session["otp"] = 1111;/////////////////////////////////////// temp
                                Session["mobilenumber"] = model.MobileLogin;
                                ViewBag.mobilenumber    = model.MobileLogin;

                                string message = "OTP is " + Session["otp"].ToString() + " for login to brick kiln support.";
                                var    result  = hm.sendsmsany(message, ViewBag.mobilenumber);

                                Session["modelvalues"] = model;
                                opttrycount            = 0;
                                return(View("ConfirmOTP"));
                            }
                            else if (!string.IsNullOrEmpty(bypassword))
                            {
                                var upassword   = StaticData.GetSHA512(model.Password);
                                var loginresult = _mainobj.GetByMobilePassword(localusermobile, upassword);
                                if (loginresult != null)
                                {
                                    FormsAuthentication.Initialize();
                                    HttpContext currentContext       = System.Web.HttpContext.Current;
                                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                                        1, loginresult.clientname, DateTime.Now, DateTime.Now.AddMinutes(30), true,
                                        loginresult.userrole, FormsAuthentication.FormsCookiePath);
                                    string     hash   = FormsAuthentication.Encrypt(ticket);
                                    HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);
                                    currentContext.Response.Cookies.Add(cookie);

                                    AuthenticateThisRequest();

                                    if (User.IsInRole("Admin"))
                                    {
                                        return(RedirectToAction("Index", "Description"));
                                    }
                                    else if (User.IsInRole("Support"))
                                    {
                                        return(RedirectToAction("ClientDetail", "Support"));
                                    }
                                    else if (User.IsInRole("Client"))
                                    {
                                        return(RedirectToAction("Index", "Support"));
                                    }
                                }
                                else
                                {
                                    ModelState.AddModelError("MobileLogin", "Mobile or Password is not valid");
                                    return(View("LoginAdmin"));
                                }
                            }
                        }
                    }
                }
                catch { }
            }
            ModelState.AddModelError("MobileLogin", "Mobile is not valid");
            return(View());
        }
        private bool CheckingWhetherAllFieldsFilledCorrectly()
        {
            if (NameTextBox.Text == defaultDocumentName)
            {
                MessageBox.Show("Укажите название документа.", "Ошибка");

                NameTextBox.Focus();

                return(false);
            }
            if (DateTextBox.Text == defaultDocumentDate || DateTextBox.Text == "")
            {
                MessageBox.Show("Укажите дату создания документа в формате ДД.ММ.ГГГГ либо нажмите на кнопку 'Cегодня', чтобы задать в качестве даты создания сегодняшний день.", "Ошибка");

                DateTextBox.Focus();

                return(false);
            }
            if (PublicDocumentRadioButton.IsChecked == false && HiddenDocumentRadioButton.IsChecked == false)
            {
                MessageBox.Show("Укажите уровень доступности документа.", "Ошибка");

                PublicDocumentRadioButton.Focus();

                return(false);
            }
            if (ContentTextBox.Text == defaultDocumentText)
            {
                MessageBox.Show("Документ не может быть пустым.", "Ошибка");

                ContentTextBox.Focus();

                return(false);
            }
            if (_storage.Documents.Items.Count(doc => doc.Name == NameTextBox.Text && doc != _document) > 0)
            {
                MessageBox.Show("В системе уже существует документ с таким названием.", "Ошибка");

                NameTextBox.Text = "";
                NameTextBox.Focus();

                return(false);
            }
            if (!HelpingMethods.TryParsingTheDate(DateTextBox.Text))
            {
                MessageBox.Show("Дата в полях должна задаваться в формате ДД.ММ.ГГГГ — например: 25.05.2017 . Оформите дату создания документа корректно либо воспользуйтесь кнопкой 'Сегодня', чтобы быстро указать сегодняшний день.", "Ошибка");

                DateTextBox.Text = "";
                DateTextBox.Focus();

                return(false);
            }
            if (DateTime.Parse(DateTextBox.Text) > DateTime.Now)
            {
                MessageBox.Show("Некорректная дата. Этот день еще не наступил.", "Ошибка");

                DateTextBox.Text = "";
                DateTextBox.Focus();

                return(false);
            }
            if (DateTime.Parse(DateTextBox.Text) < DateTime.Parse(foundationStringDate))
            {
                MessageBox.Show("Некорректная дата. В это время нашей компании еще не существовало.", "Ошибка");

                DateTextBox.Text = "";
                DateTextBox.Focus();

                return(false);
            }
            if (_document.Id != -1 && DateTime.Parse(DateTextBox.Text) > _document.Versions[0].Date)
            {
                MessageBox.Show("Некорректная дата создания документа. К моменту наступления этого дня, некоторые версии уже были зарегистрированы в системе.", "Ошибка");

                DateTextBox.Text = "";
                DateTextBox.Focus();

                return(false);
            }

            return(true);
        }