コード例 #1
0
        private void CopyProperties(EditMediaModel editMedia, Media media)
        {
            media.Title = editMedia.Title;

            media.Modified   = DateTime.Now;
            media.ModifiedBy = User.Identity.Name.ToUpper();

            if (media.CreatedBy == null)
            {
                media.Created   = DateTime.Now;
                media.CreatedBy = User.Identity.Name.ToUpper();
            }

            media.NaviNodeId = editMedia.NaviNodeId;

            foreach (string upload in Request.Files)
            {
                HttpPostedFileBase f = Request.Files[upload];
                if (f != null && f.ContentLength > 0)
                {
                    if (media.File == null)
                    {
                        media.File           = new MediaFile();
                        media.File.Created   = DateTime.Now;
                        media.File.CreatedBy = User.Identity.Name.ToUpper();
                    }

                    media.File.FileName = Path.GetFileName(f.FileName);
                    media.File.FileType = CmsHelper.GetMimeType(Path.GetExtension(f.FileName));

                    //fix mine type by IE
                    if (media.File.FileType == "image/pjpeg")
                    {
                        media.File.FileType = "image/jpeg";
                    }
                    else if (media.File.FileType == "image/x-png")
                    {
                        media.File.FileType = "image/png";
                    }

                    media.File.FileSize = f.ContentLength;

                    if (media.Title == null)
                    {
                        media.Title = media.File.FileName;
                    }

                    byte[] fileContent = new byte[f.ContentLength];
                    f.InputStream.Read(fileContent, 0, f.ContentLength);

                    media.File.FileContent = fileContent;

                    media.File.Modified   = DateTime.Now;
                    media.File.ModifiedBy = User.Identity.Name.ToUpper();
                }

                break;
            }
        }
コード例 #2
0
        public virtual JsonResult ContactUs(string from, string to, string cc, string message, string subject, string name, string comments, string phone, string requestSubjectId, string requestType)
        {
            try
            {
                string host     = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["host"]);
                int    port     = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["port"]);
                string username = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["username"]);
                string password = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["password"]);

                Durados.Cms.DataAccess.Email.Send(host, Map.Database.UseSmtpDefaultCredentials, port, username, password, false, new string[1] {
                    to
                }, new string[1] {
                    cc
                }, new string[0], subject, message, from, null, null, DontSend, new string[0], Map.Database.Logger, true);

                if (!string.IsNullOrEmpty(requestType))
                {//requestType = "contact";
                    string confirmationSubject    = CmsHelper.GetHtml(requestType + "ConfirmationSubject");
                    string confirmationMessage    = CmsHelper.GetHtml(requestType + "ConfirmationMessage");
                    string siteWithoutQueryString = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority;
                    confirmationMessage = confirmationMessage.Replace("{0}", "[Name]").Replace("[Name]", name).Replace("[Url]", siteWithoutQueryString);


                    if (string.IsNullOrEmpty(confirmationSubject))
                    {
                        confirmationSubject = "Thanks for contacting " + Durados.Database.LongProductName;
                    }

                    if (string.IsNullOrEmpty(confirmationMessage))
                    {
                        confirmationMessage = string.Format("Hi {0}!<br><br>Thanks for getting in touch.  We will contact you as soon as possible.<br><br>Sincerely,<br>" + Durados.Database.LongProductName + " Team", name);
                    }

                    //confirmationMessage = string.Format(confirmationMessage, name);

                    Durados.Cms.DataAccess.Email.Send(host, Map.Database.UseSmtpDefaultCredentials, port, username, password, false, new string[1] {
                        from
                    }, new string[0], new string[0], confirmationSubject, confirmationMessage, to, null, null, DontSend, new string[0], Map.Database.Logger, true);
                }

                try
                {
                    Durados.Web.Mvc.UI.Helpers.Account.InsertContactUsUsers(from, name, comments, phone, 100 + int.Parse(requestSubjectId), null, null);
                }
                catch (Exception ex)
                {
                    Maps.Instance.DuradosMap.Logger.Log(RouteData.Values["Controller"].ToString(), RouteData.Values["Action"].ToString(), "ContactUs", ex, 1, "failed to update websiteuser in ContactUs");
                }
                return(Json(true));
            }
            catch
            {
                return(Json(false));
            }
        }
コード例 #3
0
        //public DefaultController()
        //{
        //}

        public DefaultController(CultureUtility cultureUtility, HttpContextBase httponContextBase, CmsHelper cmsHelper, Configurations configuration)
        {
            Contract.Requires(cultureUtility != null);
            Contract.Requires(httponContextBase != null);
            Contract.Requires(configuration != null);

            _cultureUtility    = cultureUtility;
            _httponContextBase = httponContextBase;
            _cmsHelper         = cmsHelper;
            _configurations    = configuration;
        }
コード例 #4
0
    public string GetItemUrl(string providerGuid)
    {
        if (Page != null)
        {
            if (String.IsNullOrEmpty(providerGuid))
            {
                return(String.Empty);
            }

            // if our value starts with http
            // we return url
            if (providerGuid.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || providerGuid.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
            {
                return(providerGuid);
            }

            // if our value starts with ~/
            // we return url
            if (providerGuid.StartsWith("~/"))
            {
                return(Page.ResolveUrl(providerGuid));
            }

            if (providerGuid.StartsWith("["))
            {
                int idx = providerGuid.IndexOf("]");
                //getting the provider [Libraries]
                string provider = providerGuid.Substring(1, idx - 1);
                string strId    = providerGuid.Substring(idx + 1);
                Guid   id       = new Guid(strId);

                if (ContentManager.Providers.ContainsKey(provider))
                {
                    IContent cnt = ContentManager.Providers[provider].GetContent(id);
                    if (cnt != null)
                    {
                        return(VirtualPathUtility.ToAbsolute(cnt.UrlWithExtension, Page.Request.ApplicationPath));
                    }
                }
                else
                {
                    string url = CmsHelper.GetPageUrl(id, this.Context);
                    if (!string.IsNullOrEmpty(url))
                    {
                        return(url);
                    }
                }
            }
        }
        return(providerGuid.ToString());
    }
コード例 #5
0
ファイル: MSUserController.cs プロジェクト: yarivat/Admin
        protected virtual void SendRegistrationApproval(string email, string firstName, string lastName)
        {
            string host     = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["host"]);
            int    port     = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["port"]);
            string username = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["username"]);
            string password = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["password"]);

            string from    = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["fromAlert"]);
            string subject = "Allegro Registration Approval";
            string siteWithoutQueryString = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority;

            string message = CmsHelper.GetHtml("Registration Approval").Replace("[FirstName]", firstName).Replace("[LastName]", lastName).Replace("[AppPath]", siteWithoutQueryString);

            string to = email;

            Durados.Cms.DataAccess.Email.Send(host, false, port, username, password, false, to.Split(';'), null, null, subject, message, from, null, null, DontSend, null);
        }