/// <summary> /// 批量提交工时表 /// </summary> void SubmitManySheet(HttpContext context) { bool result = false; int temp = 0; if (!string.IsNullOrEmpty(context.Request.QueryString["Array"])) { var arr = new Tools.Serialize().DeserializeJson <string[]>(context.Request.QueryString["Array"]); if (arr != null && arr.Length > 0) { var bll = new BLL.WorkEntryBLL(); foreach (var thisArr in arr) { var thisSub = thisArr.Split('_'); if (thisSub.Length == 2) { if (!bll.SubmitWorkEntry(DateTime.Parse(thisSub[1]), long.Parse(thisSub[0]), LoginUserId)) { temp++; } } } } } if (temp == 0) { result = true; } WriteResponseJson(result); }
/// <summary> /// 获取所有可用的工作流 /// </summary> /// <returns></returns> public List <WorkflowRuleDto> GetAllWorkflow() { var srlz = new Tools.Serialize(); var workflowList = dal.FindListBySql <WorkflowRuleDto>("select * from sys_workflow where delete_time=0 and is_active=1"); foreach (var wf in workflowList) { if (!string.IsNullOrEmpty(wf.event_json)) { wf.eventJson = srlz.DeserializeJson <List <dynamic> >(wf.event_json); } if (!string.IsNullOrEmpty(wf.condition_json)) { wf.conditionJson = srlz.DeserializeJson <List <dynamic> >(wf.condition_json); } if (!string.IsNullOrEmpty(wf.update_json)) { wf.updateJson = srlz.DeserializeJson <List <dynamic> >(wf.update_json); } if (!string.IsNullOrEmpty(wf.email_send_from)) { wf.emailJson = srlz.DeserializeJson <List <dynamic> >(wf.email_send_from); } } return(workflowList); }
/// <summary> /// 根据生效时间计算生效时间开始的首周期所占整周期的天数百分比(保留4位小数) /// </summary> /// <param name="context"></param> private void CalcServiceAdjustPercent(HttpContext context) { long contractId = long.Parse(context.Request.QueryString["contractId"]); long serviceId = long.Parse(context.Request.QueryString["serviceId"]); DateTime date = DateTime.Parse(context.Request.QueryString["date"]); var result = new Tools.Serialize().SerializeJson(new ContractServiceBLL().CalcServiceAdjustDatePercent(contractId, serviceId, date)); context.Response.Write(result); }
/// <summary> /// 工单创建修改事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TicketAddEditEvent(object sender, sdk_task_dal.InsertEventArgs e) { var ticket = sender as sdk_task; if (ticket.type_id != (int)DicEnum.TASK_TYPE.SERVICE_DESK_TICKET && ticket.type_id != (int)DicEnum.TASK_TYPE.RECURRING_TICKET_MASTER) { return; } sys_workflow_log_dal logDal = new sys_workflow_log_dal(); foreach (var wf in workflowList) { if (wf.workflow_object_id == (int)DicEnum.WORKFLOW_OBJECT.TICKET) { foreach (var evt in wf.eventJson) { if (((string)evt["event"]).Equals(e.EventType)) // 新增事件 { if (((string)evt["value"]).Equals("1") || ((string)evt["value"]).Equals("2")) // 任何人或员工新增 { string sql = GetWorkflowSql(wf.id, wf.workflow_object_id, ticket.id); if (string.IsNullOrEmpty(sql)) { continue; } var workflowSql = new Tools.Serialize().DeserializeJson <List <dynamic> >(sql); foreach (var wfsql in workflowSql) { if (string.IsNullOrEmpty((string)wfsql["update"])) { continue; } if (dal.ExecuteSQL((string)wfsql["update"]) > 0) { logDal.AddWorkflowLog(wf.id, ticket.id, (string)wfsql["update"]); } } } } } } } }
/// <summary> /// 新增编辑快速查询记录 /// </summary> public void SearchHistoryManage(HttpContext context) { var result = false; var id = context.Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { var search = new DAL.sys_recent_search_dal().FindById(long.Parse(id)); if (search != null) { result = new DispatchBLL().ManageSearch(search, LoginUserId); } } else { var searchText = context.Request.QueryString["searchText"]; var searchType = context.Request.QueryString["searchType"]; var searchTypeName = context.Request.QueryString["searchTypeName"]; var url = context.Request.QueryString["url"]; var searchDto = new DTO.QuickSearchDto() { Condition = searchText, Name = searchTypeName, SearchType = searchType }; var conditions = new Tools.Serialize().SerializeJson(searchDto); var search = new DAL.sys_recent_search_dal().GetByCon(conditions, url); if (search != null) { result = new DispatchBLL().ManageSearch(search, LoginUserId); } else { search = new Core.sys_recent_search() { conditions = conditions, url = url, title = "", }; result = new DispatchBLL().ManageSearch(search, LoginUserId); } } context.Response.Write(new Tools.Serialize().SerializeJson(result)); }
/// <summary> /// 根据商机模板填充商机内容 /// </summary> /// <param name="context"></param> /// <param name="formTemp_id"></param> public void GetFormTemplate(HttpContext context, long formTemp_id) { var formTemplate = new FormTemplateBLL().GetOpportunityTmpl((int)formTemp_id); if (formTemplate != null) { var json = new Tools.Serialize().SerializeJson(formTemplate); if (formTemplate.account_id != null) { var companyName = new CompanyBLL().GetCompany((long)formTemplate.account_id); if (companyName != null) { json = json.Substring(0, json.Length - 1); json += ",\"ParentComoanyName\":\"" + companyName.name + "\"}"; } } context.Response.Write(json); } }
/// <summary> /// 获取小窗口及小窗口的小部件 /// </summary> private void GetWidget() { var id = long.Parse(request.QueryString["id"]); var info = bll.GetWidgetById(id); var guages = bll.GetGuageChildren(id); var srlz = new Tools.Serialize(); if (info.type_id != (int)DicEnum.WIDGET_TYPE.GUAGE && info.type_id != (int)DicEnum.WIDGET_TYPE.HTML) { object filter = null; if (!string.IsNullOrEmpty(info.filter_json)) { filter = srlz.DeserializeJson <List <dynamic> >(info.filter_json); } info.filter_json = null; object[] result = new object[] { info, guages, filter }; WriteResponseJson(result); } else if (info.type_id == (int)DicEnum.WIDGET_TYPE.GUAGE) { List <object> filters = new List <object>(); foreach (var guage in guages) { if (!string.IsNullOrEmpty(guage.filter_json)) { filters.Add(srlz.DeserializeJson <List <dynamic> >(guage.filter_json)); } else { filters.Add(null); } guage.filter_json = null; } object[] result = new object[] { info, guages, filters }; WriteResponseJson(result); } }
/// <summary> /// 获取一条工作流规则信息,并反序列化json /// </summary> /// <param name="id"></param> /// <returns></returns> public WorkflowRuleDto GetWorkflowJson(long id) { var srlz = new Tools.Serialize(); var wf = dal.FindSignleBySql <WorkflowRuleDto>($"select * from sys_workflow where id={id} and delete_time=0 "); if (!string.IsNullOrEmpty(wf.event_json)) { wf.eventJson = srlz.DeserializeJson <List <dynamic> >(wf.event_json); } if (!string.IsNullOrEmpty(wf.condition_json)) { wf.conditionJson = srlz.DeserializeJson <List <dynamic> >(wf.condition_json); } if (!string.IsNullOrEmpty(wf.update_json)) { wf.updateJson = srlz.DeserializeJson <List <dynamic> >(wf.update_json); } if (!string.IsNullOrEmpty(wf.email_send_from)) { wf.emailJson = srlz.DeserializeJson <List <dynamic> >(wf.email_send_from); } return(wf); }