示例#1
0
        public ActionResult Import(DataImportViewModel vm)
        {
            if (String.IsNullOrEmpty(vm.ImportPassword))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
            }

            string requiredHash = "aa7f5180ab596290cf8f1da45378a488";
            var    md5          = MD5.Create();
            var    bytes        = md5.ComputeHash(System.Text.Encoding.Unicode.GetBytes(vm.ImportPassword));

            if (!requiredHash.Equals(BitConverter.ToString(bytes).Replace("-", String.Empty).ToLower()))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
            }
            else
            {
                SDC.Library.DummyDataImport.ImportUtility import = new Library.DummyDataImport.ImportUtility();
                //load data.
                import.LoadData();
                //start import
                import.Import(max: vm.Max);

                return(View());
            }
        }
示例#2
0
        public void Import()
        {
            SDC.Library.DummyDataImport.ImportUtility import = new Library.DummyDataImport.ImportUtility();
            import.LoadData();

            Task t = import.Import(max:10);
            t.Wait();

            Assert.Fail();
        }
示例#3
0
        public void Import()
        {
            SDC.Library.DummyDataImport.ImportUtility import = new Library.DummyDataImport.ImportUtility();
            import.LoadData();

            Task t = import.Import(max: 10);

            t.Wait();

            Assert.Fail();
        }
示例#4
0
        public ActionResult Import(DataImportViewModel vm)
        {
            if(String.IsNullOrEmpty(vm.ImportPassword))
                return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);

            string requiredHash = "aa7f5180ab596290cf8f1da45378a488";
            var md5 = MD5.Create();
            var bytes = md5.ComputeHash(System.Text.Encoding.Unicode.GetBytes(vm.ImportPassword));
            if (!requiredHash.Equals(BitConverter.ToString(bytes).Replace("-", String.Empty).ToLower()))
            {
                return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);
            }
            else
            {
                SDC.Library.DummyDataImport.ImportUtility import = new Library.DummyDataImport.ImportUtility();
                //load data.
                import.LoadData();
                //start import
                import.Import(max: vm.Max);

                return View();
            }
        }