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) { 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) { // 批量修改 // 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 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(); } }