/// <summary> /// 根据员工id,查询出员工的角色 /// </summary> /// <param name="context"></param> /// <param name="resource_id"></param> public void GetRoleList(HttpContext context, long resource_id, bool isShowNull = true) { // 查找出部门类型的角色 var roleList = new sys_resource_department_dal().GetRolesBySource(resource_id, DEPARTMENT_CATE.DEPARTMENT); StringBuilder roles = new StringBuilder(); if (isShowNull) { roles.Append("<option value='0'> </option>"); } if (roleList != null && roleList.Count > 0) { var rDal = new sys_role_dal(); foreach (var role in roleList) { var thisRole = rDal.FindNoDeleteById(role.role_id); if (thisRole != null) { roles.Append("<option value='" + thisRole.id + "'>" + thisRole.name + "</option>"); } } } context.Response.Write(roles); }
/// <summary> /// 判断角色是否在部门中 /// </summary> private void IsHasRes(HttpContext context, long department_id, long res_id) { // SELECT * from sys_resource_department where department_id = 876 and resource_id = 840 and is_active = 1 var resource = new sys_resource_department_dal().GetSinByDepIdResId(department_id, res_id); context.Response.Write(resource == null); }
private void ChechByResRole(HttpContext context) { bool isRepeat = false; //是否有重复 var priResRole = context.Request.QueryString["ResRole"]; var otherIds = context.Request.QueryString["OtherIds"]; if (!string.IsNullOrEmpty(priResRole) && !string.IsNullOrEmpty(otherIds)) { otherIds = ClearRepeatRes(otherIds); var priArr = priResRole.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var resDepList = new sys_resource_department_dal().GetListByIds(otherIds); if (priArr.Count() == 2 && resDepList != null && resDepList.Count > 0) { var thisResDep = resDepList.FirstOrDefault(_ => _.resource_id.ToString() == priArr[0]); if (thisResDep != null) { isRepeat = true; resDepList.Remove(thisResDep); otherIds = string.Empty; resDepList.ForEach(_ => { otherIds += _.id.ToString() + ','; }); if (!string.IsNullOrEmpty(otherIds)) { otherIds = otherIds.Substring(0, otherIds.Length - 1); } } } } context.Response.Write(new Tools.Serialize().SerializeJson(new { isRepeat = isRepeat, newDepResIds = otherIds })); }
/// <summary> /// 剔除掉选择的重复的员工 /// </summary> private string ClearRepeatRes(string resDepIds) { string newResDepIds = resDepIds; var resDepList = new sys_resource_department_dal().GetListByIds(resDepIds); if (resDepList != null && resDepList.Count > 0) { var resDepArr = resDepList.ToArray(); foreach (var resDep in resDepArr) { // 获取到重复的员工信息 if (resDepList.Any(_ => _.id == resDep.id)) { var repList = resDepArr.Where(thisResDep => thisResDep.id != resDep.id && thisResDep.resource_id == resDep.resource_id).ToList(); if (repList != null && repList.Count > 0) { repList.ForEach(_ => { resDepList.Remove(_); }); } resDepArr = resDepList.ToArray(); } } if (resDepList != null && resDepList.Count > 0) { newResDepIds = ""; resDepList.ForEach(_ => { newResDepIds += _.id.ToString() + ","; }); if (newResDepIds != "") { newResDepIds = newResDepIds.Substring(0, newResDepIds.Length - 1); } } } return(newResDepIds); }
/// <summary> /// 根据关系表获取员工信息 /// </summary> private void GetInfoByDepId(HttpContext context, long depId) { var thisDepRes = new sys_resource_department_dal().FindNoDeleteById(depId); if (thisDepRes != null) { GetResouInfo(context, thisDepRes.resource_id); } }
void GetDepResource(HttpContext context) { if (!string.IsNullOrEmpty(context.Request.QueryString["id"])) { var thisDepRes = new sys_resource_department_dal().FindById(long.Parse(context.Request.QueryString["id"])); if (thisDepRes != null) { WriteResponseJson(thisDepRes); } } }
/// <summary> /// 删除员工部门 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool DeleteDepartment(long id) { sys_resource_department_dal dptDal = new sys_resource_department_dal(); var dpt = dptDal.FindById(id); if (dpt == null) { return(false); } dptDal.Delete(dpt); return(true); }
public bool DeleteResource(long id, long userId) { sys_resource_department_dal srdDal = new sys_resource_department_dal(); var oldResDep = srdDal.FindById(id); if (oldResDep == null) { return(true); } srdDal.Delete(oldResDep); OperLogBLL.OperLogDelete <sys_resource_department>(oldResDep, oldResDep.id, userId, OPER_LOG_OBJ_CATE.SYS_RESOURCE_DEPARTMENT, ""); return(true); }
/// <summary> /// 返回选择的员工Id 和角色ID /// </summary> private void GetResByDepRes(HttpContext context) { var depResId = context.Request.QueryString["resDepId"]; if (!string.IsNullOrEmpty(depResId)) { var thisResDep = new sys_resource_department_dal().FindById(long.Parse(depResId)); if (thisResDep != null) { context.Response.Write(new Tools.Serialize().SerializeJson(new { resId = thisResDep.resource_id, roleId = thisResDep.role_id })); } } }
/// <summary> /// /// </summary> public void GetResDepList(HttpContext context, string ids) { if (!string.IsNullOrEmpty(ids)) { var thisList = new sys_resource_department_dal().FindListBySql <ResDep>($"SELECT srd.id,sr.`name` as roleName,res.`name` as resName,sd.`name` as depName from sys_resource_department srd LEFT JOIN sys_role sr on srd.role_id = sr.id LEFT JOIN sys_resource res on srd.resource_id = res.id LEFT JOIN sys_department sd on srd.department_id = sd.id where srd.id in({ids})"); if (thisList != null && thisList.Count > 0) { StringBuilder resDepString = new StringBuilder(); foreach (var item in thisList) { resDepString.Append($"<option value='{item.id}'>{item.resName}({item.roleName})</option>"); } context.Response.Write(resDepString.ToString()); } } }
/// <summary> /// 将队列下的主负责人更新为普通 /// </summary> public void ClearLeadResource(long queueId, long userId) { sys_resource_department_dal srdDal = new sys_resource_department_dal(); var list = srdDal.GetListByDepId(queueId); if (list != null && list.Count > 0) { var thisLead = list.FirstOrDefault(_ => _.is_lead == 1); // &&_.is_active == 1 if (thisLead != null) { thisLead.is_lead = 0; string temp = string.Empty; EditQueueResource(thisLead, userId, ref temp); } } }
/// <summary> /// 新增队列员工 /// </summary> public bool AddQueueResource(sys_resource_department resDep, long userId, ref string faileReason) { sys_resource_department_dal srdDal = new sys_resource_department_dal(); if (!CheckResourceRole(resDep)) { faileReason = "已存在该员工角色"; return(false); } if (resDep.is_lead == 1) // && resDep.is_active==1 { ClearLeadResource(resDep.department_id, userId); } resDep.id = srdDal.GetNextIdCom(); srdDal.Insert(resDep); OperLogBLL.OperLogAdd <sys_resource_department>(resDep, resDep.id, userId, OPER_LOG_OBJ_CATE.SYS_RESOURCE_DEPARTMENT, ""); return(true); }
/// <summary> /// 员工所属部门的校验 /// </summary> public bool CheckResourceRole(sys_resource_department resDep) { sys_resource_department_dal srdDal = new sys_resource_department_dal(); var list = srdDal.GetListByDepId(resDep.department_id); if (list != null && list.Count > 0) { var thisDep = list.FirstOrDefault(_ => _.resource_id == resDep.resource_id && _.role_id == resDep.role_id); if (thisDep != null) { if (thisDep.id != resDep.id) { return(false); } } } return(true); }
/// <summary> /// 校验员工id是否在关系表中出现 /// </summary> private void CheckPriResInTeam(HttpContext context, string ids, long priResId) { var result = false; var sdrDal = new sys_resource_department_dal(); if (!string.IsNullOrEmpty(ids)) { var resList = sdrDal.GetListByIds(ids); if (resList != null && resList.Count > 0) { var thisResList = resList.Where(_ => _.resource_id == priResId).ToList(); if (thisResList != null && thisResList.Count > 0) { result = true; } } } context.Response.Write(result); }
/// <summary> /// 根据员工部门Id 获取相关员工ID /// </summary> public string GetResByResDep(string resDepIds) { string resIds = ""; if (!string.IsNullOrEmpty(resDepIds)) { var resDepList = new sys_resource_department_dal().GetListByIds(resDepIds, false); if (resDepList != null && resDepList.Count > 0) { var dic = resDepList.GroupBy(_ => _.resource_id).ToDictionary(_ => _.Key, _ => _.ToList()); foreach (var key in dic) { resIds += key.Key.ToString() + ','; } } } if (resIds != "") { resIds = resIds.Substring(0, resIds.Length - 1); } return(resIds); }
/// <summary> /// 编辑队列员工 /// </summary> public bool EditQueueResource(sys_resource_department resDep, long userId, ref string faileReason) { sys_resource_department_dal srdDal = new sys_resource_department_dal(); if (!CheckResourceRole(resDep)) { faileReason = "已存在该员工角色"; return(false); } var oldResDep = srdDal.FindById(resDep.id); if (oldResDep == null) { faileReason = "原数据已经删除"; return(false); } if (resDep.is_lead == 1 && oldResDep.is_lead != 1) // && resDep.is_active ==1 { ClearLeadResource(resDep.department_id, userId); } srdDal.Update(resDep); OperLogBLL.OperLogUpdate <sys_resource_department>(resDep, oldResDep, resDep.id, userId, OPER_LOG_OBJ_CATE.SYS_RESOURCE_DEPARTMENT, ""); return(true); }
/// <summary> /// 校验是否有重复员工 /// </summary> private void CheckTeamRes(HttpContext context, string ids) { var result = false; var sdrDal = new sys_resource_department_dal(); if (!string.IsNullOrEmpty(ids)) { var resList = sdrDal.GetListByIds(ids); if (resList != null && resList.Count > 0) { var resArr = resList.Select(_ => _.resource_id).ToList(); if (resArr != null && resArr.Count > 0) { if (resArr.Count != resList.Count) { result = false; } } } } context.Response.Write(result); }
void ActiveResManage(HttpContext context) { var result = false; if (!string.IsNullOrEmpty(context.Request.QueryString["id"])) { var thisDepRes = new sys_resource_department_dal().FindById(long.Parse(context.Request.QueryString["id"])); if (thisDepRes != null) { if (!string.IsNullOrEmpty(context.Request.QueryString["isActive"]) && context.Request.QueryString["isActive"] == "1") { thisDepRes.is_active = 1; } else { thisDepRes.is_active = 0; } string temp = string.Empty; result = new DepartmentBLL().EditQueueResource(thisDepRes, LoginUserId, ref temp); } } WriteResponseJson(result); }
/// <summary> /// 新增员工部门 /// </summary> /// <param name="resDpt"></param> /// <param name="type">1:部门;2:队列</param> /// <param name="userId"></param> /// <returns></returns> public bool AddDepartment(sys_resource_department resDpt, int type, long userId) { sys_resource_department_dal dptDal = new sys_resource_department_dal(); if (resDpt.is_default == 1) // 新增默认部门,查找是否已有默认,有则更改为非默认 { string sql = $"select * from sys_resource_department where resource_id={resDpt.resource_id} and is_default=1 and department_id in(select id from sys_department where cate_id={(int)DTO.DicEnum.DEPARTMENT_CATE.DEPARTMENT} and is_active =1 and delete_time = 0)"; if (type == 2) { sql = $"select * from sys_resource_department where resource_id={resDpt.resource_id} and is_default=1 and department_id in(select id from sys_department where cate_id={(int)DTO.DicEnum.DEPARTMENT_CATE.SERVICE_QUEUE} and is_active =1 and delete_time = 0)"; } var dft = dptDal.FindSignleBySql <sys_resource_department>(sql); if (dft != null) { dft.is_default = 0; dptDal.Update(dft); } } resDpt.id = dptDal.GetNextIdCom(); dptDal.Insert(resDpt); return(true); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { Bind(); // 绑定页面下拉数据 } CallBack = Request.QueryString["CallBack"]; var accountId = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(accountId)) { thisAccount = new CompanyBLL().GetCompany(long.Parse(accountId)); } var contractId = Request.QueryString["contract_id"]; if (!string.IsNullOrEmpty(contractId)) { thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contractId)); } var insProId = Request.QueryString["insProId"]; if (!string.IsNullOrEmpty(insProId)) { insPro = new crm_installed_product_dal().FindNoDeleteById(long.Parse(insProId)); if (insPro != null && insPro.account_id != null) { thisAccount = new CompanyBLL().GetCompany((long)insPro.account_id); } } var taskId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(taskId)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); if (thisTicket != null) { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); var isCopyString = Request.QueryString["isCopy"]; if (string.IsNullOrEmpty(isCopyString)) { isAdd = false; } else { isCopy = true; } if (!IsPostBack) { cate_id.ClearSelection(); cate_id.SelectedValue = thisTicket.cate_id.ToString(); this.ticket_type_id.SelectedValue = thisTicket.ticket_type_id.ToString(); this.status_id.SelectedValue = thisTicket.status_id.ToString(); if (isCopy) { this.status_id.ClearSelection(); this.status_id.SelectedValue = ((int)DicEnum.TICKET_STATUS.NEW).ToString(); } if (thisTicket.priority_type_id != null) { priority_type_id.SelectedValue = thisTicket.priority_type_id.ToString(); } if (thisTicket.issue_type_id != null) { issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString(); } if (thisTicket.source_type_id != null) { source_type_id.SelectedValue = thisTicket.source_type_id.ToString(); } if (thisTicket.issue_type_id != null) { issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString(); } if (thisTicket.sla_id != null) { sla_id.SelectedValue = thisTicket.sla_id.ToString(); } if (thisTicket.department_id != null) { department_id.SelectedValue = thisTicket.department_id.ToString(); } } ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList); thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { 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]; priRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); } } if (thisTicket.installed_product_id != null) { insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id); } if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } if (thisTicket.cost_code_id != null) { thisCostCode = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } 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); } } ticketCheckList = new sdk_task_checklist_dal().GetCheckByTask(thisTicket.id); if (ticketCheckList != null && ticketCheckList.Count > 0) { ticketCheckList = ticketCheckList.OrderBy(_ => _.sort_order).ToList(); } #region 时间轴显示相关 工单备注类型获取 var slaValue = new sdk_task_dal().GetSlaTime(thisTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue)) { if (slaTimeValue.Substring(0, 1) == "{") { slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); } } var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { ticketNoteTypeList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } #endregion entryList = new sdk_work_entry_dal().GetList(thisTicket.id); } } var ticket_type_id = Request.QueryString["ticket_type_id"]; if (!string.IsNullOrEmpty(ticket_type_id)) { this.ticket_type_id.ClearSelection(); this.ticket_type_id.SelectedValue = ticket_type_id; } } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }
/// <summary> /// 获取页面参数 /// </summary> protected TicketManageDto GetParam() { // 为方便页面处理 owner_resource_id 存储的是 sys_resource_department 的id ,存储时需要转换 long?owner_resource_id = null; long?role_id = null; var priResString = Request.Form["owner_resource_id"]; if (!string.IsNullOrEmpty(priResString)) { var resDep = new sys_resource_department_dal().FindById(long.Parse(priResString)); if (resDep != null) { owner_resource_id = resDep.resource_id; role_id = resDep.role_id; } } TicketManageDto param = new TicketManageDto(); var pageTicket = AssembleModel <sdk_task>(); pageTicket.owner_resource_id = owner_resource_id; pageTicket.role_id = role_id; var dueDate = Request.Form["DueDate"]; var dueTime = Request.Form["DueTime"]; if (!string.IsNullOrEmpty(dueTime) && !string.IsNullOrEmpty(dueDate)) { var dueDateTime = dueDate + " " + dueTime; // 获取到截止时间 var dueD = DateTime.Parse(dueDateTime); pageTicket.estimated_end_time = Tools.Date.DateHelper.ToUniversalTimeStamp(dueD); } else { ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('未获取到相关截止时间,请重新填写!');</script>"); return(null); } #region 如果sla设置自动计算截止时间 ,保存时计算出工单的结束时间 if (pageTicket.sla_id != null) { var thisSla = new d_sla_dal().FindNoDeleteById((long)pageTicket.sla_id); if (thisSla != null && thisSla.set_ticket_due_date == 1) { if (pageTicket.sla_start_time == null) { pageTicket.sla_start_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); } var slaValue = new sdk_task_dal().GetSlaTime(pageTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue) && slaTimeValue.Substring(0, 1) == "{") { var slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); if (slaDic != null && slaDic.Count > 0) { var duteDateDic = slaDic.FirstOrDefault(_ => _.Key == "截止时间"); if (!default(KeyValuePair <string, object>).Equals(duteDateDic)) { var duteDate = DateTime.Parse(duteDateDic.Value.ToString()); pageTicket.estimated_end_time = Tools.Date.DateHelper.ToUniversalTimeStamp(duteDate); } var firstResponseDateDic = slaDic.FirstOrDefault(_ => _.Key == "响应时间"); if (!default(KeyValuePair <string, object>).Equals(firstResponseDateDic)) { pageTicket.first_response_target_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(firstResponseDateDic.Value.ToString())); } var resoluTatgetDic = slaDic.FirstOrDefault(_ => _.Key == "解决时间"); if (!default(KeyValuePair <string, object>).Equals(resoluTatgetDic)) { pageTicket.resolution_target_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(resoluTatgetDic.Value.ToString())); } var resoluPlanTatgetDic = slaDic.FirstOrDefault(_ => _.Key == "解决方案提供时间"); if (!default(KeyValuePair <string, object>).Equals(firstResponseDateDic)) { pageTicket.resolution_plan_target_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(resoluPlanTatgetDic.Value.ToString())); } } } } } #endregion if (isAdd) { pageTicket.type_id = (int)DTO.DicEnum.TASK_TYPE.SERVICE_DESK_TICKET; param.ticket = pageTicket; } else { #region 获取页面相关值 thisTicket.account_id = pageTicket.account_id; thisTicket.contract_id = pageTicket.contract_id; thisTicket.contact_id = pageTicket.contact_id; thisTicket.status_id = pageTicket.status_id; thisTicket.priority = pageTicket.priority; thisTicket.issue_type_id = pageTicket.issue_type_id; thisTicket.sub_issue_type_id = pageTicket.sub_issue_type_id; thisTicket.source_type_id = pageTicket.source_type_id; thisTicket.estimated_end_time = pageTicket.estimated_end_time; thisTicket.estimated_hours = pageTicket.estimated_hours; thisTicket.sla_id = pageTicket.sla_id; thisTicket.department_id = pageTicket.department_id; thisTicket.owner_resource_id = pageTicket.owner_resource_id; thisTicket.role_id = pageTicket.role_id; thisTicket.installed_product_id = pageTicket.installed_product_id; thisTicket.service_id = pageTicket.service_id; thisTicket.cost_code_id = pageTicket.cost_code_id; thisTicket.purchase_order_no = pageTicket.purchase_order_no; thisTicket.cate_id = pageTicket.cate_id; thisTicket.ticket_type_id = pageTicket.ticket_type_id; thisTicket.title = pageTicket.title; thisTicket.description = pageTicket.description; thisTicket.resolution = pageTicket.resolution; thisTicket.sla_start_time = pageTicket.sla_start_time; thisTicket.estimated_end_time = pageTicket.estimated_end_time; thisTicket.first_response_target_time = pageTicket.first_response_target_time; thisTicket.resolution_target_time = pageTicket.resolution_target_time; thisTicket.resolution_plan_target_time = pageTicket.resolution_plan_target_time; #endregion param.ticket = thisTicket; } param.resDepIds = Request.Form["OtherResId"]; var AddSoule = Request.Form["AddSoule"]; if (AddSoule == "on") { param.isAppSlo = true; } param.completeReason = Request.Form["reason"]; param.repeatReason = Request.Form["RepeatReason"]; #region 检查单相关 var CheckListIds = Request.Form["CheckListIds"]; // 检查单Id if (!string.IsNullOrEmpty(CheckListIds)) { List <CheckListDto> ckList = new List <CheckListDto>(); var checkIdArr = CheckListIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var checkId in checkIdArr) { if (string.IsNullOrEmpty(Request.Form[checkId + "_item_name"])) // 条目名称为空 不添加 { continue; } var is_complete = Request.Form[checkId + "_is_complete"]; var is_import = Request.Form[checkId + "_is_import"]; var sortOrder = Request.Form[checkId + "_sort_order"]; decimal?sort = null; if (!string.IsNullOrEmpty(sortOrder)) { sort = decimal.Parse(sortOrder); } var thisCheck = new CheckListDto() { ckId = long.Parse(checkId), isComplete = is_complete == "on", itemName = Request.Form[checkId + "_item_name"], isImport = is_import == "on", sortOrder = sort, }; ckList.Add(thisCheck); } param.ckList = ckList; } #endregion #region 工单自定义字段,页面暂无自定义 if (tickUdfList != null && tickUdfList.Count > 0) { var list = new List <UserDefinedFieldValue>(); foreach (var udf in tickUdfList) // 循环添加 { var new_udf = new UserDefinedFieldValue() { id = udf.id, value = string.IsNullOrEmpty(Request.Form[udf.id.ToString()]) ? null : Request.Form[udf.id.ToString()], }; list.Add(new_udf); } if (isAdd) { param.udfList = list; } else { param.udfList = ticketUdfValueList; } } #endregion return(param); }
protected void Page_Load(object sender, EventArgs e) { try { var taskId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(taskId)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); if (thisTicket != null) { isAdd = false; thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + taskId, LoginUserId); ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList); thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { 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]; priRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); } } if (thisTicket.installed_product_id != null) { insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id); } if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } if (thisTicket.cost_code_id != null) { thisCostCode = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } ticketCheckList = new sdk_task_checklist_dal().GetCheckByTask(thisTicket.id); if (ticketCheckList != null && ticketCheckList.Count > 0) { ticketCheckList = ticketCheckList.OrderBy(_ => _.sort_order).ToList(); } entryList = new sdk_work_entry_dal().GetList(thisTicket.id); var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id); if (otherResList != null && otherResList.Count > 0) { ticketResList = new List <sys_resource_department>(); var srdDal = new sys_resource_department_dal(); foreach (var resRole in otherResList) { if (resRole.resource_id == null || resRole.role_id == null) { continue; } var thisResDep = srdDal.GetResDepByResAndRole((long)resRole.resource_id, (long)resRole.role_id); if (thisResDep != null && thisResDep.Count > 0) { ticketResList.Add(thisResDep[0]); } } } if (thisTicket.service_id != null) { thisService = new ivt_service_dal().FindNoDeleteById((long)thisTicket.service_id); if (thisService == null) { thisServiceBun = new ivt_service_bundle_dal().FindNoDeleteById((long)thisTicket.service_id); } } createRes = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id); var slaValue = new sdk_task_dal().GetSlaTime(thisTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue)) { if (slaTimeValue.Substring(0, 1) == "{") { slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); } } var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { ticketNoteTypeList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } ticketOther = new sdk_task_other_dal().GetTicketOther(thisTicket.id); ticketOtherList = new sdk_task_other_person_dal().GetTicketOther(thisTicket.id); } } var ticketIds = Request.QueryString["ids"]; if (!string.IsNullOrEmpty(ticketIds)) { pageTicketList = new sdk_task_dal().GetTicketByIds(ticketIds); } if (thisTicket == null) { Response.Write("<script>alert('未查询到该工单信息!');window.close();</script>"); return; } var history = new sys_windows_history() { title = "工单:" + thisTicket.no + ":" + thisTicket.title, url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }
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>"); } }
/// <summary> /// 拖拽后修改服务预定 /// </summary> public bool EditServiceCall(long callId, long?oldResId, long newResId, long?roleId, string startTime, decimal duraHours, long userId) { var tBLL = new TicketBLL(); var sscDal = new sdk_service_call_dal(); var thisCall = sscDal.FindNoDeleteById(callId); if (thisCall == null) { return(false); } var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); var oldStartDate = Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.start_time); var newStartDate = DateTime.Parse(startTime); thisCall.start_time = Tools.Date.DateHelper.ToUniversalTimeStamp(newStartDate); thisCall.end_time = thisCall.start_time + (long)(duraHours * 60 * 60 * 1000); thisCall.update_time = timeNow; thisCall.update_user_id = userId; var oldSer = sscDal.FindNoDeleteById(callId); sscDal.Update(thisCall); OperLogBLL.OperLogUpdate <sdk_service_call>(thisCall, oldSer, thisCall.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SERVICE_CALL, "编辑服务预定"); if (oldResId != newResId && roleId == null) { return(false); } var ssctrDal = new sdk_service_call_task_resource_dal(); var ssctDal = new sdk_service_call_task_dal(); if (oldResId != newResId) { var thisDep = new sys_resource_department_dal().GetResDepByResAndRole(newResId, (long)roleId); if (thisDep == null || thisDep.Count == 0) { return(false); } if (oldResId != null) { var oldResList = ssctrDal.GetResByCallRes(callId, (long)oldResId); oldResList.ForEach(_ => { ssctrDal.SoftDelete(_, userId); OperLogBLL.OperLogDelete <sdk_service_call_task_resource>(_, _.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SERVICE_CALL_RESOURCE, "删除服务预定负责人"); }); } var thisCallTicket = stDal.GetTciketByCall(callId); if (thisCallTicket != null && thisCallTicket.Count > 0) { var strDal = new sdk_task_resource_dal(); thisCallTicket.ForEach(_ => { // 为服务预定添加该负责人 var thisCallTask = ssctDal.GetSingTaskCall(callId, _.id); if (thisCallTask != null) { var resList = ssctrDal.GetTaskResList(thisCallTask.id); if (!resList.Any(r => r.resource_id == newResId)) { var ssct = new sdk_service_call_task_resource() { id = ssctrDal.GetNextIdCom(), create_time = timeNow, create_user_id = userId, resource_id = newResId, service_call_task_id = thisCallTask.id, update_time = timeNow, update_user_id = userId, }; ssctrDal.Insert(ssct); OperLogBLL.OperLogAdd <sdk_service_call_task_resource>(ssct, ssct.id, userId, DicEnum.OPER_LOG_OBJ_CATE.SERVICE_CALL_RESOURCE, "新增服务预定负责人"); } } // 为工单团队添加负责人 if (!tBLL.IsHasRes(_.id, newResId)) { var item = new sdk_task_resource() { id = strDal.GetNextIdCom(), task_id = _.id, role_id = roleId, resource_id = newResId, department_id = (int)thisDep[0].department_id, create_user_id = userId, update_user_id = userId, create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now), }; strDal.Insert(item); OperLogBLL.OperLogAdd <sdk_task_resource>(item, item.id, userId, DicEnum.OPER_LOG_OBJ_CATE.PROJECT_TASK_RESOURCE, "新增工单分配对象"); } }); } } return(true); }
protected MasterTicketDto GetParam() { MasterTicketDto param = new MasterTicketDto(); #region 定期工单相关参数获取 var pageTicket = AssembleModel <sdk_task>(); #region 获取主负责人和相关角色 var dueTime = Request.Form["dueTime"]; if (isAdd) { var resDepId = Request.Form["resDepId"]; long?roleId = null; long?resId = null; if (!string.IsNullOrEmpty(resDepId)) // department_id { var resDep = new sys_resource_department_dal().FindById(long.Parse(resDepId)); if (resDep != null) { roleId = resDep.role_id; resId = resDep.resource_id; } } pageTicket.role_id = roleId; pageTicket.owner_resource_id = resId; #endregion if (!string.IsNullOrEmpty(dueTime)) { pageTicket.estimated_end_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " " + dueTime)); } else { return(null); } param.masterTicket = pageTicket; } else { #region 修改获取相关参数 //thisTicket.account_id = pageTicket.account_id; //thisTicket.title = pageTicket.title; //thisTicket.description = pageTicket.description; //thisTicket.contact_id = pageTicket.contact_id; //thisTicket.department_id = pageTicket.department_id; //thisTicket.owner_resource_id = pageTicket.owner_resource_id; //thisTicket.role_id = pageTicket.role_id; //thisTicket.source_type_id = pageTicket.source_type_id; //thisTicket.issue_type_id = pageTicket.issue_type_id; //thisTicket.sub_issue_type_id = pageTicket.sub_issue_type_id; //thisTicket.estimated_end_time = pageTicket.estimated_end_time; //thisTicket.estimated_hours = pageTicket.estimated_hours; //thisTicket.status_id = pageTicket.status_id; //thisTicket.priority_type_id = pageTicket.priority_type_id; //thisTicket.contract_id = pageTicket.contract_id; //thisTicket.cost_code_id = pageTicket.cost_code_id; //thisTicket.cate_id = pageTicket.cate_id; //thisTicket.installed_product_id = pageTicket.installed_product_id; //thisTicket.purchase_order_no = pageTicket.purchase_order_no; #endregion param.masterTicket = thisTicket; } #endregion #region 周期相关参数获取 var pageRecurr = AssembleModel <sdk_recurring_ticket>(); var ckActive = Request.Form["ckActive"]; if (!string.IsNullOrEmpty(ckActive) && ckActive.Equals("on")) { pageRecurr.is_active = 1; } else { pageRecurr.is_active = 0; } if (isAdd) { pageRecurr.recurring_start_date = DateTime.Parse(pageRecurr.recurring_start_date.ToString("yyyy-MM-dd") + " " + dueTime); var rdoFreq = Request.Form["rdoFreq"]; switch (rdoFreq) { case "Daily": pageRecurr.recurring_frequency = (int)DicEnum.RECURRING_TICKET_FREQUENCY_TYPE.DAY; var day_eve_day = Request.Form["day_eve_day"]; if (!string.IsNullOrEmpty(day_eve_day)) { param.day_day = int.Parse(day_eve_day); } else { return(null); } var ckNotInSat = Request.Form["ckNotInSat"]; if (!string.IsNullOrEmpty(ckNotInSat) && ckNotInSat.Equals("on")) { param.day_no_sat = true; } var ckNotInSun = Request.Form["ckNotInSun"]; if (!string.IsNullOrEmpty(ckNotInSun) && ckNotInSun.Equals("on")) { param.day_no_sun = true; } break; case "Weekly": pageRecurr.recurring_frequency = (int)DicEnum.RECURRING_TICKET_FREQUENCY_TYPE.WEEK; var week_eve_week = Request.Form["week_eve_week"]; if (!string.IsNullOrEmpty(week_eve_week)) { param.week_week = int.Parse(week_eve_week); } else { return(null); } var ckWeekMon = Request.Form["ckWeekMon"]; if (!string.IsNullOrEmpty(ckWeekMon) && ckWeekMon.Equals("on")) { param.week_mon = true; } var ckWeekTus = Request.Form["ckWeekTus"]; if (!string.IsNullOrEmpty(ckWeekTus) && ckWeekTus.Equals("on")) { param.week_tus = true; } var ckWeekWed = Request.Form["ckWeekWed"]; if (!string.IsNullOrEmpty(ckWeekWed) && ckWeekWed.Equals("on")) { param.week_wed = true; } var ckWeekThu = Request.Form["ckWeekThu"]; if (!string.IsNullOrEmpty(ckWeekThu) && ckWeekThu.Equals("on")) { param.week_thu = true; } var ckWeekFri = Request.Form["ckWeekFri"]; if (!string.IsNullOrEmpty(ckWeekFri) && ckWeekFri.Equals("on")) { param.week_fri = true; } var ckWeekSat = Request.Form["ckWeekSat"]; if (!string.IsNullOrEmpty(ckWeekSat) && ckWeekSat.Equals("on")) { param.week_sat = true; } var ckWeekSun = Request.Form["ckWeekSun"]; if (!string.IsNullOrEmpty(ckWeekSun) && ckWeekSun.Equals("on")) { param.week_sun = true; } break; case "Monthly": pageRecurr.recurring_frequency = (int)DicEnum.RECURRING_TICKET_FREQUENCY_TYPE.MONTH; var radioMonthly = Request.Form["radioMonthly"]; if (radioMonthly == "Day") { param.month_type = "1"; var month_month_num = Request.Form["month_month_num"]; var month_month_day = Request.Form["month_month_day"]; if (!string.IsNullOrEmpty(month_month_num) && !string.IsNullOrEmpty(month_month_day)) { param.month_month = int.Parse(month_month_num); param.month_day = int.Parse(month_month_day); } else { return(null); } } else if (radioMonthly == "The") { param.month_type = "2"; var month_month_eve_num = Request.Form["month_month_eve_num"]; if (!string.IsNullOrEmpty(month_month_eve_num)) { param.month_month = int.Parse(month_month_eve_num); } else { return(null); } param.month_week_num = Request.Form["ddlOccurance_ATDropDown"]; param.month_week_day = Request.Form["ddlDayofweeks_ATDropDown"]; } else { return(null); } break; case "Yearly": pageRecurr.recurring_frequency = (int)DicEnum.RECURRING_TICKET_FREQUENCY_TYPE.YEAR; var rdoYearlyDue = Request.Form["rdoYearlyDue"]; if (rdoYearlyDue == "DueEvery") { var year_month_day = Request.Form["year_month_day"]; if (!string.IsNullOrEmpty(year_month_day)) { param.year_month_day = int.Parse(year_month_day); } else { return(null); } param.year_type = "1"; param.year_month = Request.Form["year_every_month"]; } else if (rdoYearlyDue == "The") { param.year_type = "2"; param.year_month = Request.Form["year_the_month"]; param.year_month_week_num = Request.Form["year_month_week_num"]; param.year_month_week_day = Request.Form["year_the_week"]; } else { return(null); } break; default: return(null); break; } param.masterRecurr = pageRecurr; } else { if (thisticketRes.recurring_end_date != null) { thisticketRes.recurring_end_date = pageRecurr.recurring_end_date; } if (thisticketRes.recurring_instances != null) { thisticketRes.recurring_instances = pageRecurr.recurring_instances; } thisticketRes.is_active = pageRecurr.is_active; param.masterRecurr = thisticketRes; } #endregion #region 附件相关 param.filtList = GetSessAttList(objectId); #endregion #region 备注相关参数 param.noteTitle = Request.Form["note_title"]; if (!string.IsNullOrEmpty(Request.Form["note_publish_id"])) { param.publishId = long.Parse(Request.Form["note_publish_id"]); } if (!string.IsNullOrEmpty(Request.Form["note_type"])) { param.noteTypeId = long.Parse(Request.Form["note_type"]); } param.noteDescription = Request.Form["txtNotesDescription"]; #endregion #region 通知相关 param.ccCons = Request.Form["notifyConIds"]; param.ccRes = Request.Form["notifyResIds"]; param.appText = Request.Form["notify_description"]; param.subject = Request.Form["notify_title"]; param.otherEmail = Request.Form["notify_others"]; if (!string.IsNullOrEmpty(Request.Form["notify_temp"])) { param.tempId = int.Parse(Request.Form["notify_temp"]); } var ccMe = Request.Form["ccMe"]; if (!string.IsNullOrEmpty(ccMe) && ccMe.Equals("on")) { param.ccMe = true; } var ccAccMan = Request.Form["ccAccMan"]; if (!string.IsNullOrEmpty(ccAccMan) && ccMe.Equals("on")) { param.ccAccMan = true; } var sendFromSys = Request.Form["sendFromSys"]; if (!string.IsNullOrEmpty(sendFromSys) && ccMe.Equals("on")) { param.sendFromSys = true; } var ccOwn = Request.Form["ccOwn"]; if (!string.IsNullOrEmpty(ccOwn) && ccMe.Equals("on")) { param.ccOwn = true; } #endregion #region 工单自定义字段,页面暂无自定义 if (tickUdfList != null && tickUdfList.Count > 0) { var list = new List <UserDefinedFieldValue>(); foreach (var udf in tickUdfList) // 循环添加 { var new_udf = new UserDefinedFieldValue() { id = udf.id, value = string.IsNullOrEmpty(Request.Form[udf.id.ToString()]) ? null : Request.Form[udf.id.ToString()], }; list.Add(new_udf); } param.udfList = list; } #endregion return(param); }
protected void Page_Load(object sender, EventArgs e) { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); if (!IsPostBack) { Bind(); // 绑定页面下拉数据 } if (noteTypeList != null && noteTypeList.Count > 0) { noteTypeList = noteTypeList.Where(_ => _.ext2 == ((int)DicEnum.TASK_TYPE.RECURRING_TICKET_MASTER).ToString()).ToList(); } if (publishList != null && publishList.Count > 0) { publishList = publishList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TICKET_NOTE).ToString()).ToList(); } var ticketId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(ticketId)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticketId)); } if (thisTicket != null) { isAdd = false; objectId = thisTicket.id; #region 获取工单基本信息 thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { priRes = 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 (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } status_id.SelectedValue = thisTicket.status_id.ToString(); if (thisTicket.priority_type_id != null) { priority_type_id.SelectedValue = thisTicket.priority_type_id.ToString(); } if (thisTicket.issue_type_id != null) { issue_type_id.SelectedValue = thisTicket.issue_type_id.ToString(); } if (thisTicket.source_type_id != null) { source_type_id.SelectedValue = thisTicket.source_type_id.ToString(); } if (thisTicket.cate_id != null) { cate_id.SelectedValue = thisTicket.cate_id.ToString(); } if (thisTicket.cost_code_id != null) { cost_code_id.SelectedValue = thisTicket.cost_code_id.ToString(); } if (thisTicket.department_id != null) { department_id.SelectedValue = thisTicket.department_id.ToString(); } if (thisTicket.installed_product_id != null) { insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id); } if (insPro != null) { thisProduct = new ivt_product_dal().FindNoDeleteById(insPro.product_id); } #endregion #region 获取工单周期信息 thisticketRes = new sdk_recurring_ticket_dal().GetByTicketId(thisTicket.id); #endregion ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList); #region 记录浏览历史 var history = new sys_windows_history() { title = $"编辑定期服务主工单:" + thisTicket.no + " " + thisTicket.title + " " + (thisAccount != null ? thisAccount.name : ""), url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); #endregion } }
/// <summary> /// 检查是否有重复的员工存在(主负责人查找带回时使用,有重复员工直接移除) /// </summary> /// <param name="context"></param> private void CheckResInResDepIds(HttpContext context) { var isRepeatRes = false; var depResId = context.Request.QueryString["resDepIds"]; var priDepResId = context.Request.QueryString["resDepId"]; if (!string.IsNullOrEmpty(depResId)) { depResId = ClearRepeatRes(depResId); } var isDelete = !string.IsNullOrEmpty(context.Request.QueryString["isDelete"]); long?priResId = null; var srdDal = new sys_resource_department_dal(); if (!string.IsNullOrEmpty(priDepResId)) { var priDepRes = srdDal.FindById(long.Parse(priDepResId)); if (priDepRes != null) { priResId = priDepRes.resource_id; } } var priRes = context.Request.QueryString["priRes"]; if (!string.IsNullOrEmpty(priRes)) { priResId = long.Parse(priRes); } if (!string.IsNullOrEmpty(depResId) && priResId != null) { var resDepList = srdDal.GetListByIds(depResId); if (resDepList != null && resDepList.Count > 0) { var repeatResList = resDepList.Where(_ => _.resource_id == priResId).ToList(); if (repeatResList != null && repeatResList.Count > 0) { isRepeatRes = true; if (isDelete) { foreach (var item in repeatResList) { resDepList.Remove(item); } string newDepResIds = ""; if (resDepList != null && resDepList.Count > 0) { resDepList.ForEach(_ => { newDepResIds += _.id.ToString() + ','; }); if (newDepResIds != "") { newDepResIds = newDepResIds.Substring(0, newDepResIds.Length - 1); } } depResId = newDepResIds; } } } } context.Response.Write(new Tools.Serialize().SerializeJson(new { isRepeat = isRepeatRes, newDepResIds = depResId })); }
protected void Page_Load(object sender, EventArgs e) { try { var exp_id = Request.QueryString["exp_id"]; if (!string.IsNullOrEmpty(exp_id)) { thisExpense = new sdk_expense_dal().FindNoDeleteById(long.Parse(exp_id)); if (thisExpense != null) { thisAccount = new CompanyBLL().GetCompany(thisExpense.account_id); } long?accout_id = null; if (thisAccount != null) { accout_id = thisAccount.id; } if (thisExpense.expense_cost_code_id != null) { var ruleList = new d_cost_code_rule_dal().GetRuleByCodeId((long)thisExpense.expense_cost_code_id); if (ruleList != null && ruleList.Count > 0) { thisRule = new TaskBLL().GetRule(ruleList, accout_id); } } } var account_id = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(account_id)) { thisAccount = new CompanyBLL().GetCompany(long.Parse(account_id)); } // 费用的cate 种类 在d_cost_code上, // 相关规则在d_cost_code_rule上 // 放个iframe 使用通用查询 if (thisAccount == null) { Response.End(); } else { var url = "../Common/SearchBodyFrame?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.ACCOUNT_POLICY + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ACCOUNT_POLICY + "&con1057=" + thisAccount.id + "&con1056=" + LoginUserId; var deaDep = new sys_resource_department_dal().GetDepByRes(LoginUserId); // 员工的默认部门 if (deaDep != null) { url += "&con1058=" + deaDep.id; } var cate_id = Request.QueryString["cate_id"]; if (!string.IsNullOrEmpty(cate_id)) { } AccountPolicy.Src = url; } } catch (Exception) { Response.End(); } }