Пример #1
0
        public async Task<int> AddBizManagerAsync(ScCompInfo scCompInfo)
        {
            //var rstScUsr = scUsrRespository.Insert(scUsr);
            //scCompInfo.
            var rstScCompInfo = scCompInfoRespository.Insert(scCompInfo);

            if (rstScCompInfo == null)
            {
                return -1;
            }
            return await SaveDbContextAsync();
        }
Пример #2
0
 public void CreateScCompInfo(ScCompInfo scCompInfo)
 {
     scCompInfoRespository.Add(scCompInfo);
 }
Пример #3
0
        public async Task<int> AddCompanyUserAsync(ScCompInfo scCompInfo, ScUsr scUsr, SHUSER_SyUser syUser)
        {
            //var rstScUsr = scUsrRespository.Insert(scUsr);
            //scCompInfo.
            var rstScCompInfo = scCompInfoRespository.Insert(scCompInfo);
            var rstSyUser = syUserRespository.Insert(syUser);

            if (rstScCompInfo == null || rstSyUser != 1)
            {
                return -1;
            }

            var rst = await SaveDbContextAsync();

            return rst;
            //if (rst != 1)
            //    return rst;

            //return await SaveDareDbContextAsync();
        }
Пример #4
0
        public static void DeleteScCompInfoWithoutSelect()
        {
            var comp = new ScCompInfo
            {
                CompSn = 30
            };

         
            using (var db = new WebDbContext())
            {
                //db.ScCompInfoes.Attach(comp);

                //db.ScCompInfoes.Remove(comp);

                db.Entry(comp).State = System.Data.Entity.EntityState.Deleted;

                try
                {
                    db.SaveChanges();
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex)
                {
                    ex.Entries.Single().Reload();
                }

            }
           
        }
Пример #5
0
        public static void UpdateScCompInfoWithoutSelect()
        {
            var comp = new ScCompInfo
            {
                CompSn = 85
            };

            using (var db = new WebDbContext())
            {
                db.ScCompInfoes.Attach(comp);

                comp.CompNm = "bizon188";

                db.SaveChanges();

            }
        }
Пример #6
0
        public static async Task UpdateScCompInfoAsync()
        {
            using (var db = new WebDbContext())
            {

                var compinfo = await db.ScCompInfoes.FindAsync(6);
                if (compinfo != null)
                {
                    compinfo.CompNm = "업데이트111";
                }
                else
                {
                    var comp = new ScCompInfo
                    {
                        Addr1 = "테스트업데이트주소",
                        CompNm = "업데이트당ㅇ앙아앙아",
                        CompType = "A"
                    };

                    db.ScCompInfoes.Add(comp);
                }

                await db.SaveChangesAsync();

            }
        }
Пример #7
0
        public static void UpdateScCompInfo()
        {
            using (var db = new WebDbContext())
            {
                var compinfo = db.ScCompInfoes.Find(6);
                if (compinfo != null)
                {
                    compinfo.CompNm = "업데이트111";
                }
                else
                {
                    var comp = new ScCompInfo
                    {
                        Addr1 = "테스트업데이트주소",
                        CompNm = "업데이트당ㅇ앙아앙아",
                        CompType = "A"
                    };

                    db.ScCompInfoes.Add(comp);
                }

                db.SaveChanges();

            }
        }
Пример #8
0
        public  static async void insertScCompInfoAsync()
        {
            var comp = new ScCompInfo
            {
                Addr1 = "테스트주소",
                CompNm = "테스트회사",
                CompType = "A"
            };

            using (var db = new WebDbContext())
            {

                db.ScCompInfoes.Add(comp);

                //이것도 가능
                //db.Entry<ScCompInfo>(comp).State = System.Data.Entity.EntityState.Added;

                await db.SaveChangesAsync();
            }
        }