123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using System.Data;
- using System.Text;
- using System.IO;
- using System.Drawing.Imaging;
- using System.Reflection;
- using Autofac;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.JSON;
- using Bowin.Web.Controls.Mvc;
- using EMIS.Web.Controls;
- using EMIS.Utility;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EducationManagement;
- using EMIS.ViewModel.SystemView;
- using EMIS.CommonLogic.UniversityManage.SpecialtyClassManage;
- using EMIS.CommonLogic.EducationManagement;
- using EMIS.CommonLogic.SystemServices;
- namespace EMIS.Web.Controllers
- {
- [Authorization]
- public class CommonController : Controller
- {
- public IConfiguretermsInfoServices ConfiguretermsInfoServices { get; set; }
- public IBatchModifyServices BatchModifyServices { get; set; }
- public IMailVerifyServices MailVerifyServices { get; set; }
- public IUserServices UserServices { get; set; }
- public IWorkflowServices WorkflowServices { get; set; }
- public IContextMenuServices ContextMenuServices { get; set; }
- public IClassmajorServices ClassmajorServices { get; set; }
- public IControlItemServices ControlItemServices { get; set; }
- public EducationMissionClassView educationMissionClassView { get; set; }
- public IEducationMissionClassServices EducationMissionClassServices { get; set; }
- /// <summary>
- ///
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="dictionaryCode"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DictionaryDropDown(DropdownListBindType? bindType, string dictionaryCode)
- {
- List<DropdownListItem> list = DictionaryHelper.GetDictionaryValue(dictionaryCode).Where(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE)
- .Select(x => new DropdownListItem { Text = x.Name, Value = x.Value.ToString() }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, list);
- return base.Json(list);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="bindType"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult SchoolYearDropDown(DropdownListBindType? bindType)
- {
- List<DropdownListItem> list = DictionaryHelper.GetDictionaryValue(typeof(EMIS.ViewModel.CF_Year).Name)
- .Select(x => new DropdownListItem { Text = x.Name, Value = x.Value.ToString() })
- .OrderByDescending(x => x.Value).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, list);
- return base.Json(list);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="menuNo"></param>
- /// <param name="formClass"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult DynamicConditionDropDown(DropdownListBindType? bindType, string menuNo, string formClass)
- {
- if (menuNo == "")
- {
- menuNo = null;
- }
- var listAttribute = ConfiguretermsInfoServices.GetConfiguretermsInfo(menuNo, formClass);
- List<DropdownListItem> listdl = new List<DropdownListItem>();
- foreach (var item in listAttribute)
- {
- if (item.ControlType == "DictionaryDropDownList")
- {
- item.PostUrl = Url.Action("DictionaryDropDown") + "?dictionaryCode=" + item.DictionaryCode + "&bindType=" + (int)DropdownListBindType.SelectAll;
- item.ControlTextFiled = "Text";
- item.ControlValueFiled = "Value";
- }
- else if (!string.IsNullOrEmpty(item.PostUrl))
- {
- var temp = item.PostUrl.Split('?');
- if (temp.Length > 1)
- {
- item.PostUrl = item.PostUrl + "&bindType=" + (int)DropdownListBindType.SelectAll;
- }
- else
- {
- item.PostUrl = item.PostUrl + "?bindType=" + (int)DropdownListBindType.SelectAll;
- }
- item.PostUrl = Url.Content(item.PostUrl);
- }
- DropdownListItem ddl = new DropdownListItem { Text = item.Name, Value = item.ToJson() };
- listdl.Add(ddl);
- }
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, listdl);
- return base.Json(listdl);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="menuClass"></param>
- /// <param name="mnu"></param>
- /// <returns></returns>
- [HttpPost]
- public JsonResult GetPositionConditionData(string menuClass, string mnu)
- {
- if (mnu == "")
- {
- mnu = null;
- }
- var configuretermsInfos = ConfiguretermsInfoServices.GetConfiguretermsInfo(mnu, menuClass);
- if (configuretermsInfos != null && configuretermsInfos.Count() > 0)
- {
- var result = new
- {
- Url = Url.Action("DynamicConditionDropDown") + "?menuNo=" + mnu + "&formClass=" + menuClass + "&bindType=" + (int)DropdownListBindType.None,
- TextField = "Text",
- ValueField = "Value",
- Condition = configuretermsInfos[0].listControl
- };
- return Json(result, JsonRequestBehavior.AllowGet);
- }
- else
- {
- var result = new
- {
- Url = Url.Action("DynamicConditionDropDown") + "?menuNo=" + mnu + "&formClass=" + menuClass + "&bindType=" + (int)DropdownListBindType.None,
- TextField = "Text",
- ValueField = "Value"
- };
- return Json(result, JsonRequestBehavior.AllowGet);
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="controlName"></param>
- /// <param name="dataCondition"></param>
- /// <param name="textField"></param>
- /// <param name="valueFiled"></param>
- /// <param name="url"></param>
- /// <param name="configuretermsExpandJson"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetPositionConditionComboGrid(string controlName, string dataCondition, string textField, string valueFiled,
- string url, string configuretermsExpandJson)
- {
- var configuretermsExpandList = configuretermsExpandJson.JsonToObject<List<Sys_ConfiguretermsExpand>>();
- List<DataGridColumn> columList = new List<DataGridColumn>();
- foreach (var configuretermsExpand in configuretermsExpandList)
- {
- BoundFieldColumn bfc = new BoundFieldColumn { FieldName = configuretermsExpand.ColumnValue, HeaderText = configuretermsExpand.ColumnName, Width = 0.1, Align = AlignStyle.Center };
- columList.Add(bfc);
- }
- ComboGridOptions comboGridOptions = new ComboGridOptions
- {
- TextField = textField,
- ValueField = valueFiled,
- ID = controlName,
- Name = controlName,
- EmptyText = "全部",
- GridOptions = new DataGridOptions
- {
- Columns = columList,
- IsCheckOnSelect = true,
- DataSourceUrl = Url.Content(url),
- IsPagination = true,
- IsShowRowNumbers = true,
- IsSingleSelect = false
- }
- };
- IDictionary<string, string> htmlAttributes = new Dictionary<string, string>() { { "data-condition", dataCondition } };
- return Json(MvcHtmlString.Create(Bowin.Web.Controls.Mvc.ComboGrid.CreateControl(comboGridOptions, htmlAttributes).Render()).ToHtmlString());
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="menuNo"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult BatchUpdateDropDown(DropdownListBindType? bindType, string menuNo)
- {
- List<DropdownListItem> listdl = new List<DropdownListItem>();
- string columnName = string.Empty;
- var listAttribute = BatchModifyServices.GetBatchModifyList(menuNo);
- foreach (var item in listAttribute)
- {
- DropdownListItem ddl = new DropdownListItem { Text = item.Name, Value = item.ToJson() };
- listdl.Add(ddl);
- }
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, listdl);
- return base.Json(listdl);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="msg"></param>
- /// <param name="url"></param>
- /// <param name="windowId"></param>
- /// <returns></returns>
- public ActionResult MsgShow(string msg, string url, string windowId = "")
- {
- ViewBag.msg = msg;
- ViewBag.url = url;
- ViewBag.WindowID = string.IsNullOrEmpty(windowId) ? Request["WindowID"] : windowId;
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="msg"></param>
- /// <returns></returns>
- public ActionResult Messager(string msg)
- {
- ViewBag.msg = msg;
- return View();
- }
- /// <summary>
- /// 弹出提示并关闭上级弹窗
- /// </summary>
- /// <param name="msg"></param>
- /// <param name="WindowID"></param>
- /// <returns></returns>
- public ActionResult MsgShowAndClose(string msg, string WindowID)
- {
- ViewBag.msg = msg;
- ViewBag.WindowID = string.IsNullOrEmpty(WindowID) ? Request["WindowID"] : WindowID;
- return View();
- }
- /// <summary>
- /// 弹出提示并打开原先弹窗
- /// </summary>
- /// <param name="msg"></param>
- /// <param name="WindowID"></param>
- /// <returns></returns>
- public ActionResult MsgShowAndOpen(string msg, string WindowID)
- {
- ViewBag.msg = msg;
- ViewBag.WindowID = string.IsNullOrEmpty(WindowID) ? Request["WindowID"] : WindowID;
- return View();
- }
-
- /// <summary>
- /// 弹出提示并打开原先弹窗
- /// </summary>
- /// <param name="msg"></param>
- /// <param name="url"></param>
- /// <param name="WindowID"></param>
- /// <returns></returns>
- public ActionResult MsgShowAndOpenAddUrl(string msg, string url, string WindowID)
- {
- ViewBag.msg = msg;
- ViewBag.WindowID = string.IsNullOrEmpty(WindowID) ? Request["WindowID"] : WindowID;
- ViewBag.url = url;
- return View();
- }
- /// <summary>
- /// 批量修改
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult BatchModify()
- {
- string batchModifyName = Request["DropdownBatchModify"];
- var BatchModify = batchModifyName.JsonToObject<Sys_BatchModify>();
- string batchModifyValue = string.Empty;
- string hidBatchModify = Request["PL_hiddenBatchModify"];
- try
- {
- if (BatchModify.ControlType == "TextBox")
- batchModifyValue = Request[BatchModify.Value + "_TextBox"];
- else if (BatchModify.ControlType == "DropdownList")
- batchModifyValue = Request[BatchModify.Value + "_DropdownList"];
- else if (BatchModify.ControlType == "DictionaryDropDownList")
- batchModifyValue = Request[BatchModify.Value + "_DictionaryDropDownList"];
- else if (BatchModify.ControlType == "CheckBox")
- batchModifyValue = Request[BatchModify.Value + "_CheckBox"].Split(',').Length > 1 ? Request[BatchModify.Value + "_CheckBox"].Split(',')[0] : Request[BatchModify.Value + "_CheckBox"];
- else if (BatchModify.ControlType == "ComboGrid")
- batchModifyValue = Request[BatchModify.Value + "_ComboGrid"];
- else if (BatchModify.ControlType == "TextBoxDate")
- batchModifyValue = Request[BatchModify.Value + "_TextBoxDate"];
- else if (BatchModify.ControlType == "TextBoxDateTime")
- batchModifyValue = Request[BatchModify.Value + "_TextBoxDateTime"];
- else if (BatchModify.ControlType == "NumberBox")
- batchModifyValue = Request[BatchModify.Value + "_NumberBox"];
- if (BatchModify.ControlType != "TextBox")
- {
- if (batchModifyValue == "")
- {
- batchModifyValue = null;
- }
- else if (BatchModify.ControlType == "DropdownList" || BatchModify.ControlType == "DictionaryDropDownList")
- {
- if (batchModifyValue == DropdownList.PLEASE_SELECT.ToString())
- {
- batchModifyValue = null;
- }
- }
- }
- //获取修改的ID 转换成数组
- List<Guid> listID = new List<Guid>();
- for (int i = 0; i < hidBatchModify.Split(',').Length; i++)
- {
- string batchmodify = hidBatchModify.Split(',')[i];
- if (!string.IsNullOrEmpty(batchmodify))
- {
- listID.Add(new Guid(batchmodify));
- }
- }
- //List<string> funcationstringlist = BatchModifyServices.GetBatchModifyEvents(BatchModify.MNUID, BatchModify.MUNClass, BatchModify.Value);
- BatchModifyServices.BatchUpdate(BatchModify.MNUID, BatchModify.MUNClass, BatchModify.Value, (object)batchModifyValue, listID);
- return Json(new ReturnMessage { IsSuccess = true, Message = "批量修改成功。" });
- //return RedirectToAction("MsgShow", "Common", new
- //{
- // WindowID = "none",
- // msg = "批量修改成功。",
- // url = Url.Content(BatchModify.ReturnUrl).AddMenuParameter()
- //});
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage { IsSuccess = false, Message = "批量修改失败,原因:" + ex.Message });
- //return RedirectToAction("MsgShow", "Common", new
- //{
- // WindowID = "none",
- // msg = "批量修改失败,原因:" + ex.Message,
- // url = Url.Content(BatchModify.ReturnUrl).AddMenuParameter()
- //});
- }
- }
- public ActionResult UserRole(Guid userID)
- {
- return View();
- }
- public ActionResult RoleSelector()
- {
- return View();
- }
- public ActionResult CollegeSelector()
- {
- return View();
- }
- public ActionResult DepartmentSelector()
- {
- return View();
- }
- public ActionResult Uploader(string n, Guid? v, int? t, int? m)
- {
- string sessionCookieName = Const.LOCAL_SETTING_LOGIN_COOKIENAME;
- if (Request.Cookies[sessionCookieName] != null)
- ViewBag.hfcookieName = Request.Cookies[sessionCookieName].Value;
- if (v.HasValue)
- {
- ViewBag.name = n;
- ViewBag.value = v;
- ViewBag.type = t;
- ViewBag.maxSize = m;
- }
- return View();
- }
- public ActionResult UploaderInit(Guid? id, string n)
- {
- Response.Cache.SetNoStore();
- List<FileUploadView> result = new List<FileUploadView>();
- string sessionName = FileUploadHelper.GetFileUploadSessionName(id.Value);
- if (Session[sessionName] == null)
- {
- Session[sessionName] = new List<FileUploadView>();
- }
- using (var scope = AutofacHelper.RequestLifetimeScope.BeginLifetimeScope())
- {
- IFileUploadServices uploadService = scope.ResolveNamed<IFileUploadServices>(n);
- result = uploadService.GetFileList(id);
- Session[sessionName] = result;
- }
- return Json(result, JsonRequestBehavior.AllowGet);
- }
- public ActionResult UploaderSave(FormCollection form)
- {
- Response.Cache.SetNoStore();
- try
- {
- FileUploadView upfile = new FileUploadView();
- var files = Request.Files;
- var formID = (!string.IsNullOrEmpty(Request["v"])) ? new Guid(Request["v"]) : (Guid?)null;
- string sessionName = FileUploadHelper.GetFileUploadSessionName(formID.Value);
- //检查文件扩展名字
- var postedFile = files["Filedata"]; //得到要上传文件
- if (postedFile.FileName == null)
- {
- return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
- }
- var accepts = new List<string> { ".rar", ".doc", ".docx", ".xls", ".xlsx", ".zip", ".pdf", ".txt", ".swf", ".wmv", ".jpg", ".jpeg", ".png", ".bmp" };
- if (!string.IsNullOrEmpty(postedFile.FileName) && !accepts.Contains(Path.GetExtension(postedFile.FileName).ToLower()))
- {
- throw new Exception("不允许的文件类型。");
- }
- upfile.FileID = Function.NewPKGuid();
- string fileUrl = FileUploadHelper.UploadFile(postedFile);
- upfile.FileUrl = fileUrl;
- upfile.FileName = postedFile.FileName;
- upfile.FormID = formID;
- if (Session[sessionName] == null)
- {
- Session[sessionName] = new List<FileUploadView>();
- }
- ((List<FileUploadView>)Session[sessionName]).Add(upfile);
- return Json(upfile, JsonRequestBehavior.AllowGet);
- }
- catch (Exception ex)
- {
- //throw ex;
- return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
- }
- //return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
- }
- public ActionResult UploaderDel(Guid? id, Guid? fileid)
- {
- string result = "";
- if (id.HasValue)
- {
- List<FileUploadView> fileList = new List<FileUploadView>();
- string sessionName = FileUploadHelper.GetFileUploadSessionName(id.Value);
- if (Session[sessionName] == null)
- {
- Session[sessionName] = new List<FileUploadView>();
- }
- fileList = (List<FileUploadView>)Session[sessionName];
- var file = fileList.Where(x => x.FileID == fileid).FirstOrDefault();
- if (file != null)
- {
- fileList.Remove(file);
- FileUploadHelper.DeleteFile(file.FileUrl);
- }
- else
- {
- result = "删除文件失败!";
- }
- }
- else
- {
- result = "文件ID为空,删除文件失败!";
- }
- return Content(result);
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="UserID"></param>
- /// <param name="Code"></param>
- /// <returns></returns>
- public ActionResult UserVerify(Guid UserID, string Code)
- {
- if (MailVerifyServices.Verify(UserID, Code))
- {
- return View();
- }
- else
- {
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "邮件连接已失效或不正确,请重新申请。",
- url = Url.Content("~/Account/Login")
- });
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="changeView"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult UserVerify(ChangePasswordView changeView)
- {
- var userID = new Guid(Request["UserID"]);
- UserServices.ChangePassword(changeView, userID);
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "密码已经修改,请重新登录验证修改结果。",
- url = Url.Content("~/Account/Login")
- });
- }
- /// <summary>
- /// 添加教师
- /// </summary>
- /// <returns></returns>
- public ActionResult TeacherSelect()
- {
- return View();
- }
- /// <summary>
- /// 添加专业
- /// </summary>
- /// <returns></returns>
- public ActionResult SpecialtySelect()
- {
- return View();
- }
- /// <summary>
- /// 添加班级
- /// </summary>
- /// <returns></returns>
- public ActionResult ClassmajorSelect()
- {
- ViewBag.GrademajorID = Request.Params["GrademajorID"];
- return View();
- }
- /// <summary>
- /// 添加班级
- /// </summary>
- /// <returns></returns>
- public ActionResult ClassmajorViewSelect()
- {
- ViewBag.CollegeID = Request.Params["CollegeID"];
- ViewBag.GradeYearID = Request.Params["GradeYearID"];
- ViewBag.StandardID = Request.Params["StandardID"];
- return View();
- }
- /// <summary>
- /// 添加学生(学生发放专用)
- /// </summary>
- /// <returns></returns>
- public ActionResult StudentSelect()
- {
- ViewBag.studentDistributeID = Request.Params["studentDistributeID"];
- ViewBag.GrademajorID = Request.Params["GrademajorID"];
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="classmajorID"></param>
- /// <param name="educationMissionClassID"></param>
- /// <returns></returns>
- public ActionResult StudentViewSelect(Guid? classmajorID, Guid? educationMissionClassID)
- {
- educationMissionClassID = Request["educationMissionClassID"].ParseStrTo<Guid>();
- if (classmajorID.HasValue)
- {
- var classmajor = ClassmajorServices.GetClassmajorView(classmajorID);
- ViewBag.ClassmajorID = classmajor.ClassmajorID;
- ViewBag.GrademajorID = classmajor.GrademajorID;
- ViewBag.CollegeID = classmajor.CollegeID;
- }
- else if (educationMissionClassID.HasValue)
- {
- var classmajor = EducationMissionClassServices.GetClassmajorByEducationClassID(educationMissionClassID);
- ViewBag.InSchool = 1;
- ViewBag.ClassmajorID = classmajor.ClassmajorID;
- ViewBag.GrademajorID = classmajor.GrademajorID;
- ViewBag.CollegeID = classmajor.CollegeID;
- }
- else
- {
- ViewBag.ClassmajorID = "-1";
- ViewBag.GrademajorID = "-1";
- ViewBag.CollegeID = "-1";
- }
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public ActionResult ClassroomSelect()
- {
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public ActionResult CoursematerialSelect()
- {
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public ActionResult StudentBatchSelect()
- {
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="formClass"></param>
- /// <param name="mnu"></param>
- /// <returns></returns>
- [HttpPost]
- public JsonResult GetContextMenuList(string formClass, string mnu)
- {
- var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- //以后好好想想怎么控制按钮
- //var controlContextMenuList = ControlItemServices.GetNeedControlContextMenuNo().Where(x => x.MenuNo == mnu).ToList();
- var contextMenuList = ContextMenuServices.GetContextMenuListByUserAndRoleID((mnu == "" ? null : mnu), formClass, user.UserID, user.RoleID);
- var result = contextMenuList.OrderBy(x => x.SeqNo).Select(x => new
- {
- Name = x.ContextMnuNo,
- Text = x.Title,
- Icon = x.IconName,
- OnClick = x.Scripts
- })
- .ToList();
- return Json(result, JsonRequestBehavior.AllowGet);
- }
- /// <summary>
- /// 审核历史页面
- /// </summary>
- /// <returns></returns>
- public ActionResult ApproveStatus()
- {
- return View();
- }
- /// <summary>
- /// 审核历史页面
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveStatus(QueryParamsModel pararms)
- {
- string tableName = pararms.getExtraString("tableName");
- Guid formID = pararms.getExtraGuid("formID").Value;
- var approveHistoryList = WorkflowServices.GetApproveHistoryViewList(tableName, formID)
- .OrderBy(x => x.ApproveTime).ToList();
- return Json(new GridResultSet<WorkflowApproveHistoryView> { rows = approveHistoryList.ToList(), total = approveHistoryList.Count });
- }
- /// <summary>
- /// 获取工作流程环节所有状态(根据对应的bindType、tableName)
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="tableName"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveStatusDropDown(DropdownListBindType? bindType, string tableName)
- {
- var statusList = WorkflowServices.GetStatusViewList(tableName).OrderBy(x => x.ID)
- .Select(x => new DropdownListItem()
- {
- Text = x.Name,
- Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, statusList);
- return base.Json(statusList);
- }
- /// <summary>
- /// 查询对应的工作流程表中审核流程环节状态(WorkflowStatusView,不包含开始、结束、非正常[BP]结束环节)
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="tableName"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveStatusNotStartEndDropDown(DropdownListBindType? bindType, string tableName)
- {
- var statusList = WorkflowServices.GetApproveStatusViewList(tableName).OrderBy(x => x.ID)
- .Select(x => new DropdownListItem()
- {
- Text = x.Name,
- Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, statusList);
- return base.Json(statusList);
- }
- /// <summary>
- /// 查询对应的工作流程表中全部非开始流程环节状态(WorkflowStatusView,不包含开始环节)
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="tableName"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveStatusNotStartDropDown(DropdownListBindType? bindType, string tableName)
- {
- var statusList = WorkflowServices.GetNoStartStatusViewList(tableName).OrderBy(x => x.ID)
- .Select(x => new DropdownListItem()
- {
- Text = x.Name,
- Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, statusList);
- return base.Json(statusList);
- }
- /// <summary>
- /// 查询对应的工作流程表中全部非结束流程环节状态(WorkflowStatusView,不包含结束状态)
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="tableName"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveStatusNoEndDropDown(DropdownListBindType? bindType, string tableName)
- {
- //结束流程环节ID
- var endStatusID = WorkflowServices.GetCorrectEndStatus(tableName);
- var statusList = WorkflowServices.GetStatusViewList(tableName).Where(x => x.ID != endStatusID).OrderBy(x => x.ID)
- .Select(x => new DropdownListItem()
- {
- Text = x.Name,
- Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, statusList);
- return base.Json(statusList);
- }
- /// <summary>
- /// 查询对应的工作流程表中全部可提交流程环节状态(WorkflowStatusView,不包含审批、结束、非正常[BP]结束状态)
- /// 如:未提交(开始环节)、已退回[BP]状态
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="tableName"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveStatusApplyDropDown(DropdownListBindType? bindType, string tableName)
- {
- //结束流程环节ID
- var endStatusID = WorkflowServices.GetCorrectEndStatus(tableName);
- //审核流程状态IDList
- var approveStatusIDList = WorkflowServices.GetApproveStatusViewList(tableName).Select(x => x.ID).ToList();
- var statusList = WorkflowServices.GetStatusViewList(tableName).Where(x => x.ID != endStatusID && !approveStatusIDList.Contains(x.ID)).OrderBy(x => x.ID)
- .Select(x => new DropdownListItem()
- {
- Text = x.Name,
- Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, statusList);
- return base.Json(statusList);
- }
- /// <summary>
- /// 查询对应的工作流程表中全部结束流程环节状态
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="tableName"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveStatusEndDropDown(DropdownListBindType? bindType, string tableName)
- {
- var statusList = WorkflowServices.GetEndStatusViewList(tableName).OrderBy(x => x.ID)
- .Select(x => new DropdownListItem()
- {
- Text = x.Name,
- Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
- }).ToList();
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, statusList);
- return base.Json(statusList);
- }
- /// <summary>
- /// 审批页面
- /// </summary>
- /// <returns></returns>
- public ActionResult ApproveHandler()
- {
- return View();
- }
- /// <summary>
- /// 流程环节动作
- /// </summary>
- /// <param name="bindType"></param>
- /// <param name="tableName"></param>
- /// <param name="formID"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult ApproveActionDropDown(DropdownListBindType? bindType, string tableName, Guid formID)
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- List<DropdownListItem> actionList;
- try
- {
- actionList = WorkflowServices.GetActionView(tableName, formID, user.UserID)
- .Select(x => new DropdownListItem { Text = x.ActionName, Value = x.ActionID.ToString() }).ToList();
- }
- catch (Exception)
- {
- actionList = new List<DropdownListItem>();
- }
- DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
- DropdownList.FormatDropdownItemList(dbt, actionList);
- return base.Json(actionList);
- }
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- [AllowAnonymous]
- public ActionResult ReportViewer()
- {
- return View();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- [AllowAnonymous]
- public ActionResult ResImage(string key)
- {
- var context = this.HttpContext;
- var image = RSI.Get(key);
- context.Response.Buffer = true;
- context.Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
- context.Response.Expires = 0;
- context.Response.CacheControl = "no-cache";
- context.Response.AppendHeader("Pragma", "No-Cache");
- image.Save(context.Response.OutputStream, image.RawFormat);
- Type imageFormatType = typeof(ImageFormat);
- System.Reflection.PropertyInfo[] _ImageFormatList = imageFormatType.GetProperties(BindingFlags.Static | BindingFlags.Public);
- for (int i = 0; i != _ImageFormatList.Length; i++)
- {
- ImageFormat _FormatClass = (ImageFormat)_ImageFormatList[i].GetValue(null, null);
- if (_FormatClass.Guid.Equals(image.RawFormat.Guid))
- {
- context.Response.ContentType = "image/" + _ImageFormatList[i].Name.ToLower();
- }
- }
- context.Response.End();
- return new EmptyResult();
- }
- }
- }
|