Exemple #1
0
        /// <summary>
        /// Create a new tbl_hotline object.
        /// </summary>
        /// <param name="id">Initial value of the id property.</param>
        /// <param name="name">Initial value of the name property.</param>
        public static tbl_hotline Createtbl_hotline(global::System.Int32 id, global::System.String name)
        {
            tbl_hotline tbl_hotline = new tbl_hotline();

            tbl_hotline.id   = id;
            tbl_hotline.name = name;
            return(tbl_hotline);
        }
Exemple #2
0
        public static bool InsertHotline(string sname, string sphone, int ncate, out string errmsg)
        {
            bool bOk = false;

            using (FavLinkEntities context = new FavLinkEntities())
            {
                var items = from x in context.tbl_hotline
                            where 0 == x.name.CompareTo(sname)
                            select x;
                if (items.Any())
                {
                    errmsg = string.Format("{0} already exist", sname);
                    return(false);
                }

                //insert
                var entity = new tbl_hotline()
                {
                    name         = sname,
                    phone_number = sphone,
                    category     = ncate
                };
                try
                {
                    context.tbl_hotline.AddObject(entity);
                    context.SaveChanges();
                    bOk    = true;
                    errmsg = string.Empty;
                }
                catch (Exception ex)
                {
                    errmsg = ex.Message;
                }
            }
            return(bOk);
        }
Exemple #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tbl_hotline EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotbl_hotline(tbl_hotline tbl_hotline)
 {
     base.AddObject("tbl_hotline", tbl_hotline);
 }