public object GetData(string userid, string caseId, string baid, string actid) { try { if (!String.IsNullOrEmpty(actid)) { //只有待办箱才有设置为已读 if (!String.IsNullOrEmpty(baid)) engineAPI.SetIsReaded(caseId, baid, userid); } var data = new GetDataModel(); // 一个会议有多个议程 #region 会议信息 B_OA_ConferenceMain en = new B_OA_ConferenceMain(); en.Condition.Add("workflowcaseid = " + caseId); data.baseInfo = Utility.Database.QueryObject<B_OA_ConferenceMain>(en); //新建 if (data.baseInfo == null) { var baseInfo = new B_OA_ConferenceMain(); //var userInfo = ComClass.GetUserInfo(userid); data.baseInfo = baseInfo; } #endregion #region 议程信息列表 if (data.baseInfo != null) { B_OA_Conf_Agenda agendaEnt = new B_OA_Conf_Agenda(); agendaEnt.Condition.Add("workflowcaseid=" + data.baseInfo.workflowcaseid); data.agendaList = Utility.Database.QueryList<B_OA_Conf_Agenda>(agendaEnt); } #endregion #region 编辑行议程信息 if (data.baseInfo != null) { data.agendaListDetail = new B_OA_Conf_Agenda(); data.agendaListDetail.workflowcaseid = data.baseInfo.workflowcaseid; } #endregion return data; } catch (Exception ex) { ComBase.Logger(ex); throw (new Exception("获取数据失败!", ex)); } }
/// <summary> /// 创建一个Word数据 /// </summary> /// <param name="caseid"></param> /// <returns></returns> private Dictionary<string, Object> CreateWordConferenceMainData(string caseid) { B_OA_ConferenceMain boacm = new B_OA_ConferenceMain(); boacm.Condition.Add("workflowcaseid=" + caseid);//设置查询条件 boacm = Utility.Database.QueryObject<B_OA_ConferenceMain>(boacm); List<B_OA_Conf_Agenda> boacaList = new List<B_OA_Conf_Agenda>(); B_OA_Conf_Agenda ent = new B_OA_Conf_Agenda(); ent.Condition.Add("workflowcaseid=" + caseid);//设置查询条件 boacaList = Utility.Database.QueryList<B_OA_Conf_Agenda>(ent); // 发文s Dictionary<string, Object> dict = new Dictionary<string, Object>(); dict.Add("sqr", boacm.sqr);//申请人 dict.Add("hysid", boacm.hysid);//申请场地 会议室ID dict.Add("sqrq", boacm.sqrq);//申请日期 dict.Add("xsysb", boacm.xsysb);//申请设备 dict.Add("zksj", boacm.zksj);//召开时间 dict.Add("zcr", boacm.zcr);//主持人 dict.Add("cyry", boacm.cyry);//参加人员 dict.Add("hyzt", boacm.hyzt);//会议主题 for (int i = 0; i < boacaList.Count; i++) { dict.Add("kssj" + i.ToString(), (boacaList[i] == null) ? "" : Convert.ToDateTime(boacaList[i].kssj).ToString("yyyy-MM-dd HH:mm")); dict.Add("jssj" + i.ToString(), (boacaList[i] == null) ? "" : Convert.ToDateTime(boacaList[i].jssj).ToString("yyyy-MM-dd HH:mm")); dict.Add("fyr" + i.ToString(), (boacaList[i] == null) ? "" : boacaList[i].fyr); dict.Add("ycnr" + i.ToString(), (boacaList[i] == null) ? "" : boacaList[i].ycnr); } //for (int i = 0; i < wfbaList.Count; i++) //{ // switch (wfbaList[i].BAID.ToString()) // { // case "BA001": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA002": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA003": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA004": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA005": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA006": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA007": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA008": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA009": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // case "BA010": // dict.Add("Remark" + wfbaList[i].BAID.ToString(), (wfbaList[i] == null) ? "" : wfbaList[i].Remark);// 意见 // break; // } //} return dict; }
////保存 //[DataAction("save", "BizParams", "userid", "content")] //public string Save(string BizParams, string userid, string content) //{ // SkyLandDeveloper developer = new SkyLandDeveloper(BizParams, userid, tran); // IDbTransaction tran = Utility.Database.BeginDbTransaction(); // try // { // SaveDataModel data = JsonConvert.DeserializeObject<SaveDataModel>(content); // string caseid = developer.Create(); // SaveData(data, tran, caseid); // SetCaseName(data, developer); // developer.Commit(); // var retContent = GetData(userid, caseid, developer.baid); // return JsonConvert.SerializeObject( retContent); // } // catch (Exception ex) // { // developer.RollBack(); // ComBase.Logger(ex); // return Utility.JsonMsg(false, "保存失败:" + ex.Message.Replace(":", " ")); // } //} //保存数据 public void SaveData(SaveDataModel data, IDbTransaction tran, string caseId) { try { if (null != caseId) data.baseInfo.workflowcaseid = caseId; data.baseInfo.Condition.Add("workflowcaseid=" + data.baseInfo.workflowcaseid); B_OA_ConferenceMain en = Utility.Database.QueryObject<B_OA_ConferenceMain>(data.baseInfo); //更新或插入主业务信息 if (Utility.Database.Update<B_OA_ConferenceMain>(data.baseInfo, tran) < 1) { Utility.Database.Insert<B_OA_ConferenceMain>(data.baseInfo, tran); } #region 基础操作 #region 新增与修改操作 var updateCol = data.agendaList.data; var delete = data.agendaList.deleteList; foreach (var updateItem in updateCol) { updateItem.Condition.Clear(); if (updateItem.id == null)// 新增 { // updateItem.id = 0;// 这里的主键是自增的 updateItem.workflowcaseid = data.baseInfo.workflowcaseid;// 外键 Utility.Database.Insert(updateItem, tran); } else// 更新 { updateItem.Condition.Add("id=" + updateItem.id); Utility.Database.Update(updateItem, tran); } } #endregion #region 删除操作 var delCol = string.IsNullOrWhiteSpace(delete) ? null : delete.Split(';'); if (delCol != null) { foreach (var delItem in delCol) { if (!string.IsNullOrWhiteSpace(delItem)) { var delEnt = new B_OA_Conf_Agenda();// 实例化一个对象 delEnt.Condition.Add("id=" + delItem);// 删除条件(要主键) Utility.Database.Delete(delEnt, tran);// 删除 } } } #endregion #endregion } catch (Exception e) { ComBase.Logger(e); throw e; } }