예제 #1
0
        public virtual System.Web.Mvc.ActionResult Create(Models.Cooperation cooperation)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files["ResumeFile"].ContentLength > 0)
                {
                    string RealDirectory = string.Format("{0}/{1}", Server.MapPath("~/Content/Resume"), Request.Files["ResumeFile"].FileName);
                    string ResumeFile    = Request.Files["ResumeFile"].FileName;
                    Request.Files["ResumeFile"].SaveAs(RealDirectory);
                    cooperation.ResumeFile = ResumeFile;
                }

                UnitOfWork.CooperationRepository.Insert(cooperation);

                UnitOfWork.Save();
            }
            else
            {
                ViewBag.Error = Resources.Messages.Captcha;
                var IsDisabled = false;
                ViewBag.IsDisabled = IsDisabled;
            }


            return(View(cooperation));
        }
        public override System.Web.Mvc.ActionResult ContactUs(Models.Cooperation oCooperation)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ContactUs);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "oCooperation", oCooperation);
            ContactUsOverride(callInfo, oCooperation);
            return(callInfo);
        }
        public override System.Web.Mvc.ActionResult Edit(Models.Cooperation cooperation)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "cooperation", cooperation);
            EditOverride(callInfo, cooperation);
            return(callInfo);
        }
예제 #4
0
        public virtual System.Web.Mvc.ActionResult ContactUs(Models.Cooperation oCooperation)
        {
            if (ModelState.IsValid)
            {
                if (Session["Captcha"] != null || Session["Captcha"].ToString() == oCooperation.Captcha)
                {
                    try
                    {
                        MailMessage msg  = new MailMessage();
                        MailAddress from = new MailAddress("*****@*****.**", "gmail", System.Text.Encoding.UTF8);
                        MailAddress to   = new MailAddress("*****@*****.**");
                        SmtpClient  smtp = new SmtpClient();

                        msg.Subject         = oCooperation.Name;
                        msg.SubjectEncoding = System.Text.Encoding.UTF8;
                        msg.Body            = oCooperation.Message + " =پیام" + "\n\r" + "نام= " + oCooperation.Name + "\n\r" + "ایمیل= " + oCooperation.Email + "\n\r" + oCooperation.Mobile + "=موبایل " + "\n\r" + oCooperation.InsertDateTime + "=زمان ";
                        msg.BodyEncoding    = System.Text.Encoding.UTF8;
                        msg.From            = from;
                        msg.To.Add(to);

                        ////  msg.Bcc.Add(bcc);
                        // msg.CC.Add(cc);
                        // smtp.Host = "smtp.mail.yahoo.com";
                        smtp.Host = "smtp.gmail.com";
                        //    smtp.Port = 25;
                        smtp.Timeout     = 36000;
                        smtp.Port        = 587;
                        smtp.EnableSsl   = true;
                        smtp.Credentials = new NetworkCredential("*****@*****.**", "NaserForoutan1393");
                        smtp.Send(msg);
                        oCooperation.InsertDateTime = Infrastructure.Utility.Now;
                        UnitOfWork.CooperationRepository.Insert(oCooperation);

                        UnitOfWork.Save();
                        TempData["Message"] = Models.Resources.Messages.SucceseMessage;
                        //TempData["AlertMessage"] = Models.Resources.Actions.SuccessMessage;
                        //return (RedirectToAction(MVC.Home.ContactUs(Models.Resources.Messages.SucceseMessage)));
                        return(RedirectToAction(MVC.AboutUs.ContactUs()));
                    }

                    catch
                    {
                        TempData["Message"] = "پیام شما ارسال نشد";
                    }
                    //return (View());
                    ModelState.AddModelError("Captcha", "Wrong value of sum, please try again.");


                    return(View(oCooperation));
                }
            }
            return(View(oCooperation));
        }
예제 #5
0
        public virtual System.Web.Mvc.ActionResult DeleteConfirmed(System.Guid id)
        {
            Models.Cooperation oCooperation =
                UnitOfWork.CooperationRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            UnitOfWork.CooperationRepository.Delete(oCooperation);
            ViewBag.message = Models.Resources.ContactUs.SaveMessage;
            UnitOfWork.Save();

            return(RedirectToAction(MVC.Cooperation.Index()));
        }
예제 #6
0
        public virtual System.Web.Mvc.ActionResult Edit(System.Guid id)
        {
            Models.Cooperation oCooperation =
                UnitOfWork.CooperationRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            if (oCooperation == null)
            {
                return(HttpNotFound());
            }

            return(View(oCooperation));
        }
예제 #7
0
        public virtual System.Web.Mvc.ActionResult Edit(Models.Cooperation cooperation)
        {
            Models.Cooperation oco = UnitOfWork.CooperationRepository.GetById(cooperation.Id);

            oco.IsActive = cooperation.IsActive;

            oco.UpdateDateTime = Infrastructure.Utility.Now;


            //if (ModelState.IsValid)
            //{
            UnitOfWork.CooperationRepository.Update(oco);

            UnitOfWork.Save();

            return(RedirectToAction(MVC.Cooperation.Index()));

            //}

            return(View(cooperation));
        }
 partial void ContactUsOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.Cooperation oCooperation);
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.Cooperation cooperation);