Exemplo n.º 1
0
        public ActionResult AddReview(iproby.Models.review model)
        {
            if (Session["login"] != null)
            {
                string login           = Session["login"].ToString();
                var    customer_id_arr = (from a in db.customers
                                          where a.login == login
                                          select a.customer_id);
                int customer_id = 0;
                foreach (int item in customer_id_arr)
                {
                    customer_id = item;
                }
                iproby.Data_Model.review review = new iproby.Data_Model.review();
                review.reviewer_id = customer_id;
                review.announ_id   = model.announ_id;
                review.customer_id = model.customer_id;
                var to_contact_id_arr = (from a in db.customers
                                         where a.customer_id == model.customer_id
                                         select a.contact_id);
                int to_contact_id = 0;
                foreach (int item in to_contact_id_arr)
                {
                    to_contact_id = item;
                }
                var contact_arr = (from a in db.contacts
                                   where a.contact_id == to_contact_id
                                   select a);
                string email = string.Empty;
                foreach (var item in contact_arr)
                {
                    email = item.email;
                }
                review.header      = model.header;
                review.description = model.description;
                DateTime Now = DateTime.Now;
                review.date_from = Now;
                db.reviews.Add(review);
                db.SaveChanges();
                InformationController notification = new InformationController();
                notification.SendMail(email,
                                      @"К вашему объявлению добавили комментарий на сайте IPRO. 
                Пожалуйста, проверьте в личном кабинете и по возможости напишите ответ (ответить автору сообщения возможно в Личном кабинете).

                Письмо сгенерировано автоматически. По всем вопросам пишите на [email protected]");
                isSaved = true;
                return(RedirectToAction("Index", new { announ_id = model.announ_id }));
            }
            else
            {
                notLogin = true;
                return(RedirectToAction("Index", new { announ_id = model.announ_id }));
            }
        }
Exemplo n.º 2
0
 public ActionResult SendMessage(iproby.Models.message model)
 {
     if (Session["login"] != null)
     {
         iproby.Data_Model.message message = new iproby.Data_Model.message();
         DateTime Now = DateTime.Now;
         message.date_from = Now;
         string login           = Session["login"].ToString();
         var    customer_id_arr = (from a in db.customers
                                   where a.login == login
                                   select a);
         int customer_id = 0; int contact_id = 0;
         foreach (var item in customer_id_arr)
         {
             customer_id = item.customer_id;
             contact_id  = item.contact_id;
         }
         var contact_arr = (from a in db.contacts
                            where a.contact_id == contact_id
                            select a);
         string email = string.Empty;
         foreach (var item in contact_arr)
         {
             email = item.email;
         }
         message.from_customer_id = customer_id;
         message.to_customer_id   = model.to_customer;
         message.header           = model.header;
         message.text_mess        = model.text;
         db.messages.Add(message);
         db.SaveChanges();
         InformationController notification = new InformationController();
         notification.SendMail(email, "Вам пришло сообщение на сайте IPRO. Пожалуйста проверьте в личном кабинете.");
         if (model.form_flag != null && model.form_flag == 1)
         {
             return(RedirectToAction("Answer", "Message", new { message_id = model.message_id }));
         }
         else
         {
             return(View("~/Views/Status/SendMessageSuccess.cshtml"));
         }
     }
     else
     {
         return(View("~/Views/Status/NoAuthorization.cshtml"));
     }
 }
Exemplo n.º 3
0
        public ActionResult AddReview(iproby.Models.review model)
        {
            if (Session["login"] != null)
            {
                string login = Session["login"].ToString();
                var customer_id_arr = (from a in db.customers
                                       where a.login == login
                                       select a.customer_id);
                int customer_id = 0;
                foreach (int item in customer_id_arr)
                {
                    customer_id = item;
                }
                iproby.Data_Model.review review = new iproby.Data_Model.review();
                review.reviewer_id = customer_id;
                review.announ_id = model.announ_id;
                review.customer_id = model.customer_id;
                var to_contact_id_arr = (from a in db.customers
                                       where a.customer_id == model.customer_id
                                          select a.contact_id);
                int to_contact_id = 0;
                foreach (int item in to_contact_id_arr)
                {
                    to_contact_id = item;
                }
                var contact_arr = (from a in db.contacts
                                       where a.contact_id == to_contact_id
                                   select a);
                string email = string.Empty;
                foreach (var item in contact_arr)
                {
                    email = item.email;
                }
                review.header = model.header;
                review.description = model.description;
                DateTime Now = DateTime.Now;
                review.date_from = Now;
                db.reviews.Add(review);
                db.SaveChanges();
                InformationController notification = new InformationController();
                notification.SendMail(email,
                @"К вашему объявлению добавили комментарий на сайте IPRO.
                Пожалуйста, проверьте в личном кабинете и по возможости напишите ответ (ответить автору сообщения возможно в Личном кабинете).

                Письмо сгенерировано автоматически. По всем вопросам пишите на [email protected]");
                isSaved = true;
                return RedirectToAction("Index", new { announ_id = model.announ_id });
            }
            else {
                notLogin = true;
                return RedirectToAction("Index", new { announ_id = model.announ_id });
            }
        }
Exemplo n.º 4
0
        public ActionResult Registration(iproby.Models.registrator model)
        {
            if (model.first_name != null) {
                iproby.Data_Model.contact contact = new iproby.Data_Model.contact();
                contact.first_name = model.first_name;
                contact.email = Session["login"].ToString();
                contact.mobile = model.mobile;
                contact.skype = model.skype;
                contact.address = model.address;
                contact.facebook = model.facebook;
                contact.site = model.site;
                contact.vkontakte = model.vkontakte;
                contact.icq = model.icq;
                db.contacts.Add(contact);
                db.SaveChanges();

                var login=Session["login"].ToString();
                var customer_id = (from a in db.customers
                                   where a.login == login
                                   select a.customer_id);

                var customer_ex = db.customers.Find(customer_id.First());
                customer_ex.contact_id = contact.contact_id;
                db.SaveChanges();
                return RedirectToAction("Service","Catalog");
            }
            else {

            iproby.Data_Model.customer customer = new iproby.Data_Model.customer();
            //customer.contact_id = contact.contact_id;
            customer.login = model.email;
            customer.password = model.password;
            customer.status_id = 0;
            DateTime Now = DateTime.Now;
            customer.date_from = Now;
            string dateToString = "09/09/9999";
            DateTime dateTo = DateTime.Parse(dateToString, System.Globalization.CultureInfo.InvariantCulture);
            customer.date_to = dateTo;
            customer.active = 1;
            db.customers.Add(customer);
            db.SaveChanges();
            Session["fio"] = model.email;
            Session["login"] = model.email;
            InformationController notification = new InformationController();
            ConfirmationController confirmation = new ConfirmationController();
            string code = Session["login"].ToString();
            string hash_login = confirmation.GetCode(code);
            string email_text = @"
            Благодарим за регистрацию на сайте IPRO!

            Ваш логин: " + code + @"
            Пароль: " + model.password + @"

            Пожалуйста подтвердите Ваш email перейдя по ссылке http://iproby.ru/Confirmation?user_code=" + hash_login + "&login="******"
            или скопируйте текст: 'http://iproby.ru/Confirmation?user_code=" + hash_login + "&login="******"'
            в адресную строку браузера и нажмите enter.

            Спасибо!

            Письмо сгенерировано автоматически, если у вас есть вопросы пишите на почту [email protected]";
            notification.SendMail(model.email, email_text);
            return View("~/Views/Registration/RegistrationStep2.cshtml");
            }
        }
Exemplo n.º 5
0
 public ActionResult SendMessage(iproby.Models.message model)
 {
     if (Session["login"] != null)
     {
         iproby.Data_Model.message message = new iproby.Data_Model.message();
         DateTime Now = DateTime.Now;
         message.date_from = Now;
         string login = Session["login"].ToString();
         var customer_id_arr = (from a in db.customers
                                where a.login == login
                                select a);
         int customer_id = 0; int contact_id = 0;
         foreach (var item in customer_id_arr)
         {
             customer_id = item.customer_id;
             contact_id = item.contact_id;
         }
         var contact_arr = (from a in db.contacts
                            where a.contact_id == contact_id
                            select a);
         string email = string.Empty;
         foreach (var item in contact_arr)
         {
             email = item.email;
         }
         message.from_customer_id = customer_id;
         message.to_customer_id = model.to_customer;
         message.header = model.header;
         message.text_mess = model.text;
         db.messages.Add(message);
         db.SaveChanges();
         InformationController notification = new InformationController();
         notification.SendMail(email, "Вам пришло сообщение на сайте IPRO. Пожалуйста проверьте в личном кабинете.");
         if (model.form_flag != null && model.form_flag == 1) {
             return RedirectToAction("Answer", "Message", new { message_id = model.message_id});
         }
         else
         {
             return View("~/Views/Status/SendMessageSuccess.cshtml");
         }
     }
     else
     {
         return View("~/Views/Status/NoAuthorization.cshtml");
     }
 }
Exemplo n.º 6
0
        public ActionResult FailPayment(iproby.Data_Model.payment model)
        {
            var invid_arr = (from a in db.payments
                             where a.invid == model.invid
                             select a);
            int customer_id = 0;

            foreach (var item in invid_arr)
            {
                customer_id = item.customer_id;
            }
            var announ_arr = (from a in db.customer_announ
                              where a.customer_id == customer_id
                              select a);
            int announ_id = 0;

            foreach (var item in announ_arr)
            {
                announ_id = item.announ_id.Value;
            }
            var contact_arr = (from a in db.customers
                               where a.customer_id == customer_id
                               join db_target1 in db.contacts on a.contact_id equals db_target1.contact_id
                               select db_target1);
            string email = string.Empty;

            foreach (var item in contact_arr)
            {
                email = item.email;
            }
            iproby.Data_Model.payment payment = new iproby.Data_Model.payment();
            payment.announ_id   = announ_id;
            payment.customer_id = customer_id;
            payment.invid       = model.invid;
            payment.mrchlogin   = model.mrchlogin;
            payment.outsum      = model.outsum;
            payment.description = model.description;
            DateTime date_from = DateTime.Now;

            payment.date_from      = date_from;
            payment.signaturevalue = model.signaturevalue;
            payment.Code           = model.Code;
            payment.IncAccount     = model.IncAccount;
            payment.IncCurrLabel   = model.IncCurrLabel;
            payment.IncSum         = model.IncSum;
            payment.Info           = model.Info;
            payment.OutCurrLabel   = model.OutCurrLabel;
            payment.PaymentMethod  = model.PaymentMethod;
            payment.state          = model.state;
            payment.status         = "fail";
            db.payments.Add(payment);
            db.SaveChanges();
            string text_email          = @"К сожалению что-то пошло не так!

                Данные платежа:
                id Объявления: " + announ_id + @"
                id Пользователя: " + customer_id + @"
                id Транзакции: " + model.invid + @"
                Сумма платежа: " + model.outsum + @"
                Время платежа: " + date_from.ToString() + @"
                Статус: fail


                Это сообщение сгенерировано автоматически. По всем вопросам пишите на [email protected]";
            InformationController info = new InformationController();

            info.SendMail(email, text_email);
            return(RedirectToAction("EditOptions", "Cabinet"));
        }
Exemplo n.º 7
0
        public ActionResult ResultPayment(iproby.Data_Model.payment model)
        {
            var invid_arr = (from a in db.payments
                             where a.invid == model.invid
                             select a);
            int customer_id = 0;

            foreach (var item in invid_arr)
            {
                customer_id = item.customer_id;
            }
            var announ_arr = (from a in db.customer_announ
                              where a.customer_id == customer_id
                              select a);
            int announ_id = 0;

            foreach (var item in announ_arr)
            {
                announ_id = item.announ_id.Value;
            }
            var contact_arr = (from a in db.customers
                               where a.customer_id == customer_id
                               join db_target1 in db.contacts on a.contact_id equals db_target1.contact_id
                               select db_target1);
            string email = string.Empty;

            foreach (var item in contact_arr)
            {
                email = item.email;
            }
            iproby.Models.payment paym = new iproby.Models.payment();
            // HTTP parameters
            string sOutSum  = GetPrm("OutSum");
            string sInvId   = GetPrm("InvId");
            string sCrc     = GetPrm("SignatureValue");
            string sCrcBase = string.Format("{0}:{1}:{2}",
                                            sOutSum, sInvId, paym.password2);
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();

            byte[]        bSignature  = md5.ComputeHash(Encoding.ASCII.GetBytes(sCrcBase));
            StringBuilder sbSignature = new StringBuilder();

            foreach (byte b in bSignature)
            {
                sbSignature.AppendFormat("{0:x2}", b);
            }
            string sMyCrc = sbSignature.ToString();
            string status = "success";

            if (sCrc.ToUpper() != sMyCrc.ToUpper())
            {
                status = "signatureincorrect-" + sCrc.ToUpper() + "-" + sMyCrc.ToUpper() + "-" + sOutSum + "-" + sInvId + "-";
            }
            model.announ_id      = announ_id;
            model.customer_id    = customer_id;
            model.status         = status;
            model.outsum         = sOutSum.ToString();
            model.signaturevalue = sCrc;
            model.mrchlogin      = paym.mrchlogin;
            DateTime date_from = DateTime.Now;

            model.date_from = date_from;
            if (string.IsNullOrEmpty(model.state))
            {
                model.state = GetPrm("State");
            }
            if (string.IsNullOrEmpty(model.Code))
            {
                model.Code = GetPrm("Code");
            }
            if (string.IsNullOrEmpty(model.Info))
            {
                model.Info = GetPrm("Info");
            }
            if (string.IsNullOrEmpty(model.IncCurrLabel))
            {
                model.IncCurrLabel = GetPrm("IncCurrLabel");
            }
            if (string.IsNullOrEmpty(model.PaymentMethod))
            {
                model.PaymentMethod = GetPrm("PaymentMethod");
            }
            if (string.IsNullOrEmpty(model.description))
            {
                model.description = GetPrm("Description");
            }
            if (string.IsNullOrEmpty(model.description))
            {
                model.description = paym.desc;
            }
            if (string.IsNullOrEmpty(model.OutCurrLabel))
            {
                model.OutCurrLabel = GetPrm("OutCurrLabel");
            }

            db.payments.Add(model);
            db.SaveChanges();
            iproby.Models.payment paymentModel = new iproby.Models.payment();
            paymentModel.status_text = "OK" + model.invid + "\n";
            InformationController info = new InformationController();
            string text_email          = @"Благодарим за платеж!

                Данные платежа:
                id Объявления: " + announ_id + @"
                id Пользователя: " + customer_id + @"
                id Транзакции: " + model.invid + @"
                Сумма платежа: " + sOutSum + @"
                Время платежа: " + date_from.ToString() + @"
                Статус: " + status + @"


                Это сообщение сгенерировано автоматически. По всем вопросам пишите на [email protected]";

            info.SendMail(email, text_email);
            return(View("~/Views/Cabinet/OKPayment.cshtml", paymentModel));
        }
Exemplo n.º 8
0
        public ActionResult Registration(iproby.Models.registrator model)
        {
            if (model.first_name != null)
            {
                iproby.Data_Model.contact contact = new iproby.Data_Model.contact();
                contact.first_name = model.first_name;
                contact.email      = Session["login"].ToString();
                contact.mobile     = model.mobile;
                contact.skype      = model.skype;
                contact.address    = model.address;
                contact.facebook   = model.facebook;
                contact.site       = model.site;
                contact.vkontakte  = model.vkontakte;
                contact.icq        = model.icq;
                db.contacts.Add(contact);
                db.SaveChanges();

                var login       = Session["login"].ToString();
                var customer_id = (from a in db.customers
                                   where a.login == login
                                   select a.customer_id);

                var customer_ex = db.customers.Find(customer_id.First());
                customer_ex.contact_id = contact.contact_id;
                db.SaveChanges();
                return(RedirectToAction("Service", "Catalog"));
            }
            else
            {
                iproby.Data_Model.customer customer = new iproby.Data_Model.customer();
                //customer.contact_id = contact.contact_id;
                customer.login     = model.email;
                customer.password  = model.password;
                customer.status_id = 0;
                DateTime Now = DateTime.Now;
                customer.date_from = Now;
                string   dateToString = "09/09/9999";
                DateTime dateTo       = DateTime.Parse(dateToString, System.Globalization.CultureInfo.InvariantCulture);
                customer.date_to = dateTo;
                customer.active  = 1;
                db.customers.Add(customer);
                db.SaveChanges();
                Session["fio"]   = model.email;
                Session["login"] = model.email;
                InformationController  notification = new InformationController();
                ConfirmationController confirmation = new ConfirmationController();
                string code       = Session["login"].ToString();
                string hash_login = confirmation.GetCode(code);
                string email_text = @"
            Благодарим за регистрацию на сайте IPRO!

            Ваш логин: " + code + @"
            Пароль: " + model.password + @"
            
            Пожалуйста подтвердите Ваш email перейдя по ссылке http://iproby.ru/Confirmation?user_code=" + hash_login + "&login="******"
            или скопируйте текст: 'http://iproby.ru/Confirmation?user_code=" + hash_login + "&login="******"'
            в адресную строку браузера и нажмите enter.

            Спасибо!


            Письмо сгенерировано автоматически, если у вас есть вопросы пишите на почту [email protected]";
                notification.SendMail(model.email, email_text);
                return(View("~/Views/Registration/RegistrationStep2.cshtml"));
            }
        }
Exemplo n.º 9
0
        public ActionResult ResultPayment(iproby.Data_Model.payment model)
        {
            var invid_arr = (from a in db.payments
                                      where a.invid == model.invid
                                      select a);
                int customer_id = 0;
                foreach (var item in invid_arr)
                {
                    customer_id = item.customer_id;
                }
                var announ_arr = (from a in db.customer_announ
                                  where a.customer_id == customer_id
                                  select a);
                int announ_id = 0;
                foreach (var item in announ_arr)
                {
                    announ_id = item.announ_id.Value;
                }
                var contact_arr = (from a in db.customers
                                  where a.customer_id == customer_id
                                   join db_target1 in db.contacts on a.contact_id equals db_target1.contact_id
                                   select db_target1);
                string email = string.Empty;
                foreach (var item in contact_arr)
                {
                    email = item.email;
                }
                iproby.Models.payment paym = new iproby.Models.payment();
                // HTTP parameters
                string sOutSum = GetPrm("OutSum");
                string sInvId = GetPrm("InvId");
                string sCrc = GetPrm("SignatureValue");
                string sCrcBase = string.Format("{0}:{1}:{2}",
                                                 sOutSum, sInvId, paym.password2);
                MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
                byte[] bSignature = md5.ComputeHash(Encoding.ASCII.GetBytes(sCrcBase));
                StringBuilder sbSignature = new StringBuilder();
                foreach (byte b in bSignature)
                    sbSignature.AppendFormat("{0:x2}", b);
                string sMyCrc = sbSignature.ToString();
                string status = "success";
                if (sCrc.ToUpper() != sMyCrc.ToUpper())
                {
                    status = "signatureincorrect-" + sCrc.ToUpper() + "-" + sMyCrc.ToUpper() + "-" + sOutSum + "-" + sInvId + "-";
                }
                model.announ_id = announ_id;
                model.customer_id = customer_id;
                model.status = status;
                model.outsum = sOutSum.ToString();
                model.signaturevalue = sCrc;
                model.mrchlogin = paym.mrchlogin;
                DateTime date_from = DateTime.Now;
                model.date_from = date_from;
                if (string.IsNullOrEmpty(model.state))
                    model.state = GetPrm("State");
                if (string.IsNullOrEmpty(model.Code))
                    model.Code = GetPrm("Code");
                if (string.IsNullOrEmpty(model.Info))
                    model.Info = GetPrm("Info");
                if (string.IsNullOrEmpty(model.IncCurrLabel))
                    model.IncCurrLabel = GetPrm("IncCurrLabel");
                if (string.IsNullOrEmpty(model.PaymentMethod))
                    model.PaymentMethod = GetPrm("PaymentMethod");
                if (string.IsNullOrEmpty(model.description))
                    model.description = GetPrm("Description");
                if (string.IsNullOrEmpty(model.description))
                    model.description = paym.desc;
                if (string.IsNullOrEmpty(model.OutCurrLabel))
                    model.OutCurrLabel = GetPrm("OutCurrLabel");

                db.payments.Add(model);
                db.SaveChanges();
                iproby.Models.payment paymentModel = new iproby.Models.payment();
                paymentModel.status_text = "OK" + model.invid + "\n";
                InformationController info = new InformationController();
                string text_email=@"Благодарим за платеж!

                Данные платежа:
                id Объявления: "+announ_id+@"
                id Пользователя: "+customer_id+@"
                id Транзакции: "+model.invid+@"
                Сумма платежа: " + sOutSum + @"
                Время платежа: " +date_from.ToString()+@"
                Статус: "+status+@"

                Это сообщение сгенерировано автоматически. По всем вопросам пишите на [email protected]";
                info.SendMail(email, text_email);
                return View("~/Views/Cabinet/OKPayment.cshtml", paymentModel);
        }
Exemplo n.º 10
0
        public ActionResult FailPayment(iproby.Data_Model.payment model)
        {
            var invid_arr = (from a in db.payments
                                 where a.invid == model.invid
                                 select a);
                int customer_id = 0;
                foreach (var item in invid_arr)
                {
                    customer_id = item.customer_id;
                }
                var announ_arr = (from a in db.customer_announ
                                  where a.customer_id == customer_id
                                  select a);
                int announ_id = 0;
                foreach (var item in announ_arr)
                {
                    announ_id = item.announ_id.Value;
                }
                var contact_arr = (from a in db.customers
                                   where a.customer_id == customer_id
                                   join db_target1 in db.contacts on a.contact_id equals db_target1.contact_id
                                   select db_target1);
                string email = string.Empty;
                foreach (var item in contact_arr)
                {
                    email = item.email;
                }
                iproby.Data_Model.payment payment = new iproby.Data_Model.payment();
                payment.announ_id = announ_id;
                payment.customer_id = customer_id;
                payment.invid = model.invid;
                payment.mrchlogin = model.mrchlogin;
                payment.outsum = model.outsum;
                payment.description = model.description;
                DateTime date_from = DateTime.Now;
                payment.date_from = date_from;
                payment.signaturevalue = model.signaturevalue;
                payment.Code = model.Code;
                payment.IncAccount = model.IncAccount;
                payment.IncCurrLabel = model.IncCurrLabel;
                payment.IncSum = model.IncSum;
                payment.Info = model.Info;
                payment.OutCurrLabel = model.OutCurrLabel;
                payment.PaymentMethod = model.PaymentMethod;
                payment.state = model.state;
                payment.status = "fail";
                db.payments.Add(payment);
                db.SaveChanges();
                string text_email = @"К сожалению что-то пошло не так!

                Данные платежа:
                id Объявления: " + announ_id + @"
                id Пользователя: " + customer_id + @"
                id Транзакции: " + model.invid + @"
                Сумма платежа: " + model.outsum + @"
                Время платежа: " + date_from.ToString() + @"
                Статус: fail

                Это сообщение сгенерировано автоматически. По всем вопросам пишите на [email protected]";
                InformationController info = new InformationController();
                info.SendMail(email, text_email);
                return RedirectToAction("EditOptions", "Cabinet");
        }