public IActionResult AddConference(ConferenceDto conferenceDto) { var entity = new ConferenceEntity(); _eventMapper.FillConferenceEntityWithDto(conferenceDto, entity); _eventRepository.AddEvent(entity); return(CreatedAtAction("GetEvent", new { eventId = entity.Id }, entity)); }
public object GetConference([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); //获取用户Id string userId = dy.userid; OperatorProvider.AppUserId = userId; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } string id = dy.data.ConferenceId;//会议ID ConferenceEntity entity = conferencebll.GetEntity(id); dynamic obj = new ExpandoObject(); obj.Id = entity.Id; obj.Content = entity.Content; //内容 obj.Compere = entity.Compere; //主持人 obj.CompereDept = entity.CompereDept; //召开部门 obj.ConferenceName = entity.ConferenceName; //会议名称 obj.ConferencePerson = entity.ConferencePerson; //会议应到人数 obj.ConferenceTime = entity.ConferenceTime.ToString(); //会议时间 obj.Locale = entity.Locale; //地点 obj.UserName = entity.UserName; //参会人员 IList <Photo> pList = new List <Photo>(); IList <Photo> rList = new List <Photo>(); //会议资料附件 DataTable file = fileInfoBLL.GetFiles(entity.Id); foreach (DataRow dr in file.Rows) { Photo p = new Photo(); p.id = dr["fileid"].ToString(); p.filename = dr["filename"].ToString(); p.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1); pList.Add(p); } obj.pfile = pList; //会议记录附件 file = fileInfoBLL.GetFiles(entity.ConferenceRedId); foreach (DataRow dr in file.Rows) { Photo p = new Photo(); p.id = dr["fileid"].ToString(); p.filename = dr["filename"].ToString(); p.fileurl = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1); rList.Add(p); } obj.rfile = rList; return(new { Code = 0, Count = 1, Info = "获取数据成功", data = obj }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, ConferenceEntity entity) { try { service.SaveForm(keyValue, entity); } catch (Exception) { throw; } }
public Object registerMeeting() { try { string res = ctx.Request["json"]; dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); //获取用户Id string userId = dy.userid; OperatorProvider.AppUserId = userId; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } string id = dy.data.ConferenceId;//会议ID //获取会议记录 ConferenceEntity ce = conferencebll.GetEntity(id); //获取参会人员记录 ConferenceUserEntity entity = conferenceuserbll.GetEntity(id, userId); //DateTime time = Convert.ToDateTime(ce.ConferenceTime); //if (DateTime.Now.AddHours(1) < time) //{ // return new { info = "未到签到时间", code = 3, count = -1, data = new List<Object>() }; //} //else if (DateTime.Now.Date > time.Date) //{ // return new { info = "已过签到时间", code = 4, count = -1, data = new List<Object>() }; //} //else //{ //} HttpFileCollection hf = ctx.Request.Files;//上传的文件 HttpPostedFile file = hf[0]; string filename = DateTime.Now.Ticks + file.FileName; string uploadDate = DateTime.Now.ToString("yyyyMMdd"); string virtualPath = string.Format("ERCHTMS/Resource/DocumentFile/{0}/{1}/{2}", userId, uploadDate, filename); string virtualPath1 = string.Format("/Resource/DocumentFile/{0}/{1}/{2}", userId, uploadDate, filename); string fullFileName = dataitemdetailbll.GetItemValue("imgPath") + virtualPath1; //创建文件夹 string path = Path.GetDirectoryName(fullFileName); Directory.CreateDirectory(path); file.SaveAs(fullFileName);//参数路径,保存 entity.Issign = "0"; entity.PhotoUrl = virtualPath; conferenceuserbll.SaveForm(ce.Id, entity); return(new { info = "会议签到成功", code = 0, count = -1, data = new List <Object>() }); } catch (Exception ex) { return(new { info = "会议签到失败:" + ex.Message, code = 0, count = -1, data = new List <Object>() }); } }
public object GetReviewInfo([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); //获取用户Id string userId = dy.userid; OperatorProvider.AppUserId = userId; //设置当前用户 Operator curUser = OperatorProvider.Provider.Current(); if (null == curUser) { return(new { code = -1, count = 0, info = "请求失败,请登录!" }); } string id = dy.data.ConferenceId; //会议ID string LeaverUserID = dy.data.LeaverUserID; //请假人ID ConferenceEntity entity = conferencebll.GetEntity(id); //获取请假人员记录 ConferenceUserEntity cue = conferenceuserbll.GetEntity(id, LeaverUserID); dynamic obj = new ExpandoObject(); obj.Id = entity.Id; obj.Content = entity.Content; //内容 obj.Compere = entity.Compere; //主持人 obj.CompereId = entity.CompereId; //主持人Id obj.CompereDept = entity.CompereDept; //召开部门 obj.ConferenceName = entity.ConferenceName; //会议名称 obj.ConferencePerson = entity.ConferencePerson; //会议应到人数 obj.ConferenceTime = entity.ConferenceTime.ToString(); //会议时间 obj.Locale = entity.Locale; //地点 obj.UserName = entity.UserName; //参会人员 obj.LeaveUser = cue.UserName; //请假人员 obj.Reason = cue.Reason; //请假原因 obj.ReviewUser = cue.ReviewUser; //审批人 return(new { Code = 0, Count = 1, Info = "获取数据成功", data = obj }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
public void FillConferenceEntityWithDto(ConferenceDto dto, ConferenceEntity entity) { FillEventEntityWithDto(dto, entity); entity.BadgeCosts = dto.BadgeCosts; entity.CateringCosts = dto.CateringCosts; }
public ActionResult ExportQD(string keyValue) { //获取会议基本信息 ConferenceEntity cr = conferencebll.GetEntity(keyValue); ////获取会议签到人员信息 //List<Object> data = conferenceuserbll.GetSignTable(keyValue); ////签到 //List<Object> dataQD = data[0] as List<Object>; ////未签到 //List<Object> dataWQD = data[1] as List<Object>; ////请假 //List<Object> dataQ = data[2] as List<Object>; string path = Request.PhysicalApplicationPath; int index = 0; string fileName = HttpUtility.UrlDecode("安全会议签到") + DateTime.Now.ToString("yyyyMMddHHmm") + ".xls"; //定义导出文件名,一定记得编码 try { Aspose.Cells.Workbook wk = new Aspose.Cells.Workbook(); wk.Open(Server.MapPath("~/Resource/ExcelTemplate/安全会议签到表模板.xlsx")); //加载模板 Aspose.Cells.Worksheet sheet = wk.Worksheets[0]; Aspose.Cells.Style style = wk.Styles[wk.Styles.Add()]; style.HorizontalAlignment = Aspose.Cells.TextAlignmentType.Center; //文字居中 style.IsTextWrapped = true; //自动换行 style.Borders[Aspose.Cells.BorderType.TopBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.RightBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.BottomBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; style.Borders[Aspose.Cells.BorderType.LeftBorder].LineStyle = Aspose.Cells.CellBorderType.Thin; string sql = string.Format(" select t.USERNAME,o.DEPTNAME,t.PHOTOURL,t.issign,t.REVIEWSTATE from BIS_ConferenceUser t left join v_userinfo o on t.userid=o.userid where t.ConferenceID='{0}'", keyValue); DataTable dt = specialequipmentbll.SelectData(sql); //参会人员集合 var listC = dt; //签到人员集合 var SdUser = listC.Select(" issign='0'"); //未签到人员集合 var YdUser = listC.Select(" issign<>'0' and REVIEWSTATE<>'2'"); //请假人数 var QUser = listC.Select(" REVIEWSTATE='2'"); sheet.Cells[1, 2].PutValue(cr.ConferenceName); //会议名称 sheet.Cells[1, 4].PutValue(cr.Locale); //会议地点 sheet.Cells[2, 2].PutValue(cr.CompereDept); //召开部门 sheet.Cells[2, 4].PutValue(cr.Compere); //主持人 sheet.Cells[3, 2].PutValue(cr.Content); //主要议题 if (SdUser.Length == 0) { sheet.Cells[5, 1].PutValue("无"); } else { sheet.Cells[5 + SdUser.Length, 0].PutValue("已签到人数"); sheet.Cells.Merge(5, 0, SdUser.Length, 1); foreach (DataRow item in SdUser) { index++; sheet.Cells[4 + index, 1].PutValue(index); sheet.Cells[4 + index, 2].PutValue(item[0].ToString()); //参会人员 sheet.Cells[4 + index, 4].PutValue(item[1].ToString()); //所属部门 if (!string.IsNullOrEmpty(item[2].ToString())) { string[] u = item[2].ToString().Split('/'); string url = path + "/" + u[1] + "/" + u[2] + "/" + u[3] + "/" + u[4] + "/" + u[5];//签名 FileStream fs = new FileStream(url, FileMode.Open); int imgIndex = sheet.Pictures.Add(4 + index, 3, fs, 120, 30); fs.Close(); sheet.Cells.SetColumnWidth(5, 20); sheet.Cells.SetRowHeight(4 + index, 44); sheet.Pictures[imgIndex].Width = 139; sheet.Pictures[imgIndex].Height = 50; sheet.Pictures[imgIndex].Top = 3; sheet.Pictures[imgIndex].Left = 6; } } } int num = SdUser.Length == 0 ? 1 : SdUser.Length; int s = SdUser.Length == 0 ? 1 : SdUser.Length; if (index > 0) { s = 0; } if (YdUser.Length == 0) { sheet.Cells[5 + num, 0].PutValue("未签到人数"); sheet.Cells[5 + num, 1].PutValue("无"); } else { sheet.Cells[5 + num, 0].PutValue("未签到人数"); sheet.Cells.Merge(5 + num, 0, YdUser.Length, 1); foreach (DataRow item in YdUser) { index++; sheet.Cells[4 + s + index, 1].PutValue(index); sheet.Cells[4 + s + index, 2].PutValue(item[0].ToString()); sheet.Cells[4 + s + index, 4].PutValue(item[1].ToString()); sheet.Cells[4 + s + index, 3].PutValue(""); } } s = YdUser.Length == 0 ? 1 : YdUser.Length; int qj = s + SdUser.Length == 0 ? 1 : s + SdUser.Length; qj = SdUser.Length == 0 ? qj + 1 : qj; int qjNum = 0; if (QUser.Length > 0) { sheet.Cells[5 + qj, 0].PutValue("请假人数"); sheet.Cells.Merge(5 + qj, 0, QUser.Length, 1); foreach (DataRow dr in QUser) { sheet.Cells[5 + qj + qjNum, 1].PutValue(index++ + 1); sheet.Cells[5 + qj + qjNum, 2].PutValue(dr[0].ToString()); sheet.Cells[5 + qj + qjNum, 4].PutValue(dr[1].ToString()); sheet.Cells[5 + qj + qjNum, 3].PutValue(""); qjNum++; } } else { qjNum += 1; sheet.Cells[5 + qj, 0].PutValue("请假人数"); sheet.Cells[5 + qj, 1].PutValue("无"); } Aspose.Cells.Range r = sheet.Cells.CreateRange(5, 0, qj + qjNum, 5); r.Style = style; HttpResponse resp = System.Web.HttpContext.Current.Response; wk.Save(HttpUtility.UrlEncode(fileName), Aspose.Cells.FileFormatType.Excel2003, Aspose.Cells.SaveType.OpenInExcel, resp); return(ToJsonResult("0")); } catch (Exception ex) { string env = Config.GetValue("Environment"); string msg = env == "dev" ? ex.Message : "对不起,系统出错了"; return(ToJsonResult("" + msg + "")); } }
public ActionResult SaveForm(string keyValue, ConferenceEntity entity) { conferencebll.SaveForm(keyValue, entity); return(Success("操作成功。")); }