Exemple #1
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();
                }

            }
           
        }
Exemple #2
0
        public static string pwdEncrypt(string password)
        {
            using (var db = new WebDbContext())
            {
                //string sql = @"select PWDENCRYPT({0})";
               // string commandString = @"UPDATE SC_USR set LOGIN_PW = PWDENCRYPT({0}) where LOGIN_ID = {1}";

                string commandString = string.Format(@"UPDATE SC_USR set LOGIN_PW = PWDENCRYPT('{0}') where LOGIN_ID = '{1}'",
                                                      password, "shinkoooooo");

                var result = db.Database.ExecuteSqlCommand(commandString);



                //var result = db.Database.SqlQuery<>(commandString, sqlParamsList.ToArray()).FirstOrDefault();

                //var comps = db.ScUsrs.Where(ci => ci.LoginId == "shinkoooooo").ToList();

                //comps.ForEach(cis =>
                //{
                //    cis.LoginPw = result.;+
                //});

                db.SaveChanges();

                //return System.Text.Encoding.ASCII.GetString(result);
                return "TRUE";
            }


            
        }
Exemple #3
0
        public static  void DeleteCompInfo()
        {
            using (var db = new WebDbContext())
            {
                var compinfo = db.ScCompInfoes.Find(30);

                db.ScCompInfoes.Remove(compinfo);

                db.SaveChanges();
            }
        }
Exemple #4
0
        public static void UpdateCompInfoMulti()
        {
            using (var db = new WebDbContext())
            {
                var comps = db.ScCompInfoes.Where(ci => ci.CompType == "A" && ci.CompNm == "test113").ToList();

                comps.ForEach(cis =>
                {
                    cis.Email = "*****@*****.**";
                });

                db.SaveChanges();
            }
        }
Exemple #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();

            }
        }
Exemple #6
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();

            }
        }
Exemple #7
0
        public static void insertScCompInfo()
        {
            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;

                db.SaveChanges();
            }
        }