/// <summary> /// 关联前的检查 /// </summary> /// <param name="context"></param> private void CheckRelaTicket(HttpContext context) { var ticketId = context.Request.QueryString["ticket_id"]; var relaTicketId = context.Request.QueryString["rela_ticket_ids"]; bool isDiffCompany = false; bool isHasPro = false; bool isSginInd = false; // 是否关联事故 // if (!string.IsNullOrEmpty(ticketId) && !string.IsNullOrEmpty(relaTicketId)) var stDal = new sdk_task_dal(); var relList = stDal.GetTicketByIds(relaTicketId); var thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId)); if (relList != null && relList.Count > 0 && thisTicket != null) { if (relList.Any(_ => _.account_id != thisTicket.account_id)) { isDiffCompany = true; } if (relList.Any(_ => _.problem_ticket_id != null)) { isHasPro = true; } if (relList.Any(_ => _.ticket_type_id == (int)DTO.DicEnum.TICKET_TYPE.PROBLEM && stDal.GetProCount(_.id) != 0)) { isSginInd = true; } } context.Response.Write(new EMT.Tools.Serialize().SerializeJson(new { diffAcc = isDiffCompany, isHasPro = isHasPro, isSginInd = isSginInd, })); }
protected void Page_Load(object sender, EventArgs e) { try { var ticketIds = Request.QueryString["ticketIds"]; var sdDal = new sdk_task_dal(); if (!string.IsNullOrEmpty(ticketIds)) { ticketList = sdDal.GetTicketByIds(ticketIds); } if (ticketList != null && ticketList.Count > 0) { if (ticketList.Count == 1) { isSingle = true; } else { isSingle = false; } thisTicket = ticketList[0]; } else { Response.Write("<script>alert('未查询到相关工单信息!');window.close();</script>"); return; } var udfBLL = new UserDefinedFieldsBLL(); if (thisTicket == null) { Response.Write("<script>alert('未查询到相关工单信息!');window.close();</script>"); } else { thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); thisUser = new sys_resource_dal().FindNoDeleteById(LoginUserId); #region 获取相关属性是否可以更改 if (ticketList.Any(_ => _.id != thisTicket.id)) { isManyTitle = true; } else { isManyTitle = false; } if (ticketList.Any(_ => _.id != thisTicket.id)) { isManydesc = true; } else { isManydesc = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.department_id != thisTicket.department_id)) { isManyDep = true; } else { isManyDep = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.issue_type_id != thisTicket.issue_type_id)) { isManyissType = true; } else { isManyissType = false; } if (ticketList.Any(_ => _.id != thisTicket.id && (_.owner_resource_id != thisTicket.owner_resource_id && _.role_id != thisTicket.role_id))) { isManyPri = true; } else { isManyPri = false; if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { thisPriRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); thisRole = new sys_role_dal().FindNoDeleteById((long)thisTicket.role_id); var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)thisTicket.owner_resource_id, (long)thisTicket.role_id); if (resDepList != null && resDepList.Count > 0) { proResDep = resDepList[0]; } } } if (ticketList.Any(_ => _.id != thisTicket.id && _.cate_id != thisTicket.cate_id)) { isManyTicketCate = true; } else { isManyTicketCate = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.estimated_hours != thisTicket.estimated_hours)) { isManyEstHour = true; } else { isManyEstHour = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.estimated_end_time != thisTicket.estimated_end_time)) { isManyDueTime = true; } else { isManyDueTime = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.account_id != thisTicket.account_id)) { isManyAccount = true; } else { isManyAccount = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.contract_id != thisTicket.contract_id)) { isManyContract = true; } else { isManyContract = false; if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } } if (ticketList.Any(_ => _.id != thisTicket.id && _.status_id != thisTicket.status_id)) { isManyStatus = true; } else { isManyStatus = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.service_id != thisTicket.service_id)) { isManySerivce = true; } else { isManySerivce = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.priority_type_id != thisTicket.priority_type_id)) { isManyPrio = true; } else { isManyPrio = false; } if (ticketList.Any(_ => _.id != thisTicket.id && _.cost_code_id != thisTicket.cost_code_id)) { isManyWork = true; } else { isManyWork = false; if (thisTicket.cost_code_id != null) { thisWorkType = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } } if (ticketList.Any(_ => _.id != thisTicket.id && _.sub_issue_type_id != thisTicket.sub_issue_type_id)) { isManySubIssType = true; } else { isManySubIssType = false; } // protected bool isManyStatus; #endregion udfValue = udfBLL.GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, udfTaskPara); if (udfTaskPara != null && udfTaskPara.Count > 0) { foreach (var udfTask in udfTaskPara) { var thisValue = ""; if (udfValue.FirstOrDefault(_ => _.id == udfTask.id) != null) { thisValue = udfValue.FirstOrDefault(_ => _.id == udfTask.id).value.ToString(); } var count = new UserDefinedFieldsBLL().GetSameValueCount(DicEnum.UDF_CATE.TASK, ticketIds, udfTask.col_name, thisValue.ToString()); if (count > 1 && (!isSingle)) { udfValue.FirstOrDefault(_ => _.id == udfTask.id).value = "多个值-保持不变"; } } } var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id); if (otherResList != null && otherResList.Count > 0) { foreach (var item in otherResList) { if (item.resource_id != null && item.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)item.resource_id, (long)item.role_id); if (resDepList != null && resDepList.Count > 0) { ticketResIds += resDepList[0].id + ","; } } } if (ticketResIds != "") { ticketResIds = ticketResIds.Substring(0, ticketResIds.Length - 1); } } } if (IsPostBack) { var stDal = new sdk_task_dal(); var ticBll = new TicketBLL(); var accBll = new CompanyBLL(); var notiResIds = new System.Text.StringBuilder(); foreach (var tic in ticketList) { var ticket = stDal.FindNoDeleteById(tic.id); if (ticket == null) { continue; } var user = UserInfoBLL.GetUserInfo(LoginUserId); #region 获取相关参数 #region 标题,描述,队列,主负责人 var pageTitle = ticket.title; if (!isManyTitle) { pageTitle = Request.Form["title"]; } var pageDesc = ticket.description; if (!isManydesc) { pageDesc = Request.Form["description"]; } var pageDepIdString = Request.Form["department_id"]; var pagePriResIdString = Request.Form["pri_res"]; if (string.IsNullOrEmpty(pageDepIdString) && string.IsNullOrEmpty(pagePriResIdString)) { Response.Write("<script>alert('队列和主负责人请填写其中一项!');</script>"); return; } long?pageDepId; if (!string.IsNullOrEmpty(pageDepIdString) && pageDepIdString != "0") { pageDepId = long.Parse(pageDepIdString); } else if (string.IsNullOrEmpty(pageDepIdString)) { pageDepId = null; } else { pageDepId = ticket.department_id; } long?pagePriResId; if (!string.IsNullOrEmpty(pagePriResIdString) && pagePriResIdString != "0") { pagePriResId = long.Parse(pagePriResIdString); } else if (string.IsNullOrEmpty(pagePriResIdString)) { pagePriResId = null; } else { pagePriResId = ticket.owner_resource_id; } #endregion #region 种类,预估时间,到期时间,合同名称 var pageCateId = ticket.cate_id; var pageCateIdString = Request.Form["ticket_cate"]; if (!string.IsNullOrEmpty(pageCateIdString) && pageCateIdString != "0") { pageCateId = int.Parse(pageCateIdString); } else if (string.IsNullOrEmpty(pagePriResIdString)) { Response.Write("<script>alert('请选择工单种类!');</script>"); return; } else { pageCateId = ticket.cate_id; } var estHours = ticket.estimated_hours; var pageEstHours = Request.Form["est_hours"]; if (!string.IsNullOrEmpty(pageEstHours) && pageEstHours.Trim() != "多个值-保持不变") { estHours = decimal.Parse(pageEstHours); } var dueTime = ticket.estimated_end_time; var pageDueTime = Request.Form["due_time"]; if (!string.IsNullOrEmpty(pageDueTime) && pageDueTime.Trim() != "多个值-保持不变") { dueTime = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(pageDueTime)); } var contractName = ticket.contract_id; var pageContract = Request.Form["contractName"]; if (!string.IsNullOrEmpty(pageContract) && pageContract != "0") { contractName = long.Parse(pageContract); } else if (string.IsNullOrEmpty(pageContract)) { contractName = null; } #endregion #region 状态,服务包,优先级,工作类型,问题类型,子问题类型 var pageStatusId = ticket.status_id; var pageStuatusIdString = Request.Form["statusId"]; if (!string.IsNullOrEmpty(pageStuatusIdString) && pageStuatusIdString != "0") { pageStatusId = int.Parse(pageStuatusIdString); } else if (string.IsNullOrEmpty(pageStuatusIdString)) { Response.Write("<script>alert('请选择工单状态!');</script>"); return; } var pageServiceId = ticket.service_id; var pageServiceIdString = Request.Form["serviceId"]; if (!string.IsNullOrEmpty(pageServiceIdString) && pageServiceIdString != "0") { pageServiceId = int.Parse(pageServiceIdString); } else if (string.IsNullOrEmpty(pageServiceIdString)) { pageServiceId = null; } var pagePrioId = ticket.priority_type_id; var pagePrioIdString = Request.Form["priorityId"]; if (!string.IsNullOrEmpty(pagePrioIdString) && pagePrioIdString != "0") { pagePrioId = int.Parse(pagePrioIdString); } else if (string.IsNullOrEmpty(pagePrioIdString)) { Response.Write("<script>alert('请选择工单优先级!');</script>"); return; } var workTypeId = ticket.cost_code_id; var pageWorkTypeId = Request.Form["workTypeId"]; if (!string.IsNullOrEmpty(pageWorkTypeId) && pageWorkTypeId != "0") { workTypeId = long.Parse(pageWorkTypeId); } else if (string.IsNullOrEmpty(pageWorkTypeId)) { contractName = null; } var pageIssId = ticket.issue_type_id; var pageIssIdString = Request.Form["IssueType"]; if (!string.IsNullOrEmpty(pageIssIdString) && pageIssIdString != "0") { pageIssId = int.Parse(pageIssIdString); } else if (string.IsNullOrEmpty(pageIssIdString)) { Response.Write("<script>alert('请选择问题类型!');</script>"); return; } var pageSubIssId = ticket.sub_issue_type_id; var pageSubIssIdString = Request.Form["SubIssueType"]; if (!string.IsNullOrEmpty(pageSubIssIdString) && pageSubIssIdString != "0") { pageSubIssId = int.Parse(pageSubIssIdString); } else if (string.IsNullOrEmpty(pageSubIssIdString)) { Response.Write("<script>alert('请选择子问题类型!');</script>"); return; } #endregion #region 自定义字段相关 var thisUdfValue = udfBLL.GetUdfValue(DicEnum.UDF_CATE.TASK, tic.id, udfTaskPara); if (udfTaskPara != null && udfTaskPara.Count > 0) { var list = new List <UserDefinedFieldValue>(); foreach (var udf in udfTaskPara) { var new_udf = new UserDefinedFieldValue() { id = udf.id }; var thisvv = Request.Form[udf.id.ToString()]; if (udf.data_type == (int)DicEnum.UDF_DATA_TYPE.LIST) { if (thisvv == "0") { new_udf.value = thisUdfValue.FirstOrDefault(_ => _.id == udf.id) == null ? "" : thisUdfValue.FirstOrDefault(_ => _.id == udf.id).value; } else { new_udf.value = thisvv == "" ? null : thisvv; } } else { if (thisvv == "多个值-保持不变") { new_udf.value = thisUdfValue.FirstOrDefault(_ => _.id == udf.id) == null ? "" : thisUdfValue.FirstOrDefault(_ => _.id == udf.id).value; } else { new_udf.value = thisvv == "" ? null : thisvv; } } list.Add(new_udf); } udfBLL.UpdateUdfValue(DicEnum.UDF_CATE.TASK, udfTaskPara, ticket.id, list, user, DicEnum.OPER_LOG_OBJ_CATE.PROJECT_TASK); } #endregion #endregion #region 修改工单 ticket.title = pageTitle; ticket.description = pageDesc; ticket.department_id = pageDepId; long?roleId = null; if (pagePriResId != null) { var resDep = new sys_resource_department_dal().FindById((long)pagePriResId); if (resDep != null) { pagePriResId = resDep.resource_id; roleId = resDep.role_id; } else { pagePriResId = null; roleId = null; } } ticket.owner_resource_id = pagePriResId; ticket.role_id = roleId; ticket.cate_id = pageCateId; ticket.estimated_hours = estHours; ticket.estimated_end_time = dueTime; ticket.contract_id = contractName; ticket.status_id = pageStatusId; ticket.service_id = pageServiceId; ticket.priority_type_id = pagePrioId; ticket.cost_code_id = workTypeId; ticket.issue_type_id = pageIssId; ticket.sub_issue_type_id = pageSubIssId; ticBll.EditTicket(ticket, LoginUserId); #endregion #region 生成备注 ticBll.AddModifyTicketNote(ticket.id, LoginUserId); #endregion #region 单个工单时 修改其他员工相关 if (isSingle) { var OtherResId = Request.Form["OtherResId"]; ticBll.TicketResManage(ticket.id, OtherResId, LoginUserId); } #endregion #region 获取需要发送邮件的员工的Id if (CkPriRes.Checked && ticket.owner_resource_id != null) { notiResIds.Append(ticket.owner_resource_id + ","); } if (CKcreate.Checked) { notiResIds.Append(ticket.create_user_id + ","); } if (CKaccMan.Checked) { var thisAccount = accBll.GetCompany(ticket.account_id); if (thisAccount != null && thisAccount.resource_id != null) { notiResIds.Append(thisAccount.resource_id + ","); } } #endregion } #region 通知相关 if (CCMe.Checked) { notiResIds.Append(LoginUserId + ","); } var resIds = Request.Form["resIds"]; if (!string.IsNullOrEmpty(resIds)) { notiResIds.Append(resIds + ","); } var notify_id = Request.Form["notify_id"]; if (!string.IsNullOrEmpty(notify_id) && notify_id != "0") { } #endregion ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('保存成功');self.opener.location.reload();window.close();</script>"); } } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "!');window.close();</script>"); } }
protected bool isFromReport = false; // 是否从报表页面进行新增操作 protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { PageDataBind(); } isShowWorkType = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_EXPENSE_SHOW_WORK_TYPE) == "1";// SDK_EXPENSE_SHOW_WORK_TYPE var seDal = new sdk_expense_dal(); var stDal = new sdk_task_dal(); var eId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(eId)) { thisExpense = seDal.FindNoDeleteById(long.Parse(eId)); if (thisExpense != null) { if (thisExpense.approve_and_post_date != null || thisExpense.approve_and_post_user_id != null) { Response.Write("<script>alert('审批提交的费用不可以更改!')window.close();</script>"); Response.End(); } if (!new TaskBLL().CanEditExpense(thisExpense.id)) { Response.Write("<script>alert('相关报表状态已经更改,不可以进行编辑!');window.close();</script>"); Response.End(); } isAdd = false; if (!IsPostBack) { if (thisExpense.cost_code_id != null) { cost_code_id.SelectedValue = thisExpense.cost_code_id.ToString(); } expense_cost_code_id.SelectedValue = thisExpense.expense_cost_code_id.ToString(); RDAddExiRep.Checked = true; isBillable.Checked = thisExpense.is_billable == 1; payment_type_id.SelectedValue = thisExpense.payment_type_id.ToString(); hasReceipt.Checked = thisExpense.has_receipt == 1; if (thisExpense.project_id != null) { rbAssProTask.Checked = true; } else { rbAssNone.Checked = true; } } if (thisExpense.project_id != null) { thisProject = new pro_project_dal().FindNoDeleteById((long)thisExpense.project_id); } if (thisExpense.project_id != null && thisExpense.task_id != null) { thisTask = new sdk_task_dal().FindNoDeleteById((long)thisExpense.task_id); } if (thisExpense.project_id == null && thisExpense.task_id != null) { thisTicket = new sdk_task_dal().FindNoDeleteById((long)thisExpense.task_id); } thisAccount = new crm_account_dal().FindNoDeleteById(thisExpense.account_id); thisExpRep = new sdk_expense_report_dal().FindNoDeleteById(thisExpense.expense_report_id); } } var task_id = Request.QueryString["task_id"]; if (!string.IsNullOrEmpty(task_id)) { thisTask = stDal.FindNoDeleteById(long.Parse(task_id)); if (thisTask != null && thisTask.project_id != null) { thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id); if (thisProject != null) { thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id); } } } var project_id = Request.QueryString["project_id"]; if (!string.IsNullOrEmpty(project_id)) { thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id)); if (thisProject != null) { thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id); } } var report_id = Request.QueryString["report_id"]; if (!string.IsNullOrEmpty(report_id)) { thisExpRep = new sdk_expense_report_dal().FindNoDeleteById(long.Parse(report_id)); if (thisExpRep != null) { isFromReport = true; thisAccount = new CompanyBLL().GetDefaultAccount(); } } var ticket_id = Request.QueryString["ticket_id"]; if (!string.IsNullOrEmpty(ticket_id)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id)); if (thisTicket != null) { thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); } } } catch (Exception msg) { Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId()); var caDal = new com_activity_dal(); var stDal = new sdk_task_dal(); var ppDal = new pro_project_dal(); var accDal = new crm_account_dal(); var ccDal = new ctt_contract_dal(); var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { thisNote = caDal.FindNoDeleteById(long.Parse(id)); if (thisNote != null) { isAdd = false; thisNoteAtt = new com_attachment_dal().GetAttListByOid(thisNote.id); thisTicket = stDal.FindNoDeleteById(thisNote.object_id); if (thisTicket != null) { object_id = thisTicket.id; } else { thisProject = ppDal.FindNoDeleteById(thisNote.object_id); if (thisProject != null) { object_id = thisProject.id; thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } else { thisContract = ccDal.FindNoDeleteById(thisNote.object_id); if (thisContract != null) { object_id = thisContract.id; thisAccount = accDal.FindNoDeleteById(thisContract.account_id); } } } } } var ticketId = Request.QueryString["ticket_id"]; if (!string.IsNullOrEmpty(ticketId)) { thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId)); } if (thisTicket != null) { object_id = thisTicket.id; if (thisTicket.type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE) { // isPhase = true; } if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } thisAccount = accDal.FindNoDeleteById(thisTicket.account_id); ticket_creator = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id); if (!IsPostBack) { //status_id.SelectedValue = thisTicket.status_id.ToString(); } if (thisTicket.project_id != null) { thisProject = ppDal.FindNoDeleteById((long)thisTicket.project_id); if (thisProject != null && thisAccount != null) { thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } } } if (thisAccount == null) { Response.End(); } else { if (thisAccount.resource_id != null) { thisAccManger = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id); } } if (!IsPostBack) { publish_type_id.DataTextField = "name"; publish_type_id.DataValueField = "id"; var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE); if (pushList != null && pushList.Count > 0) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TICKET_NOTE).ToString()).ToList(); } publish_type_id.DataSource = pushList; publish_type_id.DataBind(); status_id.DataTextField = "show"; status_id.DataValueField = "val"; status_id.DataSource = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value; status_id.DataBind(); if (thisTicket != null) { status_id.SelectedValue = thisTicket.status_id.ToString(); } action_type_id.DataTextField = "name"; action_type_id.DataValueField = "id"; var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); action_type_id.DataSource = actList; action_type_id.DataBind(); if (thisNote != null) { if (!IsPostBack) { if (thisNote.publish_type_id != null) { publish_type_id.SelectedValue = thisNote.publish_type_id.ToString(); } action_type_id.SelectedValue = thisNote.action_type_id.ToString(); } } //else //{ // if (isContract) // { // publish_type_id.SelectedValue = ((int)DicEnum.NOTE_PUBLISH_TYPE.CONTRACT_INTERNA_USER).ToString(); // } //} var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.NONE); notify_id.DataTextField = "name"; notify_id.DataValueField = "id"; notify_id.DataSource = tempList; notify_id.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { // 批量修改 // 1。多个任务 2.单个任务 try { var stDal = new sdk_task_dal(); var ppDal = new pro_project_dal(); var ids = Request.QueryString["taskIds"]; if (!string.IsNullOrEmpty(ids)) { idList = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (idList.Count() == 1) { var thisTask = stDal.FindNoDeleteById(long.Parse(idList[0])); if (thisTask != null) { if (!IsPostBack) { thisProject = ppDal.FindNoDeleteById((long)thisTask.project_id); titleValue = thisTask.title; statuValue = thisTask.status_id; priorityValue = thisTask.priority; estHoursValue = thisTask.estimated_hours; depValue = thisTask.department_id; // workTypeValue = thisTask. priResValue = thisTask.owner_resource_id; if (thisTask.is_visible_in_client_portal == 1) { if (thisTask.can_client_portal_user_complete_task == 1) { DisplayInCapYes.Checked = true; } else { DisplayInCapYesNoComplete.Checked = true; } } else { DisplayInCapNone.Checked = true; } } udfValue = new UserDefinedFieldsBLL().GetUdfValue(UDF_CATE.TASK, thisTask.id, udfTaskPara); taskList.Add(thisTask); } } else if (idList.Count() > 1) { taskList = stDal.GetTaskByIds(ids, $" and type_id in ({(int)DicEnum.TASK_TYPE.PROJECT_TASK},{(int)DicEnum.TASK_TYPE.PROJECT_ISSUE})"); if (taskList != null && taskList.Count > 0) { thisProject = ppDal.FindNoDeleteById((long)taskList[0].project_id); var firstTask = taskList[0]; taskList.Remove(firstTask); if (!IsPostBack) { udfValue = udfBLL.GetUdfValue(UDF_CATE.TASK, firstTask.id, udfTaskPara); if (udfTaskPara != null && udfTaskPara.Count > 0) { foreach (var udfTask in udfTaskPara) { var thisValue = ""; if (udfValue.FirstOrDefault(_ => _.id == udfTask.id) != null) { thisValue = udfValue.FirstOrDefault(_ => _.id == udfTask.id).value.ToString(); } var count = udfBLL.GetSameValueCount(UDF_CATE.TASK, ids, udfTask.col_name, thisValue.ToString()); if (count > 1) { udfValue.FirstOrDefault(_ => _.id == udfTask.id).value = "多个值-保持不变"; } else { } } } if (taskList.Any(_ => _.title != firstTask.title)) { titleValue = "多个值-保持不变"; } else { titleValue = firstTask.title; } if (taskList.Any(_ => _.status_id != firstTask.status_id)) { statuValue = 0; } else { statuValue = firstTask.status_id; } if (taskList.Any(_ => _.priority != firstTask.priority)) { priorityValue = null; } else { priorityValue = firstTask.priority; } #region 在页面上的显示设置 if (firstTask.is_visible_in_client_portal == 1) { if (taskList.Any(_ => _.is_visible_in_client_portal != firstTask.is_visible_in_client_portal)) { displayWayValue = "1"; } else { if (firstTask.can_client_portal_user_complete_task == 1) { if (taskList.Any(_ => _.can_client_portal_user_complete_task != firstTask.can_client_portal_user_complete_task)) { displayWayValue = "1"; } else { DisplayInCapYes.Checked = true; } } else { if (taskList.Any(_ => _.can_client_portal_user_complete_task != firstTask.can_client_portal_user_complete_task)) { displayWayValue = "1"; } else { DisplayInCapYesNoComplete.Checked = true; } } } } else { if (taskList.Any(_ => _.is_visible_in_client_portal != firstTask.is_visible_in_client_portal)) { displayWayValue = "1"; } else { DisplayInCapNone.Checked = true; } } if (!string.IsNullOrEmpty(displayWayValue)) { noChange.Checked = true; } #endregion #region 固定工作,固定时间的设置 if (taskList.Any(_ => _.estimated_type_id != firstTask.estimated_type_id)) { fixTypeValue = "1"; typeNoChange.Checked = true; } else { if (firstTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXWORK) { TaskTypeFixedWork.Checked = true; } else if (firstTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXDURATION) { TaskTypeFixedDuration.Checked = true; } } #endregion if (taskList.Any(_ => _.estimated_hours != firstTask.estimated_hours)) { estHoursValue = null; } else { estHoursValue = firstTask.estimated_hours; } if (taskList.Any(_ => _.department_id != firstTask.department_id)) { depValue = null; } else { depValue = firstTask.department_id; } if (taskList.Any(_ => _.owner_resource_id != firstTask.owner_resource_id)) { priResValue = 0; } else { priResValue = firstTask.owner_resource_id; } } } } if (!IsPostBack) { ThisPageDataBind(); } if (statuValue == 0) { status_id.Items.Insert(0, new ListItem() { Value = "0", Text = "多个选择-保持不变", Selected = true }); } else { status_id.SelectedValue = statuValue.ToString(); } if (depValue == null) { department_id.ClearSelection(); department_id.Items.Insert(0, new ListItem() { Value = "0", Text = "多个选择-保持不变", Selected = true }); } else { department_id.ClearSelection(); department_id.SelectedValue = depValue.ToString(); } } else { Response.End(); } } catch (Exception) { Response.End(); } }
protected void save_Click(object sender, EventArgs e) { var stDal = new sdk_task_dal(); var ids = Request.QueryString["taskIds"]; var thisTaskList = stDal.GetTaskByIds(ids, $" and type_id in ({(int)DicEnum.TASK_TYPE.PROJECT_TASK},{(int)DicEnum.TASK_TYPE.PROJECT_ISSUE})"); if (thisTaskList != null && thisTaskList.Count > 0) { var pageTitle = Request.Form["title"]; var pageStatu = Request.Form["status_id"]; var pagePriority = Request.Form["priority"]; var displayIsChange = noChange.Checked; var pageEstimated_hours = Request.Form["estimated_hours"]; var pageDepa = Request.Form["department_id"]; var pageRes = Request.Form["owner_resource_id"]; var user = UserInfoBLL.GetUserInfo(GetLoginUserId()); var ctaDal = new v_task_all_dal(); foreach (var thisTask in thisTaskList) { if (pageTitle != "多个值-保持不变") { if (!string.IsNullOrEmpty(pageTitle)) { thisTask.title = pageTitle; } } if (pageStatu != "0") { thisTask.status_id = int.Parse(pageStatu); } if (!string.IsNullOrEmpty(pagePriority)) { thisTask.priority = int.Parse(pagePriority); } if (!displayIsChange) // 代表页面上选择进行更改 { if (DisplayInCapNone.Checked) { thisTask.is_visible_in_client_portal = 0; } else { thisTask.is_visible_in_client_portal = 1; if (DisplayInCapYes.Checked) { thisTask.can_client_portal_user_complete_task = 1; } else if (DisplayInCapYesNoComplete.Checked) { thisTask.can_client_portal_user_complete_task = 0; } } } if (!typeNoChange.Checked) { if (TaskTypeFixedWork.Checked) { thisTask.estimated_type_id = (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXWORK; } else if (TaskTypeFixedDuration.Checked) { thisTask.estimated_type_id = (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXDURATION; } } if (!string.IsNullOrEmpty(pageEstimated_hours)) { thisTask.estimated_hours = decimal.Parse(pageEstimated_hours); var vTask = ctaDal.FindById(thisTask.id); if (vTask != null) { thisTask.projected_variance = (vTask.worked_hours == null ? 0 : (decimal)vTask.worked_hours) - (thisTask.estimated_hours + (vTask.change_Order_Hours == null ? 0 : (decimal)vTask.change_Order_Hours)) + (vTask.remain_hours == null ? 0 : (decimal)vTask.remain_hours); } } if (pageDepa != "0") { if (!string.IsNullOrEmpty(pageDepa)) { thisTask.department_id = int.Parse(pageDepa); } else { thisTask.department_id = null; } } if (pageRes != "0") { if (!string.IsNullOrEmpty(pageRes)) { thisTask.owner_resource_id = long.Parse(pageRes); } else { thisTask.owner_resource_id = null; } } OperLogBLL.OperLogUpdate <sdk_task>(thisTask, stDal.FindNoDeleteById(thisTask.id), thisTask.id, GetLoginUserId(), OPER_LOG_OBJ_CATE.PROJECT_TASK, "修改task"); stDal.Update(thisTask); var thisUdfValue = udfBLL.GetUdfValue(UDF_CATE.TASK, thisTask.id, udfTaskPara); if (udfTaskPara != null && udfTaskPara.Count > 0) // 首先判断是否有自定义信息 { var list = new List <UserDefinedFieldValue>(); foreach (var udf in udfTaskPara) // 循环添加 { var new_udf = new UserDefinedFieldValue(); // if(udf.data_type != (int)EMT.DoneNOW.DTO.DicEnum.UDF_DATA_TYPE.LIST) // todo,根据类型去取值 new_udf.id = udf.id; var thisvv = Request.Form[udf.id.ToString()]; if (thisvv == "多个值-保持不变") { new_udf.value = thisUdfValue.FirstOrDefault(_ => _.id == udf.id).value; } else { new_udf.value = thisvv == "" ? null : thisvv; } list.Add(new_udf); } udfBLL.UpdateUdfValue(UDF_CATE.TASK, udfTaskPara, thisTask.id, list, user, OPER_LOG_OBJ_CATE.PROJECT_TASK); } } } ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('保存成功!');window.close();self.opener.location.reload();</script>"); }
/// <summary> /// 知识库关联工单相关管理 /// </summary> public void KnowTicketManage(long artId, string ticketIds, long userId) { var oldArt = _dal.FindNoDeleteById(artId); if (oldArt == null) { return; } var stDal = new sdk_task_dal(); var skatDal = new sdk_kb_article_ticket_dal(); var oldTickList = skatDal.GetArtTicket(artId); var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); if (oldTickList != null && oldTickList.Count > 0) { if (!string.IsNullOrEmpty(ticketIds)) { var ticketArr = ticketIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var ticketId in ticketArr) { var thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId)); if (thisTicket == null) { continue; } var artTicket = oldTickList.FirstOrDefault(_ => _.kb_article_id == artId && _.task_id.ToString() == ticketId); if (artTicket != null) { oldTickList.Remove(artTicket); } else { artTicket = new sdk_kb_article_ticket() { id = skatDal.GetNextIdCom(), create_time = timeNow, create_user_id = userId, update_time = timeNow, update_user_id = userId, kb_article_id = artId, task_id = thisTicket.id, task_no = thisTicket.no, }; skatDal.Insert(artTicket); OperLogBLL.OperLogAdd <sdk_kb_article_ticket>(artTicket, artTicket.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE_TICKET, "新增知识库关联工单"); } } } oldTickList.ForEach(_ => { skatDal.SoftDelete(_, userId); OperLogBLL.OperLogDelete <sdk_kb_article_ticket>(_, _.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE_TICKET, "删除知识库关联工单"); }); } else { if (!string.IsNullOrEmpty(ticketIds)) { var ticketArr = ticketIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var ticketId in ticketArr) { var thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId)); if (thisTicket == null) { continue; } var artTicket = new sdk_kb_article_ticket() { id = skatDal.GetNextIdCom(), create_time = timeNow, create_user_id = userId, update_time = timeNow, update_user_id = userId, kb_article_id = artId, task_id = thisTicket.id, task_no = thisTicket.no, }; skatDal.Insert(artTicket); OperLogBLL.OperLogAdd <sdk_kb_article_ticket>(artTicket, artTicket.id, userId, OPER_LOG_OBJ_CATE.SDK_KONWLEDGE_TICKET, "新增知识库关联工单"); } } } }
protected void Page_Load(object sender, EventArgs e) { try { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); if (!IsPostBack) { ThisPageDataBind(); } task_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.TASK); var project_id = Request.QueryString["project_id"]; if (!string.IsNullOrEmpty(project_id)) { thisProject = ppdal.FindNoDeleteById(long.Parse(project_id)); } var parTaskId = Request.QueryString["par_task_id"]; if (!string.IsNullOrEmpty(parTaskId)) { parTask = sdDal.FindNoDeleteById(long.Parse(parTaskId)); if (parTask != null) { if (parTask.project_id != null) { thisProject = ppdal.FindNoDeleteById((long)parTask.project_id); } } } var typeString = Request.QueryString["type_id"]; if (!string.IsNullOrEmpty(typeString)) { type_id = int.Parse(typeString); if (!IsPostBack) { switch (type_id) { case (int)DicEnum.TASK_TYPE.PROJECT_ISSUE: isProject_issue.Checked = true; break; case (int)DicEnum.TASK_TYPE.PROJECT_TASK: isProject_issue.Checked = false; break; default: break; } } } var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { thisTask = sdDal.FindNoDeleteById(long.Parse(id)); if (thisTask != null) { if (thisTask.parent_id != null) { parTask = sdDal.FindNoDeleteById((long)thisTask.parent_id); } type_id = thisTask.type_id; isAdd = false; var isCopyString = Request.QueryString["IsCopy"]; if (!string.IsNullOrEmpty(isCopyString) && thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_TASK) { isCopy = true; } if (thisTask.project_id != null) { thisProject = ppdal.FindNoDeleteById((long)thisTask.project_id); } task_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTask.id, task_udfList); noteList = new com_activity_dal().GetActiList($" and (task_id ={thisTask.id} or object_id={thisTask.id} )"); preList = new sdk_task_predecessor_dal().GetRelList(thisTask.id); if (!IsPostBack) { status_id.SelectedValue = thisTask.status_id.ToString(); if (thisTask.is_visible_in_client_portal == 0) { DisplayInCapNone.Checked = true; } else { if (thisTask.can_client_portal_user_complete_task == 1) { DisplayInCapYes.Checked = true; } else { DisplayInCapYesNoComplete.Checked = true; } } if (thisTask.is_project_issue == 1) { isProject_issue.Checked = true; } else { isProject_issue.Checked = false; } if (thisTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXWORK) { TaskTypeFixedWork.Checked = true; } else if (thisTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXDURATION) { TaskTypeFixedDuration.Checked = true; } else { } department_id.SelectedValue = thisTask.department_id == null ? "" : ((int)thisTask.department_id).ToString(); } var typeName = "任务"; // 判断是阶段,查询出相关项目的关联合同的里程碑 和自己的里程碑 if (type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE && thisProject != null && thisProject.contract_id != null) { typeName = "阶段"; // 获取该项目合同下未被关联的里程碑 var proConMilList = new ctt_contract_milestone_dal().GetListByProId(thisProject.id); // 获取该阶段下的所有里程碑 var phaMilList = new sdk_task_milestone_dal().GetPhaMilList(thisTask.id); thisPhaMile = new List <PageMile>(); if (proConMilList != null && proConMilList.Count > 0) { thisPhaMile.AddRange(proConMilList); } if (phaMilList != null && phaMilList.Count > 0) { thisPhaMile.AddRange(phaMilList); } if (thisPhaMile.Count > 0) { thisPhaMile = thisPhaMile.OrderBy(_ => _.dueDate).ToList(); } } #region 记录浏览历史 if (!isCopy && !isAdd) { var account = new CompanyBLL().GetCompany(thisTask.account_id); var history = new sys_windows_history() { title = $"编辑{typeName}:" + (thisProject != null ? thisProject.name : "") + " " + thisTask.title + " " + (account != null ? account.name : ""), url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); } #endregion } } if (type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE) { isPhase = true; } if (thisProject == null) { Response.End(); } else { if (thisProject.contract_id != null) { thisProContract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id); rateList = new ctt_contract_rate_dal().GetRateByConId((long)thisProject.contract_id); } } } catch (Exception msg) { Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { try { thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId()); var caDal = new com_activity_dal(); var stDal = new sdk_task_dal(); var ppDal = new pro_project_dal(); var accDal = new crm_account_dal(); var ccDal = new ctt_contract_dal(); var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { thisNote = caDal.FindNoDeleteById(long.Parse(id)); if (thisNote != null) { isAdd = false; thisNoteAtt = new com_attachment_dal().GetAttListByOid(thisNote.id); thisTask = stDal.FindNoDeleteById(thisNote.object_id); if (thisTask != null) { object_id = thisTask.id; if (thisTask.type_id == (int)DicEnum.TASK_TYPE.SERVICE_DESK_TICKET) { isTicket = true; thisTask = null; thisTicket = stDal.FindNoDeleteById(thisNote.object_id); } } else { thisProject = ppDal.FindNoDeleteById(thisNote.object_id); if (thisProject != null) { isProject = true; object_id = thisProject.id; thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } else { thisContract = ccDal.FindNoDeleteById(thisNote.object_id); if (thisContract != null) { isContract = true; object_id = thisContract.id; thisAccount = accDal.FindNoDeleteById(thisContract.account_id); } } } } } var taskId = Request.QueryString["task_id"]; var project_id = Request.QueryString["project_id"]; var contract_id = Request.QueryString["contract_id"]; var ticket_id = Request.QueryString["ticket_id"]; var call_id = Request.QueryString["call_id"]; if (!string.IsNullOrEmpty(taskId)) { thisTask = stDal.FindNoDeleteById(long.Parse(taskId)); } else if (!string.IsNullOrEmpty(project_id)) { thisProject = ppDal.FindNoDeleteById(long.Parse(project_id)); if (thisProject != null) { isProject = true; object_id = thisProject.id; thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } } else if (!string.IsNullOrEmpty(contract_id)) { thisContract = ccDal.FindNoDeleteById(long.Parse(contract_id)); if (thisContract != null) { object_id = thisContract.id; thisAccount = accDal.FindNoDeleteById(thisContract.account_id); isContract = true; } } else if (!string.IsNullOrEmpty(ticket_id)) { thisTicket = stDal.FindNoDeleteById(long.Parse(ticket_id)); } else if (!string.IsNullOrEmpty(call_id)) { thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(call_id)); if (thisCall != null) { isCall = true; thisAccount = new CompanyBLL().GetCompany(thisCall.account_id); callTicketList = stDal.GetTciketByCall(thisCall.id); if (callTicketList != null && callTicketList.Count > 0) { thisTask = callTicketList[0]; if (callTicketList.Any(_ => _.id != thisTask.id && _.status_id != thisTask.status_id)) { isMantStatus = true; } if (callTicketList.Any(_ => _.id != thisTask.id && _.account_id != thisTask.account_id)) { isManyAccount = true; } if (callTicketList.Any(_ => _.id != thisTask.id && _.title != thisTask.title)) { isManyTitle = true; } } else { Response.Write("<script>alert('服务预定下暂无工单!');window.close();</script>"); return; } } } if (thisTask != null) { thisAccount = accDal.FindNoDeleteById(thisTask.account_id); object_id = thisTask.id; if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE) { isPhase = true; } task_creator = new sys_resource_dal().FindNoDeleteById(thisTask.create_user_id); if (thisTask.project_id != null) { thisProject = ppDal.FindNoDeleteById((long)thisTask.project_id); if (thisProject != null) { thisAccount = accDal.FindNoDeleteById(thisProject.account_id); } } } if (thisTicket != null) { isTicket = true; object_id = thisTicket.id; task_creator = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id); thisAccount = accDal.FindNoDeleteById(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } } if (thisAccount == null) { Response.End(); } else { if (thisAccount.resource_id != null) { thisAccManger = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id); } } if (!IsPostBack) { publish_type_id.DataTextField = "name"; publish_type_id.DataValueField = "id"; var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE); if (pushList != null && pushList.Count > 0) { if (isProject) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList(); } else if (isContract) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.CONTRACT_NOTE).ToString()).ToList(); } else if (isTicket) { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } else { pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } } publish_type_id.DataSource = pushList; publish_type_id.DataBind(); status_id.DataTextField = "show"; status_id.DataValueField = "val"; var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>; if (isMantStatus) { statusList.Add(new DictionaryEntryDto() { val = "0", show = "多个值,保持不变" }); } status_id.DataSource = statusList; status_id.DataBind(); if (isMantStatus) { status_id.SelectedValue = "0"; } else if (thisTask != null) { status_id.SelectedValue = thisTask.status_id.ToString(); } else if (thisTicket != null) { status_id.SelectedValue = thisTicket.status_id.ToString(); } action_type_id.DataTextField = "name"; action_type_id.DataValueField = "id"; var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { if (isProject) { actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList(); } else if (isContract) { actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.CONTRACT_NOTE).ToString()).ToList(); } else if (isTicket) { actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } else { actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } } action_type_id.DataSource = actList; action_type_id.DataBind(); if (thisNote != null) { if (!IsPostBack) { if (thisNote.publish_type_id != null) { publish_type_id.SelectedValue = thisNote.publish_type_id.ToString(); } action_type_id.SelectedValue = thisNote.action_type_id.ToString(); isAnnounce.Checked = thisNote.announce == 1; } } else { if (isContract) { publish_type_id.SelectedValue = ((int)DicEnum.NOTE_PUBLISH_TYPE.CONTRACT_INTERNA_USER).ToString(); } } var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.NONE); notify_id.DataTextField = "name"; notify_id.DataValueField = "id"; notify_id.DataSource = tempList; notify_id.DataBind(); } if (isProject) { tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.PROJECT_NOTE, LoginUserId); } else if (isTicket && thisTicket != null) { tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.TICKET_NOTE, LoginUserId); } else if (thisTask != null) { tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.TASK_NOTE, LoginUserId); } } catch (Exception msg) { Response.Write(msg); Response.End(); } }