Пример #1
0
    /// <summary>
    /// 呼叫對話腳本
    /// </summary>
    /// <param name="page">頁碼(代碼)</param>
    public void Call(string page, bool isTransparent)
    {
        dialog.AddRange(ReadExcel.Read("Dialog", page, 0, -1));
        speaker.AddRange(ReadExcel.Read("Dialog", page, 1, -1));
        align.AddRange(ReadExcel.Read("Dialog", page, 2, -1));

        StartCoroutine(ProcessDialog(isTransparent));
    }
 protected override void Seed(MaintenanceScheduleContext context)
 {
     using (EFUnitOfWork work = new EFUnitOfWork("ProbLoc"))
     {
         ReadExcel read = new ReadExcel();
         read.Read(work);
     }
 }
Пример #3
0
        private void Button_Aplicar(object sender, RoutedEventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();

            op.Title  = "Seleccione un Archivo";
            op.Filter = "Excel files (*.xls or .xlsx)|.xls;*.xlsx";
            if (op.ShowDialog() == true)
            {
                TxtPath.Text = op.FileName;
                _excelFile   = _read.Read(TxtPath.Text.Trim());
                DataGridExportFile.ItemsSource = new ObservableCollection <ExcelFileModel>(_excelFile);
            }
        }
Пример #4
0
    public void Read(string path)
    {
        if (questionDic == null)
        {
            questionDic = new Dictionary <int, Question>();
        }
        questionDic.Clear();

        ReadExcel.Read(path).ForEach(x =>
        {
            questionDic.Add(x.id, x);
        });
        OnLoadEndAction.Invoke();
    }
Пример #5
0
        public ActionResult UploadFiles()
        {
            HttpPostedFileBase file = Request.Files[0];

            if (file.FileName != "")
            {
                string    fileName = file.FileName;
                string    saveUrl  = Server.MapPath("/") + "UploadFiles/GradeExcel/";
                Uploader  up       = new Uploader();
                ReadExcel re       = new ReadExcel();
                up.UploadExcel(file, saveUrl);                  //上传文件到服务器上
                filePath = saveUrl + file.FileName;
                Score[]  scoreArray  = re.Read(filePath);       //读取成绩
                Puzzle[] puzzleArray = re.readPuzzle(filePath); //读取题型
                User     u           = (User)Session["User"];

                for (int i = 0; i < scoreArray.Length; i++)
                {
                    scoreArray[i].uploadtime = time;
                    scoreArray[i].updatetime = DateTime.Now.ToString("yyyy-MM-dd");
                    scoreArray[i].uploader   = u.user_account;
                    sc.ScoreList.Add(scoreArray[i]);
                }
                sc.SaveChanges();
                for (int i = 0; i < puzzleArray.Length; i++)
                {
                    puzzleArray[i].uploader   = u.user_account;
                    puzzleArray[i].uploadtime = time;
                    puzzleArray[i].updatetime = DateTime.Now.ToString("yyyy-MM-dd");
                    pc.PuzzleList.Add(puzzleArray[i]);
                }
                pc.SaveChanges();
                return(RedirectToAction("ChooseSubjectPage", "Head"));
            }
            else
            {
                return(RedirectToAction("UploadFilesPage", "Head", new { errorMsg = "未选择文件上传" }));
            }
        }