public ActionResult forgetPasswordSubmit(User user)
        {
            if (string.IsNullOrWhiteSpace(user.Email))
            {
                return View("forgetPasswordPage");
            }
            else
            {
                var userEmail = db.user.Where(w => w.DeletedDate == null && w.Email == user.Email).FirstOrDefault();
                if (userEmail == null)
                {
                    TempData["emaildoesnexist"] = "Email tapılmadı!!";
                    return View("logIn");
                }
                if (userEmail.isBlock == true)
                {
                    TempData["blockUser"] = "******";
                    return View("logIn");
                }
                else
                {
                    MailExtention.SendMail("Şifrə Yeniləmə", $"Sizin Shifrəniz {userEmail.Password}!!", userEmail.Email);
                    TempData["sendEmailForResetPassword"] = "******";
                    return View("logIn");
                }
            }

        }
        public ActionResult sendAnswerToUser(ContactUS contact)
        {
            var currentMessage = db.ContactUs.Where(w => w.DeletedDate == null && w.Id == contact.Id).FirstOrDefault();

            currentMessage.AnsweredMessage = contact.AnsweredMessage;
            currentMessage.isAnswered      = true;
            currentMessage.answeredDate    = DateTime.Now;
            db.Entry(currentMessage).State = EntityState.Modified;
            db.SaveChanges();
            MailExtention.SendMail(contact.Subject, contact.AnsweredMessage, contact.Email);
            var allMessages = db.ContactUs.OrderByDescending(w => w.Id).Where(w => w.DeletedDate == null).ToList();

            return(PartialView("~/Areas/Admin/Views/ContactUS/listofmessage.cshtml", allMessages));
        }
 //SubscribeButton
 public ActionResult subscribeButton(string email)
 {
     bool checkEmail = db.Subscribes.Any(w => w.DeletedDate == null && w.Email == email);
     if (!checkEmail)
     {
         var newSubscribe = new Subscribe();
         newSubscribe.Email = email;
         newSubscribe.CreatedDate = DateTime.Now;
         db.Subscribes.Add(newSubscribe);
         db.SaveChanges();
         MailExtention.SendMail("Subscribe Confirmation", "https://localhost:44354/home/confirmSubscribe/" + newSubscribe.Id, email);
         return View("Index");
     }
     else
     {
         TempData["existsEmailInSubscribe"] = "Bu email mövcuddur!";
         return View("Index");
     }
 }
Exemplo n.º 4
0
        public ActionResult confirmItemFromWaitList(int id)
        {
            var activeSession = Session[SessionKey.Admin];
            var admin         = db.Manager.Where(w => w.DeletedDate == null && w.Email == activeSession.ToString()).FirstOrDefault();
            var item          = db.products.Where(w => w.DeletedDate == null && w.Id == id).FirstOrDefault();

            item.isConfirm       = true;
            item.sharedDate      = DateTime.Now;
            item.ConfirmId       = admin.Id;
            db.Entry(item).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            var subscribeUsers = db.Subscribes.Where(w => w.DeletedDate == null && w.isConfirm == true).ToList();

            foreach (var user in subscribeUsers)
            {
                MailExtention.SendMail("Yeni Məhsul", item.Name + " " + item.Price, user.Email);
            }

            return(PartialView("~/Areas/AdGetOn/Views/Admin/newAddProductForEach.cshtml", db.products.OrderByDescending(o => o.Id).Where(w => w.DeletedDate == null && (w.isWaitListForAdmin == true && w.isConfirm == false)).ToList()));
        }
        public ActionResult ContactUs(string subject, string email, string message, HttpPostedFileBase file)
        {
            if (String.IsNullOrWhiteSpace(subject) || String.IsNullOrWhiteSpace(email) || String.IsNullOrWhiteSpace(message))
            {
                TempData["fillInput"] = "Zəhmət Olmasa Xanaları Doldurun !!!";
                return View();
            }
            string SaveLocation = "";
            string fileName = "";
            if (file != null)
            {

                fileName = System.IO.Path.GetFileName(file.FileName);
                SaveLocation = Server.MapPath("~/ContactFiles/") + "\\" + fileName;
                try
                {
                    file.SaveAs(SaveLocation);
                }
                catch (Exception ex)
                {
                    Response.Write("Error: " + ex.Message);
                }

            }

            var newMessage = new ContactUS()
            {
                Subject = subject,
                Email = email,
                Message = message,
                filePath = fileName,
                CreatedDate = DateTime.Now,
                answeredDate = DateTime.Now,
                //CreatedId = Todo
            };
            db.ContactUs.Add(newMessage);

            MailExtention.SendMail(newMessage.Subject, newMessage.Message, "*****@*****.**");
            db.SaveChanges();
            return View("Index");
        }
Exemplo n.º 6
0
 public ActionResult submitForgetPasswordButton(string Email)
 {
     if (Email == "")
     {
         TempData["empty"] = "Zəhmət olmasa xananı doldurun!!";
         return(View("forgetPasswordPage"));
     }
     else
     {
         var findEmail = db.Manager.Where(w => w.DeletedDate == null && w.Email == Email).FirstOrDefault();
         if (findEmail != null)
         {
             TempData["sentEmail"] = "Şifrə email - ə göndərildi";
             MailExtention.SendMail("Şifrə", "Sizin şifrə " + findEmail.Password, findEmail.Email);
             return(View("LoginPartForAdmin"));
         }
         else
         {
             TempData["emaildoesntexists"] = "Email tapılmadı";
             return(View("forgetPasswordPage"));
         }
     }
 }
Exemplo n.º 7
0
        public ActionResult SubmitCreateNewItem(string name, string about, int producerVal, int colorVal,
                                                List <int> categoryVal, int?multiCategoryVal, decimal size, decimal price, decimal discountPrice, List <HttpPostedFileBase> imgFiles)
        {
            if (categoryVal == null && multiCategoryVal == null)
            {
                TempData["emptyCategory"] = "Məhsulun Kategoriyasını daxil edin!!";
                return(View("CreateNewItem"));
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                TempData["emptyNameInput"] = "Məhsulun adını daxil edin";
                return(View("CreateNewItem"));
            }
            if (imgFiles[0] != null && (categoryVal != null || multiCategoryVal != 0))
            {
                bool    findUser       = false;
                Manager findSuperAdmin = new Manager();
                Manager findAdmin      = new Manager();
                var     newProduct     = new Product();
                newProduct.Name          = name;
                newProduct.About         = about;
                newProduct.ProducerId    = producerVal;
                newProduct.colorId       = colorVal;
                newProduct.SizeORCount   = size;
                newProduct.Price         = price;
                newProduct.DiscountPrice = discountPrice;
                if (multiCategoryVal != null)
                {
                    var findMultiCategory = db.SubCategories.Where(w => w.DeletedDate == null && w.Id == multiCategoryVal).FirstOrDefault();
                    newProduct.SubCategory = findMultiCategory.SubCategoryName;
                }
                newProduct.isWaitListForAdmin = true;
                var checkAdmin = db.Manager.Where(w => w.DeletedDate == null && w.ManagerStatus.DeletedDate == null && w.ManagerStatus.StatusName == "SuperAdmin").ToList();
                foreach (var item in checkAdmin)
                {
                    if (Session[SessionKey.Admin].ToString() == item.Email)
                    {
                        findSuperAdmin = item;
                        findUser       = true;
                    }
                }
                if (findUser == true)
                {
                    newProduct.CreatedId  = findSuperAdmin.Id;
                    newProduct.SharedId   = findSuperAdmin.Id;
                    newProduct.isConfirm  = true;
                    newProduct.sharedDate = DateTime.Now;
                    var subscribeUsers = db.Subscribes.Where(w => w.DeletedDate == null && w.isConfirm == true).ToList();
                    foreach (var user in subscribeUsers)
                    {
                        MailExtention.SendMail("Yeni Məhsul", newProduct.Name + " " + newProduct.Price + "AZN", user.Email);
                    }
                }
                else
                {
                    var checkSession    = Session[SessionKey.Admin];
                    var findActiveAdmin = db.Manager.Where(w => w.DeletedDate == null && w.Email.ToString() == checkSession.ToString()).FirstOrDefault();
                    newProduct.isConfirm = false;
                    newProduct.SharedId  = findActiveAdmin.Id;
                }
                newProduct.CreatedDate = DateTime.Now;
                newProduct.imgPath     = imgFiles.FirstOrDefault().FileName;
                db.products.Add(newProduct);
                foreach (var categoryItem in categoryVal)
                {
                    var newCategoryAndProduct = new CategoryAndProduct();
                    newCategoryAndProduct.CategoryId = categoryItem;
                    newCategoryAndProduct.ProductId  = newProduct.Id;
                    db.CategoryAndProduct.Add(newCategoryAndProduct);
                }

                string SaveLocation = "";

                foreach (var file in imgFiles)
                {
                    string fileName = Path.GetFileName(file.FileName);
                    SaveLocation = Server.MapPath("~/Template/img/newImg/") + "\\" + fileName;
                    try
                    {
                        var newImgPath = new imageProduct();
                        newImgPath.ProductId   = newProduct.Id;
                        newImgPath.imgPath     = fileName;
                        newImgPath.CreatedDate = DateTime.Now;
                        db.imageProducts.Add(newImgPath);
                        db.SaveChanges();
                        file.SaveAs(SaveLocation);
                    }
                    catch (Exception ex)
                    {
                        Response.Write("Error: " + ex.Message);
                    }
                }
                db.SaveChanges();
                var newProductOrWaitList = db.products.OrderByDescending(o => o.Id).Where(p => p.DeletedDate == null && (p.isWaitListForAdmin == true && p.isConfirm == false));
                return(PartialView("~/Areas/AdGetOn/Views/Admin/newAddProduct.cshtml", newProductOrWaitList));
            }
            else
            {
                TempData["imgIsEmpty"] = "Şəkil Seçin !!";
                return(View("CreateNewItem"));
            }
        }