//[HttpPost]
        public ActionResult CheckEmail(int?a = 0)
        {
            try
            {
                var body   = string.Format("test");
                var _email = "*****@*****.**";
                System.Net.Mail.MailMessage mail = new MailMessage();
                SmtpClient SmtpServer            = new SmtpClient("mail.seelahore.com");
                mail.From = new MailAddress(_email);
                mail.To.Add(_email);
                mail.Subject           = "testing email see";
                mail.Body              = body;
                mail.IsBodyHtml        = true;
                SmtpServer.Port        = 25;
                SmtpServer.Credentials = new System.Net.NetworkCredential(_email, "Seelahore@123");
                SmtpServer.EnableSsl   = false;

                SmtpServer.Send(mail);
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
        // GET: StallRequests/Create
        public ActionResult Create()
        {
            try
            {
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                var    dateRange      = db.RegistrationDeadLines.FirstOrDefault(s => s.RegistrationType == controllerName);
                var    comparisonto   = (DateTime.Compare(Convert.ToDateTime(DateTime.Now), Convert.ToDateTime(dateRange.To)));
                var    comparisonfrom = (DateTime.Compare(Convert.ToDateTime(DateTime.Now), Convert.ToDateTime(dateRange.From)));

                if (comparisonto != -1)
                {
                    return(RedirectToAction("RegistrationDeadline", "Home", new { status = "Registrations Ended" }));
                }
                else if (comparisonfrom != 1)
                {
                    return(RedirectToAction("RegistrationDeadline", "Home", new { status = "Registrations will be open soon!" }));
                }
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
            }

            ViewBag.CreatedBy       = new SelectList(db.AspNetUsers, "Id", "Email");
            ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status");
            ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
            ViewBag.CategoryId      = new SelectList(db.StallCategories, "Id", "StallType");
            return(View());
        }
        public JsonResult SendEmail(string EmailSubject, string EmailBody, string EmailTo, string EmailName)
        {
            try
            {
                System.Net.Mail.MailMessage mail = new MailMessage();
                SmtpClient SmtpServer            = new SmtpClient(SenderEmailHost);
                mail.From = new MailAddress(SenderEmailId, "SEE Lahore 2k18");
                mail.To.Add(EmailTo);
                mail.Subject           = EmailSubject;
                mail.Body              = EmailBody;
                mail.IsBodyHtml        = true;
                SmtpServer.Port        = SenderEmailPort;
                SmtpServer.Credentials = new System.Net.NetworkCredential(SenderEmailId, SenderEmailPassword);
                SmtpServer.EnableSsl   = false;

                SmtpServer.Send(mail);



                return(Json("Email sent successfuly!", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
                return(Json("Something went wrong! Please try again", JsonRequestBehavior.AllowGet));
            }
        }
示例#4
0
        public ActionResult Create([Bind(Include = "Id,Name,ContactNo,Designation,EmailId,CNIC,InstituteId,RequestStatusId,CreatedAt,Address,City,CompetitionId")] CompetitionRegistration competitionRegistration)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    try
                    {
                        if (competitionRegistration.CompetitionId == 2)
                        {
                            var teamLead                = Request.Form["DramaTeamLeader"];
                            var totalMembers            = Request.Form["DramaTotalTeamMembers"];
                            var dramaDescription        = Request.Form["DramaDescription"];
                            var toSaveWithAddressString = " || " + teamLead + " || " + totalMembers + " || " + dramaDescription;
                            competitionRegistration.Address = competitionRegistration.Address + " !Drama! " + toSaveWithAddressString;
                        }

                        competitionRegistration.RequestStatusId = 1;
                        competitionRegistration.CreatedAt       = DateTime.Now;
                        db.CompetitionRegistrations.Add(competitionRegistration);
                        db.SaveChanges();
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "You are successfully registerd for Competition with your crdentials,Team SEE Lahore will soon respond you through Email.Stay Connected for Bigest Event of Lahore, See Lahore 2018", url = controllerName + "/" + actionName }));
                    }
                    catch (DbEntityValidationException ex)
                    {
                        string message = "";
                        foreach (var validationErrors in ex.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                message = message + validationError.PropertyName + "  " + validationError.ErrorMessage + "\n\n";
                            }
                        }

                        HomeController.EntityinfoMessage(competitionRegistration.Name + ": " + message);
                        HomeController.EntitywriteErrorLog(ex);
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
                    }
                }


                ViewBag.CompetitionId   = new SelectList(db.Competitions, "Id", "CompetitionName", competitionRegistration.CompetitionId);
                ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
                ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", competitionRegistration.RequestStatusId);
                return(View(competitionRegistration));
            }
            catch (Exception ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
                return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
            }
        }
        public ActionResult Create([Bind(Include = "Id,Name,ContactNo,FacebookId,EmailId,CNIC,InstituteId,StatusId,CreatedAt,Address,CityOfResidence,Degree,PreviousExperiance,VolunteerCategoryId,Hostelite,Why,ExpectationsFromSEE")] Volunteer volunteer)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var obj = db.Volunteers.FirstOrDefault(s => s.EmailId == volunteer.EmailId || s.ContactNo == volunteer.ContactNo);
                    if (obj != null)
                    {
                        ViewBag.ErrorMessage        = "Email Or Phone No. Already Exists!";
                        ViewBag.StatusId            = new SelectList(db.RequestStatus, "Id", "Status", volunteer.StatusId);
                        ViewBag.InstituteId         = new SelectList(db.Institutes, "Id", "Institute1");
                        ViewBag.VolunteerCategoryId = new SelectList(db.VolunteerCategories, "Id", "Category", volunteer.VolunteerCategoryId);
                        return(View(volunteer));
                    }
                    try
                    {
                        volunteer.ExpectationsFromSEE = Request.Form["ExpectationsFromSEE"];
                        volunteer.CreatedAt           = DateTime.Now;
                        volunteer.StatusId            = 1;
                        db.Volunteers.Add(volunteer);
                        db.SaveChanges();
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "You are successfully registerd for volunteer with your crdentials,Team SEE Lahore will soon respond you through Email.Stay Connected for Bigest Event of Lahore,See Lahore 2018", url = controllerName + "/" + actionName }));
                    }
                    catch (DbEntityValidationException ex)
                    {
                        string message = "";
                        foreach (var validationErrors in ex.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                message = message + validationError.PropertyName + "  " + validationError.ErrorMessage + "\n\n";
                            }
                        }

                        HomeController.EntityinfoMessage(volunteer.Name + ": " + message);
                        HomeController.EntitywriteErrorLog(ex);
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
                    }
                }
                ViewBag.StatusId            = new SelectList(db.RequestStatus, "Id", "Status", volunteer.StatusId);
                ViewBag.InstituteId         = new SelectList(db.Institutes, "Id", "Institute1");
                ViewBag.VolunteerCategoryId = new SelectList(db.VolunteerCategories, "Id", "Category", volunteer.VolunteerCategoryId);
                return(View(volunteer));
            }
            catch (Exception ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
                return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
            }
        }
示例#6
0
 public JsonResult SendSMS(string SMSReceiverNumber, string Subject, string Message)
 {
     try
     {
         SMSReceiverNumber = System.Text.RegularExpressions.Regex.Replace(SMSReceiverNumber, "[^\\w\\._]", "");
         if (SMSReceiverNumber.StartsWith("0"))
         {
             SMSReceiverNumber = "92" + SMSReceiverNumber.Substring(1, SMSReceiverNumber.Length - 1);
         }
         else if (SMSReceiverNumber.StartsWith("+"))
         {
             SMSReceiverNumber = SMSReceiverNumber.Substring(1, SMSReceiverNumber.Length - 1);
         }
         string url     = SMSApiUrl;
         String result  = "";
         String message = HttpUtility.UrlEncode(Subject + ":\n" + Message);
         String strPost = "id=" + SMSSenderNumber + "&pass="******"&msg=" + message +
                          "&to=" + SMSReceiverNumber + "&mask=" + SMSMask + "&type=" + SMSType + "&lang=" + SMSLanguage;
         StreamWriter   myWriter   = null;
         HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
         objRequest.Method        = "POST";
         objRequest.ContentLength = Encoding.UTF8.GetByteCount(strPost);
         objRequest.ContentType   = "application/x-www-form-urlencoded";
         try
         {
             myWriter = new StreamWriter(objRequest.GetRequestStream());
             myWriter.Write(strPost);
         }
         catch (Exception e)
         {
             return(Json(e.Message, JsonRequestBehavior.AllowGet));
         }
         finally
         {
             myWriter.Close();
         }
         HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
         using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
         {
             result = sr.ReadToEnd();
             // Close and clean up the StreamReader
             sr.Close();
             dynamic json = System.Web.Helpers.Json.Decode(result);
             var     a    = json.corpsms;
             var     b    = a[0];
             var     c    = b.response;
             var     d    = Convert.ToString(c);
             return(Json(SMSReceiverNumber + ": " + d, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         HomeController.infoMessage(ex.Message);
         HomeController.writeErrorLog(ex);
         return(Json(ex.Message, JsonRequestBehavior.AllowGet));
     }
 }
        public JsonResult SendBulkEmail(string EmailSubject, string EmailBody, string EmailTo)
        {
            try
            {
                var           emails       = EmailTo.Split(',');
                List <string> EmailResults = new List <string>();
                foreach (var item in emails)
                {
                    try
                    {
                        System.Net.Mail.MailMessage mail = new MailMessage();
                        SmtpClient SmtpServer            = new SmtpClient(SenderEmailHost);
                        mail.From = new MailAddress(SenderEmailId, "SEE Lahore 2k18");
                        mail.To.Add(item);
                        mail.Subject           = EmailSubject;
                        mail.Body              = EmailBody;
                        mail.IsBodyHtml        = true;
                        SmtpServer.Port        = SenderEmailPort;
                        SmtpServer.Credentials = new System.Net.NetworkCredential(SenderEmailId, SenderEmailPassword);
                        SmtpServer.EnableSsl   = false;

                        SmtpServer.Send(mail);

                        var emailResult = "\n\nEmail Sent Successfuly to:" + item;
                        EmailResults.Add(emailResult);
                    }
                    catch (Exception ex)
                    {
                        var emailResult = "\n\nSomething went wrong while sending email to:" + item;
                        EmailResults.Add(emailResult);
                    }
                }



                return(Json(EmailResults, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
                return(Json("Something went wrong! Please try again", JsonRequestBehavior.AllowGet));
            }
        }
示例#8
0
        public ActionResult UpdateStatus(int?id, int?Status)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                try
                {
                    Ambassador volunteer = db.Ambassadors.Find(id);
                    if (volunteer == null)
                    {
                        return(HttpNotFound());
                    }
                    volunteer.StatusId = Status;
                    db.SaveChanges();
                }
                catch (DbEntityValidationException ex)
                {
                    string message = "";
                    foreach (var validationErrors in ex.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            message = message + validationError.PropertyName + "  " + validationError.ErrorMessage + "\n\n";
                        }
                    }

                    HomeController.EntityinfoMessage("Ambassodor status: " + message);
                    HomeController.EntitywriteErrorLog(ex);
                }
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
            }

            return(RedirectToAction("Index"));
        }
示例#9
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var user = new ApplicationUser {
                        UserName = model.Email, Email = model.Email
                    };
                    var result = await UserManager.CreateAsync(user, model.Password);

                    var context     = new ApplicationDbContext();
                    var roleStore   = new RoleStore <IdentityRole>(context);
                    var roleManager = new RoleManager <IdentityRole>(roleStore);

                    var userStore   = new UserStore <ApplicationUser>(context);
                    var userManager = new UserManager <ApplicationUser>(userStore);
                    userManager.AddToRole(user.Id, "Admin");
                    if (result.Succeeded)
                    {
                        await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                        // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                        // Send an email with this link
                        // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                        // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                        // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                        return(RedirectToAction("AdminPanel", "Home"));
                    }
                    AddErrors(result);
                }
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
            }
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
示例#10
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }

                // This doesn't count login failures towards account lockout
                // To enable password failures to trigger account lockout, change to shouldLockout: true
                var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false);

                switch (result)
                {
                case SignInStatus.Success:
                    return(RedirectToAction("AdminPanel", "Home"));

                case SignInStatus.LockedOut:
                    return(View("Lockout"));

                case SignInStatus.RequiresVerification:
                    return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

                case SignInStatus.Failure:
                default:
                    ModelState.AddModelError("", "Invalid login attempt.");
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
示例#11
0
        public JsonResult SendBulkSMS(string SMSReceiverNumbers, string Subject, string Message)
        {
            List <string> Results = new List <string>();

            try
            {
                var SMSReceivers = SMSReceiverNumbers.Split(',');
                foreach (var item in SMSReceivers)
                {
                    if (item == "" || item == " " || item == null)
                    {
                        continue;
                    }
                    var result = SendSMS(item, Subject, Message);
                    Results.Add(result.Data.ToString() + "\n\n");
                }
            }
            catch (Exception ex)
            {
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
            }
            return(Json(Results, JsonRequestBehavior.AllowGet));
        }
示例#12
0
        public ActionResult Create([Bind(Include = "Id,Name,InstituteId,Degree,CGPA_Numbers,TotalNumbers,CNIC,ContactNo_,Email,CreatedAt,CurrentSemester_Year,RequestStatusId")] TalentGala talentGala)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var obj = db.TalentGalas.FirstOrDefault(s => s.Email == talentGala.Email || s.ContactNo_ == talentGala.ContactNo_);
                    if (obj != null)
                    {
                        ViewBag.ErrorMessage    = "Email or Phone Number Already Exists!";
                        ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
                        ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", talentGala.RequestStatusId);
                        //ModelState.AddModelError("Error: ", "Email Already Exists!");
                        return(View(talentGala));
                    }
                    if (Convert.ToDecimal(talentGala.TotalNumbers) == 4)
                    {
                        if (Convert.ToDecimal(talentGala.CGPA_Numbers) < 3)
                        {
                            ViewBag.ErrorMessage    = "Your CGPA should be 3.0 atleast.";
                            ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
                            ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", talentGala.RequestStatusId);
                            //ModelState.AddModelError("Error: ", "Your CGPA should be 3.0 atleast.");
                            return(View(talentGala));
                        }

                        if (Convert.ToDecimal(talentGala.CGPA_Numbers) > 4)
                        {
                            ViewBag.ErrorMessage    = "Your CGPA can not be more than max.";
                            ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
                            ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", talentGala.RequestStatusId);
                            //ModelState.AddModelError("Error: ", "Your CGPA should be 3.0 atleast.");
                            return(View(talentGala));
                        }
                    }
                    else if (Convert.ToDecimal(talentGala.CGPA_Numbers) > Convert.ToDecimal(talentGala.TotalNumbers))
                    {
                        ViewBag.ErrorMessage    = "Total numbers should be greater then obtained marks";
                        ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
                        ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", talentGala.RequestStatusId);
                        //ModelState.AddModelError("Error: ", "Percentage of your marks should be 80% atleast.");
                        return(View(talentGala));
                    }
                    //else if (((Convert.ToDecimal(talentGala.CGPA_Numbers) / Convert.ToDecimal(talentGala.TotalNumbers)) * 100) < 80)
                    //{
                    //    ViewBag.ErrorMessage = "Percentage of your marks should be 80% atleast.";
                    //    ViewBag.InstituteId = new SelectList(db.Institutes, "Id", "Institute1");
                    //    ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", talentGala.RequestStatusId);
                    //    //ModelState.AddModelError("Error: ", "Percentage of your marks should be 80% atleast.");
                    //    return View(talentGala);
                    //}

                    try
                    {
                        //var institute = Request.Form["InstituteId"]; talentGala.InstituteId =Convert.ToInt32(institute);
                        talentGala.RequestStatusId = 1;
                        talentGala.CreatedAt       = DateTime.Now;
                        db.TalentGalas.Add(talentGala);
                        db.SaveChanges();
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "You are successfully registerd for Talent Gala with your crdentials,Team SEE Lahore will soon respond you through Email.Stay Connected for Bigest Event of Lahore,See Lahore 2018", url = controllerName + "/" + actionName }));
                    }
                    catch (DbEntityValidationException ex)
                    {
                        string message = "";
                        foreach (var validationErrors in ex.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                message = message + validationError.PropertyName + "  " + validationError.ErrorMessage + "\n\n";
                            }
                        }

                        HomeController.EntityinfoMessage(talentGala.Name + ": " + message);
                        HomeController.EntitywriteErrorLog(ex);
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
                    }
                }
                ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
                ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", talentGala.RequestStatusId);
                return(View(talentGala));
            }
            catch (Exception ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
                return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
            }
        }
        public ActionResult Create([Bind(Include = "Id,StallName,StallDetails,Logo,RequestStatusId,CategoryId,CreatedBy,CreatedAt,OwnerName,ContactNo,Email,Address,City,Profession,Institute")] StallRequest stallRequest, HttpPostedFileBase Logo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var obj = db.StallRequests.FirstOrDefault(s => s.Email == stallRequest.Email);
                    if (obj != null)
                    {
                        ViewBag.ErrorMessage    = "Email Already Exists!";
                        ViewBag.CreatedBy       = new SelectList(db.AspNetUsers, "Id", "Email", stallRequest.CreatedBy);
                        ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
                        ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", stallRequest.RequestStatusId);
                        ViewBag.CategoryId      = new SelectList(db.StallCategories, "Id", "StallType", stallRequest.CategoryId);
                        return(View(stallRequest));
                    }
                    if (Logo != null && Logo.ContentLength > 0)
                    {
                        var fileName = Path.GetFileName(Logo.FileName);
                        var path     = Path.Combine(Server.MapPath("~/UploadedImages/"), fileName);
                        Logo.SaveAs(path);
                        stallRequest.Logo = fileName;
                    }
                    try
                    {
                        stallRequest.RequestStatusId = 1;
                        stallRequest.CreatedAt       = DateTime.Now;
                        stallRequest.CreatedBy       = User.Identity.GetUserId();
                        db.StallRequests.Add(stallRequest);
                        db.SaveChanges();
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "Your stall proposal is successfully registerd with your crdentials,Team SEE Lahore will soon respond you through Email.Stay Connected for Bigest Event of Lahore,See Lahore 2018", url = controllerName + "/" + actionName }));
                    }
                    catch (DbEntityValidationException ex)
                    {
                        string message = "";
                        foreach (var validationErrors in ex.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                message = message + validationError.PropertyName + "  " + validationError.ErrorMessage + "\n\n";
                            }
                        }

                        HomeController.EntityinfoMessage(stallRequest.OwnerName + ": " + message);
                        HomeController.EntitywriteErrorLog(ex);
                        string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                        string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                        return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
                    }
                }
                ViewBag.CreatedBy       = new SelectList(db.AspNetUsers, "Id", "Email", stallRequest.CreatedBy);
                ViewBag.InstituteId     = new SelectList(db.Institutes, "Id", "Institute1");
                ViewBag.RequestStatusId = new SelectList(db.RequestStatus, "Id", "Status", stallRequest.RequestStatusId);
                ViewBag.CategoryId      = new SelectList(db.StallCategories, "Id", "StallType", stallRequest.CategoryId);
                return(View(stallRequest));
            }
            catch (Exception ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                HomeController.infoMessage(ex.Message);
                HomeController.writeErrorLog(ex);
                return(RedirectToAction("SubmissionResponce", "Home", new { status = "Due to Server overload something went wrong! please try again. Sorry for Inconvenience", url = controllerName + "/" + actionName }));
            }
        }