Ejemplo n.º 1
0
        public static BHXH.Data.ListDienCS New(string MaDienCS, string TenDienCS)

        {
            if (MaDienCS == "" || TenDienCS == "")
            {
                return(null);
            }
            if (IsExisted(MaDienCS, TenDienCS) != null)
            {
                return(IsExisted(MaDienCS, TenDienCS));
            }
            BHXH.Data.BHXHEntities ctx = new Data.BHXHEntities();
            BHXH.Data.ListDienCS   n   = new Data.ListDienCS();
            n.MaDienCS  = MaDienCS;
            n.TenDienCS = TenDienCS;
            ctx.ListDienCS.Add(n);

            try
            {
                ctx.SaveChanges();
                ctx.Dispose();
                return(n);
            }
            catch (Exception)
            {
                return(null);
            }

            finally
            { }
        }
Ejemplo n.º 2
0
        public static void Delete(string MaDienCS)
        {
            BHXH.Data.BHXHEntities ctx = new Data.BHXHEntities();

            var obj = new Data.ListDienCS {
                MaDienCS = MaDienCS
            };

            ctx.ListDienCS.Attach(obj);
            ctx.ListDienCS.Remove(obj);

            ctx.SaveChanges();
        }