Esempio n. 1
0
        /// <summary>
        /// Create a new tbl_link_data object.
        /// </summary>
        /// <param name="id">Initial value of the id property.</param>
        public static tbl_link_data Createtbl_link_data(global::System.Int32 id)
        {
            tbl_link_data tbl_link_data = new tbl_link_data();

            tbl_link_data.id = id;
            return(tbl_link_data);
        }
Esempio n. 2
0
        public static bool InsertLinkData(int userID,
                                          string linkName,
                                          string linkUrl,
                                          string linkIcon,
                                          string linkColor,
                                          string linkCate,
                                          out string errmsg)
        {
            bool bOk = false;

            using (FavLinkEntities context = new FavLinkEntities())
            {
                int ncate = int.Parse(linkCate);
                var items = from x in context.tbl_link_data
                            where x.ref_userID == userID &&
                            x.ref_categoryID == ncate &&
                            (0 == string.Compare(linkUrl, x.url, true))// 0 == x.url.CompareTo(linkUrl)
                            select x;
                if (items.Any())
                {
                    var item = items.First();
                    errmsg = string.Format("The URL was already exist, the name is: {0}", item.name);
                    return(false);
                }

                //insert
                var entity = new tbl_link_data()
                {
                    ref_userID     = userID,
                    name           = linkName,
                    url            = linkUrl,
                    icon           = linkIcon,
                    bg_color       = linkColor,
                    ref_categoryID = ncate
                };
                try
                {
                    context.tbl_link_data.AddObject(entity);
                    context.SaveChanges();
                    bOk    = true;
                    errmsg = string.Empty;
                }
                catch (Exception ex)
                {
                    errmsg = ex.Message;
                }
            }
            return(bOk);
        }
Esempio n. 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tbl_link_data EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotbl_link_data(tbl_link_data tbl_link_data)
 {
     base.AddObject("tbl_link_data", tbl_link_data);
 }