Exemplo n.º 1
0
        /// <summary>
        /// 删除场地
        /// </summary>
        /// <param name="Ids"></param>
        /// <returns></returns>
        public JsonResult Delete(string[] Ids)
        {
            int result = new BLL.T_Base_MajorClass().Delete(Ids);

            if (result <= 0)
            {
                return(Json("删除失败"));
            }
            else
            {
                return(Json("删除" + result + "记录"));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存添加的专业班级信息
        /// </summary>
        /// <param name="AddMajorClassName"></param>
        /// <param name="AddArchitectureId"></param>
        /// <returns></returns>
        public JsonResult AddSaveMajorClass(string AddMajorClassName, int AddArchitectureId)
        {
            Model.T_Base_MajorClass majorClass = new Model.T_Base_MajorClass();
            majorClass.MajorClassName = AddMajorClassName;
            majorClass.ArchitectureId = AddArchitectureId;
            int result = new BLL.T_Base_MajorClass().AddSaveMajorClass(majorClass);

            if (result == 1)
            {
                return(Json("添加成功"));
            }
            else
            {
                return(Json("添加失败"));
            }
        }
        /// <summary>
        /// 统计班级下学生参加讲座总分导出Excel
        /// </summary>
        /// <param name="MajorClassId"></param>
        /// <returns></returns>
        public FileResult SaveMajorClassExcel(int MajorClassId)
        {
            List <Model.T_Base_User> list = new BLL.T_Base_MajorClass().GetAllUser(MajorClassId);
            HSSFWorkbook             book = new HSSFWorkbook(); //创建Excel文件对象
            ISheet sheet = book.CreateSheet();                  //创建一个sheet页
            IRow   row1  = sheet.CreateRow(0);

            row1.CreateCell(0).SetCellValue("学号");
            row1.CreateCell(1).SetCellValue("姓名");
            row1.CreateCell(2).SetCellValue("性别");
            row1.CreateCell(3).SetCellValue("联系方式");
            row1.CreateCell(4).SetCellValue("讲座总分");
            row1.CreateCell(5).SetCellValue("班级");
            row1.CreateCell(6).SetCellValue("学院");

            for (int i = 0; i < list.Count; i++)
            {
                IRow row = sheet.CreateRow(i + 1);
                row.CreateCell(0).SetCellValue(list[i].Num);
                row.CreateCell(1).SetCellValue(list[i].Name);
                if (list[i].Sex == 0)
                {
                    row.CreateCell(2).SetCellValue("女");
                }
                else if (list[i].Sex == 1)
                {
                    row.CreateCell(2).SetCellValue("男");
                }
                row.CreateCell(3).SetCellValue(list[i].PhoneNum);
                row.CreateCell(4).SetCellValue(new BLL.Statistic().GetScore(list[i].Num));
                row.CreateCell(5).SetCellValue(list[i].MajorClass.MajorClassName);
                row.CreateCell(6).SetCellValue(list[i].MajorClass.Architecture.ArchitectureName);
            }
            sheet.SetColumnWidth(0, 15 * 256);
            sheet.SetColumnWidth(1, 15 * 256);
            sheet.SetColumnWidth(2, 8 * 256);
            sheet.SetColumnWidth(3, 15 * 256);
            sheet.SetColumnWidth(4, 8 * 256);
            sheet.SetColumnWidth(5, 20 * 256);
            sheet.SetColumnWidth(6, 30 * 256);

            MemoryStream ms = new MemoryStream();

            book.Write(ms);
            ms.Seek(0, SeekOrigin.Begin);
            return(File(ms, "application/vnd.ms-excel", list[0].MajorClass.MajorClassName + "参加讲座情况.xls"));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存修改后的信息
        /// </summary>
        /// <param name="AddMajorClassName"></param>
        /// <param name="AddPeopleNum"></param>
        /// <param name="AddArchitectureId"></param>
        /// <returns></returns>
        public JsonResult EditSaveMajorClass(int EditId, string EditMajorClassName, int EditArchitectureId)
        {
            Model.T_Base_MajorClass majorClass = new Model.T_Base_MajorClass();
            majorClass.Id             = EditId;
            majorClass.MajorClassName = EditMajorClassName;
            majorClass.ArchitectureId = EditArchitectureId;
            majorClass.ArchitectureId = EditArchitectureId;
            int result = new BLL.T_Base_MajorClass().EditSaveMajorClass(majorClass);

            if (result == 1)
            {
                return(Json("修改成功"));
            }
            else
            {
                return(Json("修改失败"));
            }
        }