// Token: 0x060000BE RID: 190 RVA: 0x0000E7B0 File Offset: 0x0000C9B0 protected override void View() { this.regconfig = RegConfigs.GetRegConfig(); if (this.ispost) { if (!this.isfile) { this.ShowErr("请选择要导入的本地Excel表文件"); } else { string mapPath = FPUtils.GetMapPath(this.webpath + "cache"); string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName); string a = Path.GetExtension(fileName).ToLower(); if (a != ".xls") { this.ShowErr("该文件不是Excel表文件类型"); } else { if (!Directory.Exists(mapPath)) { Directory.CreateDirectory(mapPath); } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName); DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName); if (excelTable.Rows.Count > 0) { int num = excelTable.Rows.Count - 1; for (int i = 0; i < excelTable.Rows.Count; i++) { DataRow dataRow = excelTable.Rows[num - i]; string text = dataRow.ItemArray[0].ToString().Trim(); if (!(text == "")) { if (!this.InRestrictArray(text, this.regconfig.restrict)) { if (!UserBll.CheckUserName(text)) { DbHelper.ExecuteInsert <UserInfo>(new UserInfo { username = text, password = FPUtils.MD5(dataRow.ItemArray[1].ToString().Trim()), realname = dataRow.ItemArray[2].ToString().Trim(), mobile = dataRow.ItemArray[3].ToString().Trim(), email = dataRow.ItemArray[4].ToString().Trim(), roleid = this.GetRoleId(dataRow.ItemArray[5].ToString().Trim()), departid = this.GetDepartId(dataRow.ItemArray[6].ToString().Trim()) }); } } } } } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } base.Response.Redirect("usermanage.aspx"); } } } }
// Token: 0x06000084 RID: 132 RVA: 0x0000D2E8 File Offset: 0x0000B4E8 protected override void View() { if (this.ispost) { if (!this.isfile) { this.ShowErr("请选择要导入的本地Excel表文件"); } else { string mapPath = FPUtils.GetMapPath(this.webpath + "cache"); string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName); string a = Path.GetExtension(fileName).ToLower(); if (a != ".xls") { this.ShowErr("该文件不是Excel表文件类型"); } else { if (!Directory.Exists(mapPath)) { Directory.CreateDirectory(mapPath); } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName); DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName); string text = ""; string text2 = ""; string text3 = ""; if (excelTable.Rows.Count > 0) { int num = excelTable.Rows.Count - 1; for (int i = 0; i < num; i++) { DataRow dataRow = excelTable.Rows[num - i]; string text4 = dataRow.ItemArray[0].ToString().Trim(); if (!(text4 == "")) { SqlParam sqlParam = DbHelper.MakeAndWhere("username", text4); UserInfo userInfo = DbHelper.ExecuteModel <UserInfo>(new SqlParam[] { sqlParam }); if (userInfo.id == 0) { userInfo.username = text4; userInfo.realname = dataRow.ItemArray[1].ToString().Trim(); userInfo.password = FPUtils.MD5(dataRow.ItemArray[2].ToString().Trim()); userInfo.roleid = this.GetRoleId(dataRow.ItemArray[3].ToString().Trim()); userInfo.departid = this.GetDepartId(dataRow.ItemArray[4].ToString().Trim()); userInfo.nickname = dataRow.ItemArray[5].ToString().Trim(); userInfo.id = DbHelper.ExecuteInsert <UserInfo>(userInfo); } else { if (!string.IsNullOrEmpty(dataRow.ItemArray[1].ToString().Trim())) { userInfo.realname = dataRow.ItemArray[1].ToString().Trim(); } if (!string.IsNullOrEmpty(dataRow.ItemArray[2].ToString().Trim())) { userInfo.password = FPUtils.MD5(dataRow.ItemArray[2].ToString().Trim()); } if (!string.IsNullOrEmpty(dataRow.ItemArray[3].ToString().Trim())) { userInfo.roleid = this.GetRoleId(dataRow.ItemArray[3].ToString().Trim()); } if (!string.IsNullOrEmpty(dataRow.ItemArray[4].ToString().Trim())) { userInfo.departid = this.GetDepartId(dataRow.ItemArray[4].ToString().Trim()); } if (!string.IsNullOrEmpty(dataRow.ItemArray[5].ToString().Trim())) { userInfo.nickname = dataRow.ItemArray[5].ToString().Trim(); } DbHelper.ExecuteUpdate <UserInfo>(userInfo); } if (text != "") { text += ","; } text += userInfo.id; } } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } if (text != "") { if (this.examuser != "") { this.examuser += ","; } this.examuser += text; } SqlParam sqlParam2 = DbHelper.MakeAndWhere("id", WhereType.In, this.examuser); List <UserInfo> list = DbHelper.ExecuteList <UserInfo>(new SqlParam[] { sqlParam2 }); foreach (int num2 in FPUtils.SplitInt(this.examuser)) { foreach (UserInfo userInfo2 in list) { if (num2 == userInfo2.id && !FPUtils.InArray(num2, text3)) { if (text2 != "") { text2 += ","; } if (userInfo2.realname != "") { text2 += userInfo2.realname; } else { text2 += userInfo2.username; } if (text3 != "") { text3 += ","; } text3 += num2; } } } } Hashtable hashtable = new Hashtable(); hashtable["uname"] = text2; hashtable["examuser"] = text3; base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); base.Response.Write(JsonMapper.ToJson(hashtable)); base.Response.End(); } } } }
// Token: 0x06000071 RID: 113 RVA: 0x0000B6F8 File Offset: 0x000098F8 protected override void View() { this.sortinfo = SortBll.GetSortInfo(this.sortid); if (this.ispost) { if (!this.isfile) { this.ShowErr("请选择要导入的本地Excel表文件"); return; } string mapPath = FPUtils.GetMapPath(this.webpath + "cache"); string fileName = Path.GetFileName(FPRequest.Files["uploadfile"].FileName); string a = Path.GetExtension(fileName).ToLower(); if (a != ".xls") { this.ShowErr("该文件不是Excel表文件类型"); return; } if (!Directory.Exists(mapPath)) { Directory.CreateDirectory(mapPath); } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } FPRequest.Files["uploadfile"].SaveAs(mapPath + "\\" + fileName); DataTable excelTable = FPExcel.GetExcelTable(mapPath + "\\" + fileName); if (excelTable.Columns.Count < 14) { this.ShowErr("对不起,Excel表格列不得少于14。"); return; } if (excelTable.Rows.Count > 0) { int num = excelTable.Rows.Count - 1; for (int i = 0; i < excelTable.Rows.Count; i++) { DataRow dataRow = excelTable.Rows[num - i]; ExamQuestion examQuestion = new ExamQuestion(); examQuestion.uid = this.userid; examQuestion.channelid = this.sortinfo.channelid; examQuestion.type = this.TypeInt(dataRow.ItemArray[0].ToString()); examQuestion.title = dataRow.ItemArray[1].ToString(); if (examQuestion.type != 0 && !(examQuestion.title == "")) { for (int j = 0; j < 6; j++) { if (dataRow.ItemArray[2 + j].ToString() != "") { ExamQuestion examQuestion2 = examQuestion; examQuestion2.content += ((examQuestion.content == "") ? dataRow.ItemArray[2 + j].ToString() : ("§" + dataRow.ItemArray[2 + j].ToString())); } } if (examQuestion.type == 1 || examQuestion.type == 2) { examQuestion.answer = dataRow.ItemArray[8].ToString().Trim().ToUpper(); examQuestion.ascount = FPUtils.SplitString(examQuestion.content, "§").Length; } else if (examQuestion.type == 3) { if (FPUtils.InArray(dataRow.ItemArray[8].ToString().Trim(), "y,Y,正确,对")) { examQuestion.answer = "Y"; } else { examQuestion.answer = "N"; } examQuestion.ascount = 2; } else if (examQuestion.type == 4) { foreach (string a2 in FPUtils.SplitString(examQuestion.content, "§")) { if (a2 == "区分大小写") { examQuestion.upperflg = 1; } else if (a2 == "区分顺序") { examQuestion.orderflg = 1; } } examQuestion.answer = dataRow.ItemArray[8].ToString().Trim(); examQuestion.ascount = FPUtils.SplitString(examQuestion.answer).Length; } else { examQuestion.answer = dataRow.ItemArray[8].ToString().Trim(); examQuestion.ascount = 1; } examQuestion.answerkey = dataRow.ItemArray[9].ToString(); examQuestion.explain = dataRow.ItemArray[10].ToString(); examQuestion.difficulty = this.DifficultyInt(dataRow.ItemArray[11].ToString().Trim()); examQuestion.status = ((dataRow.ItemArray[12].ToString().Trim() == "否") ? 0 : 1); examQuestion.sortid = this.GetSortId(dataRow.ItemArray[13].ToString()); if (examQuestion.sortid == 0) { examQuestion.sortid = this.sortid; } DbHelper.ExecuteInsert <ExamQuestion>(examQuestion); SortBll.UpdateSortPosts(examQuestion.sortid, 1); } } } if (File.Exists(mapPath + "\\" + fileName)) { File.Delete(mapPath + "\\" + fileName); } base.Response.Redirect("questionmanage.aspx?sortid=" + this.sortid); } base.SaveRightURL(); }