Esempio n. 1
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByScheme(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return(contentMeta1.Scheme.CompareTo(contentMeta2.Scheme));
 }
Esempio n. 2
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByLangCode(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return(contentMeta1.LangCode.CompareTo(contentMeta2.LangCode));
 }
        private List<ContentMeta> LoadListFromReader(IDataReader reader)
        {
            List<ContentMeta> contentMetaList = new List<ContentMeta>();

            try
            {
                while (reader.Read())
                {
                    ContentMeta contentMeta = new ContentMeta();
                    contentMeta.Guid = new Guid(reader["Guid"].ToString());
                    contentMeta.SiteGuid = new Guid(reader["SiteGuid"].ToString());
                    contentMeta.ModuleGuid = new Guid(reader["ModuleGuid"].ToString());
                    contentMeta.ContentGuid = new Guid(reader["ContentGuid"].ToString());
                    contentMeta.Name = reader["Name"].ToString();
                    contentMeta.Scheme = reader["Scheme"].ToString();
                    contentMeta.LangCode = reader["LangCode"].ToString();
                    contentMeta.Dir = reader["Dir"].ToString();
                    contentMeta.MetaContent = reader["MetaContent"].ToString();
                    contentMeta.SortRank = Convert.ToInt32(reader["SortRank"]);
                    contentMeta.CreatedUtc = Convert.ToDateTime(reader["CreatedUtc"]);
                    contentMeta.CreatedBy = new Guid(reader["CreatedBy"].ToString());
                    contentMeta.LastModUtc = Convert.ToDateTime(reader["LastModUtc"]);
                    contentMeta.LastModBy = new Guid(reader["LastModBy"].ToString());
                    contentMetaList.Add(contentMeta);

                }
            }
            finally
            {
                reader.Close();
            }

            return contentMetaList;
        }
        public ContentMeta Fetch(Guid guid)
        {
            using (IDataReader reader = DBContentMeta.GetOne(guid))
            {
                if (reader.Read())
                {
                    ContentMeta contentMeta = new ContentMeta();
                    contentMeta.Guid = new Guid(reader["Guid"].ToString());
                    contentMeta.SiteGuid = new Guid(reader["SiteGuid"].ToString());
                    contentMeta.ModuleGuid = new Guid(reader["ModuleGuid"].ToString());
                    contentMeta.ContentGuid = new Guid(reader["ContentGuid"].ToString());
                    contentMeta.Name = reader["Name"].ToString();
                    contentMeta.Scheme = reader["Scheme"].ToString();
                    contentMeta.LangCode = reader["LangCode"].ToString();
                    contentMeta.Dir = reader["Dir"].ToString();
                    contentMeta.MetaContent = reader["MetaContent"].ToString();
                    contentMeta.SortRank = Convert.ToInt32(reader["SortRank"]);
                    contentMeta.CreatedUtc = Convert.ToDateTime(reader["CreatedUtc"]);
                    contentMeta.CreatedBy = new Guid(reader["CreatedBy"].ToString());
                    contentMeta.LastModUtc = Convert.ToDateTime(reader["LastModUtc"]);
                    contentMeta.LastModBy = new Guid(reader["LastModBy"].ToString());

                    return contentMeta;

                }
            }

            return null;
        }
Esempio n. 5
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByDir(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return contentMeta1.Dir.CompareTo(contentMeta2.Dir);
 }
        /// <summary>
        /// Persists a ContentMeta
        /// </summary>
        /// <returns></returns>
        public void Save(ContentMeta contentMeta)
        {
            if (contentMeta == null) { return; }

            if (contentMeta.Guid == Guid.Empty)
            {
                contentMeta.Guid = Guid.NewGuid();

                DBContentMeta.Create(
                    contentMeta.Guid,
                    contentMeta.SiteGuid,
                    contentMeta.ModuleGuid,
                    contentMeta.ContentGuid,
                    contentMeta.Name,
                    contentMeta.Scheme,
                    contentMeta.LangCode,
                    contentMeta.Dir,
                    contentMeta.MetaContent,
                    contentMeta.SortRank,
                    contentMeta.CreatedUtc,
                    contentMeta.CreatedBy);
            }
            else
            {
                DBContentMeta.Update(
                    contentMeta.Guid,
                    contentMeta.Name,
                    contentMeta.Scheme,
                    contentMeta.LangCode,
                    contentMeta.Dir,
                    contentMeta.MetaContent,
                    contentMeta.SortRank,
                    contentMeta.LastModUtc,
                    contentMeta.LastModBy);

            }
        }
Esempio n. 7
0
 /// <summary>
 /// Compares 2 instances of ContentProperty.
 /// </summary>
 public static int CompareByMetaContentProperty(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return(contentMeta1.ContentProperty.CompareTo(contentMeta2.ContentProperty));
 }
Esempio n. 8
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareBySortRank(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return(contentMeta1.SortRank.CompareTo(contentMeta2.SortRank));
 }
Esempio n. 9
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByScheme(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return contentMeta1.Scheme.CompareTo(contentMeta2.Scheme);
 }
Esempio n. 10
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareBySortRank(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return contentMeta1.SortRank.CompareTo(contentMeta2.SortRank);
 }
Esempio n. 11
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByMetaContent(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return contentMeta1.MetaContent.CompareTo(contentMeta2.MetaContent);
 }
Esempio n. 12
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByLastModUtc(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return contentMeta1.LastModUtc.CompareTo(contentMeta2.LastModUtc);
 }
Esempio n. 13
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByLangCode(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return contentMeta1.LangCode.CompareTo(contentMeta2.LangCode);
 }
Esempio n. 14
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByDir(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return(contentMeta1.Dir.CompareTo(contentMeta2.Dir));
 }
Esempio n. 15
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByCreatedUtc(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return(contentMeta1.CreatedUtc.CompareTo(contentMeta2.CreatedUtc));
 }
Esempio n. 16
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByMetaContent(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return(contentMeta1.MetaContent.CompareTo(contentMeta2.MetaContent));
 }
Esempio n. 17
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByLastModUtc(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return(contentMeta1.LastModUtc.CompareTo(contentMeta2.LastModUtc));
 }
        void grdContentMeta_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (productGuid == Guid.Empty) { return; }
            if (store == null) { return; }
            Product product = new Product(productGuid);
            if (product.StoreGuid != store.Guid) { return; }

            GridView grid = (GridView)sender;

            Guid guid = new Guid(grid.DataKeys[e.RowIndex].Value.ToString());
            TextBox txtName = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtName");
            TextBox txtScheme = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtScheme");
            TextBox txtLangCode = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtLangCode");
            DropDownList ddDirection = (DropDownList)grid.Rows[e.RowIndex].Cells[1].FindControl("ddDirection");
            TextBox txtMetaContent = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtMetaContent");

            ContentMeta meta = null;
            if (guid != Guid.Empty)
            {
                meta = metaRepository.Fetch(guid);
            }
            else
            {
                meta = new ContentMeta();
                if (siteUser != null) { meta.CreatedBy = siteUser.UserGuid; }
                meta.SortRank = metaRepository.GetNextSortRank(product.Guid);
                meta.ModuleGuid = store.ModuleGuid;
            }

            if (meta != null)
            {
                meta.SiteGuid = siteSettings.SiteGuid;
                meta.ContentGuid = product.Guid;
                meta.Dir = ddDirection.SelectedValue;
                meta.LangCode = txtLangCode.Text;
                meta.MetaContent = txtMetaContent.Text;
                meta.Name = txtName.Text;
                meta.Scheme = txtScheme.Text;
                if (siteUser != null) { meta.LastModBy = siteUser.UserGuid; }
                metaRepository.Save(meta);

                product.CompiledMeta = metaRepository.GetMetaString(product.Guid);
                product.Save();

            }

            grid.EditIndex = -1;
            grdContentMeta.Columns[2].Visible = true;
            BindMeta();
            upMeta.Update();
        }
Esempio n. 19
0
 /// <summary>
 /// Compares 2 instances of ContentMeta.
 /// </summary>
 public static int CompareByCreatedUtc(ContentMeta contentMeta1, ContentMeta contentMeta2)
 {
     return contentMeta1.CreatedUtc.CompareTo(contentMeta2.CreatedUtc);
 }