Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long queId = 0; long resDepId;

            if (!string.IsNullOrEmpty(Request.QueryString["queId"]))
            {
                if (long.TryParse(Request.QueryString["queId"], out queId))
                {
                    queue = depBll.GetQueue(queId);
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                if (long.TryParse(Request.QueryString["id"], out resDepId))
                {
                    resDep = new DAL.sys_resource_department_dal().FindById(resDepId);
                }
            }
            if (resDep != null)
            {
                isAdd = false;
                queue = depBll.GetQueue(resDep.department_id);
            }

            if (queue == null)
            {
                Response.Write("<script>alert('未获取到相关队列信息');window.close();</script>");
            }
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        /// <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);
        }
Пример #4
0
        /// <summary>
        /// 新增员工服务队列
        /// </summary>
        /// <param name="context"></param>
        private void AddQueue(HttpContext context)
        {
            long  resId = long.Parse(context.Request.QueryString["resId"]);
            long  queId = long.Parse(context.Request.QueryString["queId"]);
            long  role  = long.Parse(context.Request.QueryString["role"]);
            sbyte dft   = sbyte.Parse(context.Request.QueryString["dft"]);
            sbyte isact = sbyte.Parse(context.Request.QueryString["isact"]);
            sys_resource_department department = new sys_resource_department
            {
                department_id = queId,
                is_active     = isact,
                is_default    = dft,
                is_lead       = null,
                resource_id   = resId,
                role_id       = role
            };

            context.Response.Write(new Tools.Serialize().SerializeJson(new BLL.UserResourceBLL().AddDepartment(department, 2, LoginUserId)));
        }
Пример #5
0
        /// <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);
        }
Пример #6
0
        /// <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);
        }
Пример #7
0
        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>");
            }
        }
Пример #8
0
        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>");
            }
        }
Пример #9
0
        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
            }
        }
Пример #10
0
        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>");
            }
        }
Пример #11
0
        void ResourceManage(HttpContext context)
        {
            sys_resource_department resdep = new sys_resource_department();
            long id = 0; long resId = 0; long roleId = 0; long queId = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["id"]))
            {
                if (long.TryParse(context.Request.QueryString["id"], out id))
                {
                    resdep.id = id;
                }
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["resId"]))
            {
                if (long.TryParse(context.Request.QueryString["resId"], out resId))
                {
                    resdep.resource_id = resId;
                }
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["roleId"]))
            {
                if (long.TryParse(context.Request.QueryString["roleId"], out roleId))
                {
                    resdep.role_id = roleId;
                }
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["queId"]))
            {
                if (long.TryParse(context.Request.QueryString["queId"], out queId))
                {
                    resdep.department_id = queId;
                }
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["isActive"]) && context.Request.QueryString["isActive"] == "1")
            {
                resdep.is_active = 1;
            }
            else
            {
                resdep.is_active = 0;
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["isLead"]) && context.Request.QueryString["isLead"] == "1")
            {
                resdep.is_lead = 1;
            }
            else
            {
                resdep.is_lead = 0;
            }
            bool result = false; string faileReason = string.Empty;

            if (resdep.id == 0)
            {
                result = new DepartmentBLL().AddQueueResource(resdep, LoginUserId, ref faileReason);
            }
            else
            {
                result = new DepartmentBLL().EditQueueResource(resdep, LoginUserId, ref faileReason);
            }
            WriteResponseJson(new { result = result, reason = faileReason });
        }