/// <summary> /// 获取备注附件相关信息,在页面上显示 /// </summary> private void GetNoteAtt(HttpContext context, long note_id) { var attList = new com_attachment_dal().GetAttListByOid(note_id); if (attList != null && attList.Count > 0) { context.Response.Write(new Tools.Serialize().SerializeJson(attList)); } }
/// <summary> /// 知识库附件管理 /// </summary> public void KnowAttManage(long artId, string attIds, List <AddFileDto> filtList, long userId) { var caDal = new com_attachment_dal(); #region 修改原附件 var oldAttList = new com_attachment_dal().GetAttListByOid(artId); if (oldAttList != null && oldAttList.Count > 0) { var attIdList = attIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var oldAtt in oldAttList) { if (!attIdList.Any(_ => _ == oldAtt.id.ToString())) { caDal.SoftDelete(oldAtt, userId); OperLogBLL.OperLogDelete <com_attachment>(oldAtt, oldAtt.id, userId, OPER_LOG_OBJ_CATE.ATTACHMENT, "删除备注附件"); } } } #endregion #region 新增附件 if (filtList != null && filtList.Count > 0) { var attBll = new AttachmentBLL(); foreach (var thisFile in filtList) { if (thisFile.type_id == ((int)DicEnum.ATTACHMENT_TYPE.ATTACHMENT).ToString()) { attBll.AddAttachment((int)ATTACHMENT_OBJECT_TYPE.KNOWLEDGE, artId, (int)DicEnum.ATTACHMENT_TYPE.ATTACHMENT, thisFile.new_filename, "", thisFile.old_filename, thisFile.fileSaveName, thisFile.conType, thisFile.Size, userId); } else { attBll.AddAttachment((int)ATTACHMENT_OBJECT_TYPE.KNOWLEDGE, artId, int.Parse(thisFile.type_id), thisFile.new_filename, thisFile.old_filename, null, null, null, 0, userId); } } } #endregion }
protected void Page_Load(object sender, EventArgs e) { try { var id = Request.QueryString["id"]; thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(id)); if (thisTask != null && thisTask.project_id != null) { thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId); tvbDto.Add(new DictionaryEntryDto("type", "类型", 0)); tvbDto.Add(new DictionaryEntryDto("time", "操作时间", 0)); tvbDto.Add(new DictionaryEntryDto("resouName", "员工", 0)); tvbDto.Add(new DictionaryEntryDto("workHours", "实际工作时间", 0)); tvbDto.Add(new DictionaryEntryDto("notTiltle", "说明/标题", 0)); tvbDto.Add(new DictionaryEntryDto("billabled", "是否计费", 0)); tvbDto.Add(new DictionaryEntryDto("billed", "已计费", 0)); expDto.Add(new DictionaryEntryDto("type_id", "类型", 0)); expDto.Add(new DictionaryEntryDto("add_date", "费用日期", 0)); expDto.Add(new DictionaryEntryDto("create_user_id", "创建人", 0)); expDto.Add(new DictionaryEntryDto("expense_cost_code_id", "费用类别", 0)); expDto.Add(new DictionaryEntryDto("amount", "总额", 0)); expDto.Add(new DictionaryEntryDto("is_billable", "计费的", 0)); expDto.Add(new DictionaryEntryDto("approve_and_post_user_id", "已计费", 0)); v_task = new v_task_all_dal().FindById(thisTask.id); if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_ISSUE) { taskType = "问题"; } else if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_TASK) { taskType = "任务"; } else { Response.End(); } #region 记录浏览历史 var account = new CompanyBLL().GetCompany(thisTask.account_id); var history = new sys_windows_history() { title = $"查看{taskType}:" + (thisProject != null ? thisProject.name : "") + " " + thisTask.title + " " + (account != null ? account.name : ""), url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); #endregion thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id); if (thisProject != null) { thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id); if (thisProject.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id); } } thisTaskResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTask.id); var roleList = dic.FirstOrDefault(_ => _.Key == "role").Value as List <sys_role>; var sysList = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>; #region 工时备注附件 var tasEntryList = new sdk_work_entry_dal().GetByTaskId(thisTask.id); if (tasEntryList != null && tasEntryList.Count > 0) { var newList = (from a in tasEntryList join b in roleList on a.role_id equals b.id join c in sysList on a.resource_id equals long.Parse(c.val) select new TaskViewDto { id = a.id, type = "entry", time = Tools.Date.DateHelper.ConvertStringToDateTime((long)(a.end_time ?? a.start_time)), resouName = c.show + "(" + b.name + ")", workHours = a.hours_worked, notTiltle = a.summary_notes, billabled = a.is_billable == 1?"✓":"", billed = a.approve_and_post_date == null?"": "✓", startDate = Tools.Date.DateHelper.ConvertStringToDateTime((long)a.start_time), workTypeId = a.cost_code_id, contractId = a.contract_id, showOnInv = a.show_on_invoice == 1, serviceId = a.service_id }).ToList(); tvdList.AddRange(newList); } var conAttDal = new com_attachment_dal(); var allTaskAttList = new List <com_attachment>(); var taskNoteList = new com_activity_dal().GetActiList($" and (task_id ={thisTask.id} or object_id={thisTask.id} )"); if (taskNoteList != null && taskNoteList.Count > 0) { var newList = (from a in taskNoteList join c in sysList on a.resource_id equals long.Parse(c.val) into temp from tt in temp.DefaultIfEmpty() select new TaskViewDto { id = a.id, type = "note", time = Tools.Date.DateHelper.ConvertStringToDateTime(a.create_time), resouName = tt == null ? "" : tt.show, notTiltle = a.name, noteDescr = a.description }).ToList(); tvdList.AddRange(newList); foreach (var thisTaskNote in taskNoteList) { var thisNoteAttList = conAttDal.GetAttListByOid(thisTaskNote.id); if (thisNoteAttList != null && thisNoteAttList.Count > 0) { allTaskAttList.AddRange(thisNoteAttList); } } } var taskAttList = conAttDal.GetAttListByOid(thisTask.id); if (taskAttList != null && taskAttList.Count > 0) { allTaskAttList.AddRange(taskAttList); } if (allTaskAttList.Count > 0) { var newList = (from a in allTaskAttList join c in sysList on a.create_user_id equals long.Parse(c.val) into temp from tt in temp.DefaultIfEmpty() select new TaskViewDto { id = a.id, type = "atach", time = Tools.Date.DateHelper.ConvertStringToDateTime(a.create_time), resouName = tt == null?"":tt.show, notTiltle = a.title, fileType = a.type_id }).ToList(); tvdList.AddRange(newList); } if (tvdList != null && tvdList.Count > 0) { tvbOrder = Request.QueryString["tvbOrder"]; tvdList = tvdList.OrderBy(_ => _.time).ToList(); if (!string.IsNullOrEmpty(tvbOrder)) { var tvbOrderArr = tvbOrder.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); var orderFile = tvbDto.FirstOrDefault(_ => _.val == tvbOrderArr[0]); if (tvbOrderArr[1] == "desc") { //tvdList = (from a in tvdList // orderby tvbOrderArr[0] descending // select a).ToList(); tvdList.Sort(delegate(TaskViewDto t1, TaskViewDto t2) { return(GetObjectPropertyValue(t2, tvbOrderArr[0]).CompareTo(GetObjectPropertyValue(t1, tvbOrderArr[0]))); }); orderFile.select = orderFile != null ? 2 : orderFile.select; } else { //tvdList = (from a in tvdList // orderby tvbOrderArr[0] // select a).ToList(); tvdList.Sort(delegate(TaskViewDto t1, TaskViewDto t2) { return(GetObjectPropertyValue(t1, tvbOrderArr[0]).CompareTo(GetObjectPropertyValue(t2, tvbOrderArr[0]))); }); orderFile.select = orderFile != null ? 1 : orderFile.select; } } } #endregion #region 费用 taskExpList = new sdk_expense_dal().GetExpByTaskId(thisTask.id); if (taskExpList != null && taskExpList.Count > 0) { taskExpList = taskExpList.OrderByDescending(_ => _.add_date).ToList(); expOrder = Request.QueryString["expOrder"]; if (!string.IsNullOrEmpty(expOrder)) { var expOrderArr = expOrder.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var orderFile = expDto.FirstOrDefault(_ => _.val == expOrderArr[0]); if (expOrderArr[1] == "desc") { //taskExpList = (from a in taskExpList // orderby expOrderArr[0] descending // select a).ToList(); taskExpList.Sort(delegate(sdk_expense t1, sdk_expense t2) { return(GetObjectPropertyValue(t2, expOrderArr[0]).CompareTo(GetObjectPropertyValue(t1, expOrderArr[0]))); }); orderFile.select = orderFile != null ? 2 : orderFile.select; } else { //taskExpList = (from a in taskExpList // orderby expOrderArr[0] // select a).ToList(); taskExpList.Sort(delegate(sdk_expense t1, sdk_expense t2) { return(GetObjectPropertyValue(t1, expOrderArr[0]).CompareTo(GetObjectPropertyValue(t2, expOrderArr[0]))); }); orderFile.select = orderFile != null ? 1 : orderFile.select; } } } #endregion } else { Response.End(); } } catch (Exception msg) { Response.End(); } }