public ActionResult AddOrgMap() { var files = HttpContext.Request.Files; var requestParams = HttpContext.Request.Params; if (string.IsNullOrEmpty(requestParams.Get("DistributorID"))) { return(this.HttpNotFound()); } var distributorID = requestParams.Get("DistributorID"); files["OrgMap"].SaveAs(Const.RealOrgMapPath(distributorID)); files["Trains"].SaveAs(Const.RealTrainsPath(distributorID)); var dto = new OrgMapAddDTO { DistributorID = distributorID, OrgMap = distributorID, OrgMapFile = files["OrgMap"].FileName, Trains = distributorID, Status = 0, Domain1 = requestParams["Domain1"].TryBool(), Domain2 = requestParams["Domain2"].TryBool(), OrgMapUpdateTime = DateTime.Now, TrainsUpdateTime = DateTime.Now, OrgMapRealPath = Const.RealOrgMapPath(distributorID), TrainsRealPath = Const.RealTrainsPath(distributorID) }; var result = FcpaProvider.AddOrgMap(dto); return(new JsonResult(result)); }
public ActionResult Download(string id) { var dto = FcpaProvider.Get(id); string path = Const.RealCredentialPath(id); return(File(path, "application/octet-stream", string.Format("{0}.pdf", dto.Name))); }
public ActionResult Distributors() { UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO; var result = FcpaProvider.Distributors(lng.UserInfo()); return(new JsonResult(result)); }
public ActionResult Query(FcpaSearchDTO dto) { UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO; dto.UserInfo = lng.UserInfo(); var result = FcpaProvider.Query(dto); return(new JsonResult(result)); }
public ActionResult Export(FcpaSearchDTO dto) { dto.rows = int.MaxValue; dto.page = 1; UserLoginDTO lng = Session["UserLoginInfo"] as UserLoginDTO; dto.UserInfo = lng.UserInfo(); var result = FcpaProvider.Query(dto); var headers = new List <ExcelHeaderModel>() { new ExcelHeaderModel { Header = "经销商", PropertyName = "DistributorName", Width = 40 }, new ExcelHeaderModel { Header = "姓名", PropertyName = "Name", Width = 15 }, new ExcelHeaderModel { Header = "部门", PropertyName = "Department", Width = 15 }, new ExcelHeaderModel { Header = "职位", PropertyName = "Title", Width = 15 }, new ExcelHeaderModel { Header = "培训状态", PropertyName = "StatusDesc", Width = 10 }, new ExcelHeaderModel { Header = "培训完成日期", PropertyName = "CompletedDate", Width = 22 }, new ExcelHeaderModel { Header = "在职状态", PropertyName = "OffWorkDesc", Width = 22 }, new ExcelHeaderModel { Header = "所属领域", PropertyName = "DomainDesc", Width = 22 }, new ExcelHeaderModel { Header = "更新日期", PropertyName = "UpdateDate", Width = 22 }, new ExcelHeaderModel { Header = "过期日期", PropertyName = "ExpireDate", Width = 10 }, new ExcelHeaderModel { Header = "备注", PropertyName = "Remark", Width = 10 } }; var buffer = result.rows.ToExcel(headers); return(File(buffer, "application/vnd.ms-excel", string.Format("FCPA Training Record List({0}).xlsx", DateTime.Now.ToString("yyyyMMddHHmmss")))); }
private OperateResultDTO AddOrUpdate() { var request = HttpContext.Request; var files = request.Files; CredentialOperateDTO model = new CredentialOperateDTO { ID = string.IsNullOrEmpty(request.Params["ID"]) ? Guid.NewGuid() : Guid.Parse(request.Params["ID"]), DistributorID = request.Params["DistributorID"], Name = request.Params["Name"], Department = request.Params["Department"], Title = request.Params["Title"], CompletedDate = DateTime.Parse(request.Params["CompletedDate"]), ExpireDate = DateTime.Parse(request.Params["ExpireDate"]), OffWork = bool.Parse(request.Params["OffWork"]), Domain1 = request.Params["Domain1"].ToBool(), Domain2 = request.Params["Domain2"].ToBool(), Remark = request.Params["Remark"], }; if (model.OffWork) { model.OffWorkDate = DateTime.Parse(request.Params["OffWorkDate"]); } if (files.AllKeys.Contains("Certificate") && !string.IsNullOrEmpty(files["Certificate"].FileName)) { files["Certificate"].SaveAs(Const.RealCredentialPath(model.ID.ToString())); model.Certificate = model.ID.ToString(); } if (string.IsNullOrEmpty(request.Params["ID"])) { return(FcpaProvider.Add(model)); } else { return(FcpaProvider.Update(model)); } }