Пример #1
0
        public FindController(
            IPaginatedMetaService paginatedMetaService,
            WebDbContext Context,

            IAddresServices Address,
            WebEventoo_DomainClasses.Services.IExhibitionServices Cermoney,
            IColorService Color,
            ICommentService Comment,
            IEductionservices Eduction,
            IEventServices Event,
            WebExhibitionoo_DomainClasses.Services.IExhibitionServices Exhibition,
            IInformationService Information,
            IPlaceServices Place
            )
        {
            FAddressServices      = Address;
            FCermoneyServices     = Cermoney;
            FColorServices        = Color;
            FCommentServices      = Comment;
            FEductionServices     = Eduction;
            FEventServices        = Event;
            FExhibitionServices   = Exhibition;
            FInformtionSErvices   = Information;
            FPlacesServices       = Place;
            context               = Context;
            _paginatedMetaService = paginatedMetaService;
        }
Пример #2
0
 public ActionResult NewsList()
 {
     using (var context = new WebDbContext())
     {
         return(View(context.News.ToList()));
     }
 }
Пример #3
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");
            }
        }
Пример #4
0
        public DeleteController(
            WebDbContext Context,

            IAddresServices Address,
            WebEventoo_DomainClasses.Services.IExhibitionServices Cermoney,
            IColorService Color,
            ICommentService Comment,
            IEductionservices Eduction,
            IEventServices Event,
            INotPublishedServices notpublish,
            WebExhibitionoo_DomainClasses.Services.IExhibitionServices Exhibition,
            IInformationService Information,
            IPlaceServices Place
            )
        {
            context             = Context;
            FAddressServices    = Address;
            FCermoneyServices   = Cermoney;
            FColorServices      = Color;
            FCommentServices    = Comment;
            FEductionServices   = Eduction;
            FEventServices      = Event;
            FExhibitionServices = Exhibition;
            FInformtionSErvices = Information;
            FPlacesServices     = Place;
            FnotPublished       = notpublish;
        }
Пример #5
0
        public HomeController(
            WebDbContext Context,
            IAddresServices Address,
            WebEventoo_DomainClasses.Services.IExhibitionServices Cermoney,
            IColorService Color,
            ICommentService Comment,
            IEductionservices Eduction,
            IEventServices Event,
            WebExhibitionoo_DomainClasses.Services.IExhibitionServices Exhibition,
            IInformationService Information,
            IHostingEnvironment hostingEnvironment,
            IReportServices ReportServices,
            IPlaceServices Place)
        {
            FAddressServices    = Address;
            FCermoneyServices   = Cermoney;
            FColorServices      = Color;
            FCommentServices    = Comment;
            FEductionServices   = Eduction;
            FEventServices      = Event;
            FExhibitionServices = Exhibition;
            FInformtionSErvices = Information;
            FPlacesServices     = Place;
            FreportServices     = ReportServices;
            context             = Context;

            this._hostingEnvironment = hostingEnvironment;
        }
Пример #6
0
        public List <ClssRules> GetRulesXetTuyen(double sup, double con)
        {
            //double minSupport = Double.Parse(formCollection["MinSupport"]);
            //double minConfidence = Double.Parse(formCollection["MinConfidence"]);
            WebDbContext dbContext    = new WebDbContext();
            var          dataListView = (from HoSoXetTuyens in dbContext.HoSoXetTuyens
                                         from Tinhs in dbContext.Tinhs
                                         where
                                         HoSoXetTuyens.TruongTHPT.MaTinh == Tinhs.MaTinh
                                         select new
            {
                HoSoXetTuyens.CMDN,
                HoSoXetTuyens.TruongTHPT.TenTruong,
                Tinhs.TenTinh,
                HinhThucXetTuyen = (bool?)HoSoXetTuyens.DiemXetTuyen.HinhThucXetTuyen
            }).ToList();
            string result = "";

            foreach (var item in dataListView)
            {
                db.Add(new clssItemSet()
                {
                    (item.HinhThucXetTuyen == true ? "Thi tuyển" : "Học bạ"),
                    item.TenTinh
                });
            }

            clssItemSet        uniqueItems = db.GetUniqueItems();
            ClssItemCollection L           = clssApriori.DoApriori(db, sup);
            List <ClssRules>   allRules    = clssApriori.Mine(db, L, con);

            result = "\n" + allRules.Count + " rules \n";

            return(allRules);
        }
Пример #7
0
        public IActionResult RegisterUser([Bind] UserModel user)
        {
            WebDbContext db = HttpContext.RequestServices.GetService(typeof(Web.Utils.WebDbContext)) as WebDbContext;

            if (ModelState.IsValid)
            {
                // Check if email already exists in db
                if (db.GetLoginUsername(user) > 0)
                {
                    return(RedirectToAction("RegisterUserExists"));
                }

                // Generate new salt and hash password
                var            password       = user.Password.ToString();
                PasswordHasher pwHasher       = new PasswordHasher();
                HashResult     hashedPassword = pwHasher.HashNewSalt(password, 20, SHA512.Create());
                user.Salt     = hashedPassword.Salt;
                user.Password = hashedPassword.Digest;

                // Register new user
                db.RegisterUser(user);

                // Redirect to user area
                ModelState.Clear();
                return(RedirectToAction("UserLogin"));
            }

            // Model data invalid
            return(RedirectToAction("RegisterModelFailed"));
        }
Пример #8
0
        public ActionResult Index()
        {
            var ctx = new WebDbContext();
            var companies = ctx.Set<Company>().ToList();

            return View();
        }
Пример #9
0
 public ProgenyController(IProgenyHttpClient progenyHttpClient, IMediaHttpClient mediaHttpClient, WebDbContext context, ImageStore imagestore)
 {
     _progenyHttpClient = progenyHttpClient;
     _mediaHttpClient   = mediaHttpClient;
     _context           = context; // Todo: Replace _context with httpClient
     _imageStore        = imagestore;
 }
Пример #10
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();
            }
        }
Пример #11
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();
                }
            }
        }
Пример #12
0
 public void ExecuteStatistics()
 {
     using (WebDbContext db = new WebDbContext())
     {
         db.Database.ExecuteSqlCommand("spThongKe_Edit");
     }
     
 }
Пример #13
0
 public SachController()
 {
     _context = new WebDbContext();
     _bookService = new BookService(_context);
     _nhaXuatBanService = new NhaXuatBanService(_context);
     _tacGiaService = new TacGiaService(_context);
     _bookCategoriesService = new BookCategoriesService(_context);
 }
Пример #14
0
 public AccountController(WebDbContext context, IEmailSender emailSender, UserManager <Users> userManager, SignInManager <Users> signInManager)
 {
     this.signInManager = signInManager;
     _context           = context;
     _userManager       = userManager;
     Vmodel             = new ViewModel.InformationViewModel();
     this.emailSender   = emailSender;
     _context.Database.EnsureCreated();
 }
Пример #15
0
 public AdminController(IProgenyHttpClient progenyHttpClient, WebDbContext context,
                        IBackgroundTaskQueue queue, IHubContext <WebNotificationHub> hubContext, IPushMessageSender pushMessageSender)
 {
     _progenyHttpClient = progenyHttpClient;
     _context           = context;
     Queue              = queue;
     _hubContext        = hubContext;
     _pushMessageSender = pushMessageSender;
 }
Пример #16
0
        public HomeController(WebDbContext db, UserManager <Employee> userManager,
                              SignInManager <Employee> signInManager, RoleManager <IdentityRole> roleManager)
        {
            this.db            = db;
            this.userManager   = userManager;
            this.signInManager = signInManager;
            this.roleManager   = roleManager;

            db.SaveChanges();
        }
Пример #17
0
 public ActionResult NewsDelete(int id)
 {
     using (var c = new WebDbContext())
     {
         c.News.Remove(c.News.Find(id));
         c.SaveChanges();
     }
     GameCache.ReCache(false, false, true);
     return(RedirectToAction("NewsList"));
 }
Пример #18
0
 public IEnumerable<Statistics> LoadStatistics()
 {
     IList<Statistics> statistics = new List<Statistics>();
     using (WebDbContext db = new WebDbContext())
     {
         var result = db.Database.SqlQuerySmart<Statistics>("spThongKe");
         if (result != null && result.Any())
             statistics = result.ToList();
     }
     return statistics;
 }
Пример #19
0
 public OperationController(WebDbContext db,
                            ICommentService Comment,
                            IEventServices Event, INotPublishedServices NotPublish, ITranctionServices TranctionServices)
 {
     Dbcontext           = db;
     vmodel              = new ViewModel.InformationViewModel();
     FNotPublishServices = NotPublish;
     FEventServices      = Event;
     FTranctionServices  = TranctionServices;
     FCommentServices    = Comment;
 }
Пример #20
0
        public static void DeleteCompInfo()
        {
            using (var db = new WebDbContext())
            {
                var compinfo = db.ScCompInfoes.Find(30);

                db.ScCompInfoes.Remove(compinfo);

                db.SaveChanges();
            }
        }
Пример #21
0
 public static void ReCache(bool c_rank, bool g_rank, bool news)
 {
     if (g_rank)
     {
         cache_g_rank = new List <Rank_Guild>();
         using (var context = new GameDbContext())
         {
             List <Guild> guilds = context.Guilds.ToList();
             foreach (var guild in guilds)
             {
                 Rank_Guild rguild = new Rank_Guild();
                 rguild.Name    = guild.G_Name;
                 rguild.Master  = guild.G_Master;
                 rguild.Mark    = guild.G_Mark;
                 rguild.Members = 0;
                 int reset_count = 0;
                 foreach (var gm in context.GuildMembers.Where(m => m.G_Name == rguild.Name).ToList())
                 {
                     rguild.Members += 1;
                     int temp = context.Characters.Find(gm.Name).Resets;
                     reset_count += temp;
                 }
                 rguild.Resets = reset_count;
                 cache_g_rank.Add(rguild);
             }
         }
         cache_g_rank_date = DateTime.Now;
         cache_g_rank.Sort();
     }
     if (c_rank)
     {
         if (cache_c_rank == null)
         {
             cache_c_rank = new Dictionary <RankType, List <Rank_Char> >();
         }
         foreach (RankType rt in Enum.GetValues(typeof(RankType)))
         {
             cache_c_rank[rt] = GetRankCharFromDB(rt);
         }
         cache_c_rank_date = DateTime.Now;
     }
     if (news)
     {
         if (cache_news == null)
         {
             cache_news = new List <NewsPost>();
         }
         using (var c = new WebDbContext())
         {
             cache_news = c.News.OrderByDescending(m => m.Date).ToList();
         }
     }
 }
Пример #22
0
        public static void UpdateScCompInfoWithQuery1()
        {
            string sql = @"update SC_COMP_INFO set COMP_NM=@compNm where COMP_TYPE=@compType";

            using (var db = new WebDbContext())
            {
                System.Data.SqlClient.SqlParameter p1 = new System.Data.SqlClient.SqlParameter("@compNm", "test114");
                System.Data.SqlClient.SqlParameter p2 = new System.Data.SqlClient.SqlParameter("@compType", "A");


                db.Database.ExecuteSqlCommand(sql, p1, p2);
            }
        }
Пример #23
0
 public HomeController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     ApplicationDbContext applicationDbContext,
     RoleManager <IdentityRole> roleManager,
     WebDbContext context
     )
 {
     _roleManager          = roleManager;
     _applicationDbContext = applicationDbContext;
     _userManager          = userManager;
     _signInManager        = signInManager;
     _context = context;
 }
Пример #24
0
        public static void UpdateCompInfoMulti()
        {
            using (var db = new WebDbContext())
            {
                var comps = db.VcCompInfoes.Where(ci => ci.CompNm == "test113").ToList();

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

                db.SaveChanges();
            }
        }
Пример #25
0
        //********************************************

        #region Ham lay ra danh sach cac luat:Khoa =>Mon cai thien

        public List <ClssRules> LuatCaiThien(double sup, double con)
        {
            //double minSupport = Double.Parse(formCollection["MinSupport"]);
            //double minConfidence = Double.Parse(formCollection["MinConfidence"]);
            WebDbContext dbContext    = new WebDbContext();
            var          dataListView = (from a in (
                                             (from dcthk in dbContext.DiemCTHKys
                                              from sv in dbContext.SinhViens
                                              where
                                              dcthk.MSSV == sv.MSSV
                                              select new
            {
                dcthk.MaMon,
                dcthk.MSSV,
                dcthk.DiemTKHe4,
                dcthk.MonHoc.TenMon,
                sv.Lop.Khoa.TenKhoa
            }))
                                         group a by new
            {
                a.MaMon,
                a.MSSV,
                a.TenMon,
                a.TenKhoa
            } into g
                                         where g.Count() > 1
                                         select new
            {
                g.Key.TenMon,
                g.Key.TenKhoa
            }).ToList();
            string result = "";

            foreach (var item in dataListView)
            {
                db.Add(new clssItemSet()
                {
                    item.TenMon,
                    item.TenKhoa
                });
            }

            clssItemSet        uniqueItems = db.GetUniqueItems();
            ClssItemCollection L           = clssApriori.DoApriori(db, sup);
            List <ClssRules>   allRules    = clssApriori.Mine(db, L, con);

            result = "\n" + allRules.Count + " rules \n";

            return(allRules);
        }
Пример #26
0
        public static async void UpdateCompInfoMultiAsync()
        {
            using (var db = new WebDbContext())
            {
                var comps = db.ScCompInfoes.Where(ci => ci.CompType == "A" && ci.CompNm == "test113").ToList();

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

                await db.SaveChangesAsync();
            }
        }
Пример #27
0
        public static void UpdateScCompInfoWithQuery()
        {
            string sql = @"update SC_COMP_INFO set COMP_NM={0} where COMP_TYPE={1}";

            using (var db = new WebDbContext())
            {
                List <Object> sqlParamsList = new List <object>();
                sqlParamsList.Add("test117");
                sqlParamsList.Add("A");

                db.Database.ExecuteSqlCommand(sql, sqlParamsList.ToArray());

                // var entry = db.Entry(new ScCompInfo { CompSn = 10 });
            }
        }
Пример #28
0
        public List <ClssRules> GetRulesHocCaiThien(double sup, double con)
        {
            WebDbContext dbContext    = new WebDbContext();
            var          dataListView = ((from a in (
                                              (from dcthk in dbContext.DiemCTHKys
                                               where
                                               dcthk.DiemTKHe10 >= dcthk.MonHoc.DiemDat
                                               select new
            {
                dcthk.MSSV,
                dcthk.MonHoc.MaMon,
                dcthk.DiemTKHe10,
                dcthk.MonHoc.TenMon,
                dcthk.ID_HocKi
            }))
                                          group a by new
            {
                a.MSSV,
                a.MaMon,
                a.TenMon
            } into g
                                          where (g.Max(p => p.DiemTKHe10) - g.Min(p => p.DiemTKHe10)) > 0
                                          select new
            {
                g.Key.MSSV,
                g.Key.MaMon,
                g.Key.TenMon,
                chechlech = (double?)(g.Max(p => p.DiemTKHe10) - g.Min(p => p.DiemTKHe10))
            })).ToList();
            string result = "";

            foreach (var item in dataListView)
            {
                db.Add(new clssItemSet()
                {
                    item.TenMon,
                    item.chechlech.ToString()
                });
            }

            clssItemSet        uniqueItems = db.GetUniqueItems();
            ClssItemCollection L           = clssApriori.DoApriori(db, sup);
            List <ClssRules>   allRules    = clssApriori.Mine(db, L, con);

            result = "\n" + allRules.Count + " rules \n";

            return(allRules);
        }
Пример #29
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();
            }
        }
Пример #30
0
 public ActionResult NewsEdit(int id)
 {
     using (var c = new WebDbContext())
     {
         var post = c.News.Find(id);
         if (post == null)
         {
             return(new HttpNotFoundResult());
         }
         NewsViewModel mdl = new NewsViewModel();
         mdl.Id          = post.Id;
         mdl.ImageFile   = post.Image;
         mdl.Title       = post.Title;
         mdl.HtmlContent = post.HtmlContent;
         return(View(mdl));
     }
 }
Пример #31
0
 public ActionResult NewsEdit(NewsViewModel model)
 {
     if (ModelState.IsValid)
     {
         using (var c = new WebDbContext())
         {
             var oPost = c.News.Find(model.Id);
             oPost.HtmlContent = model.HtmlContent;
             oPost.Image       = model.ImageFile;
             oPost.Title       = model.Title;
             oPost.Date        = DateTime.Now;
             c.SaveChanges();
         }
         GameCache.ReCache(false, false, true);
         return(RedirectToAction("NewsList"));
     }
     return(View(model));
 }
Пример #32
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();
            }
        }
Пример #33
0
        public static void insertScCompInfo()
        {
            var comp = new VcCompInfo
            {
                //Addr1 = "테스트주소",
                CompNm = "테스트회사"
                         //CompType = "A"
            };

            using (var db = new WebDbContext())
            {
                db.VcCompInfoes.Add(comp);

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

                db.SaveChanges();
            }
        }