Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var thisId = Request.QueryString["project_id"];
                if (!string.IsNullOrEmpty(thisId))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(thisId));
                }
                var taskId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    task = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                }
                if (thisProject != null)
                {
                    ShowNoteList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_NOTE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_NOTE + "&con1054=" + thisProject.id + "&con1055=";

                    actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE);
                    if (actList != null && actList.Count > 0)
                    {
                        actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList();
                    }
                }
                else if (task != null)
                {
                    account          = new BLL.CompanyBLL().GetCompany(task.account_id);
                    ShowNoteList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_NOTE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_NOTE + "&con1054=" + task.id + "&con1055=";
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 2
0
        protected decimal?searchRate       = null; // 该员工的实际的费率
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var thisId = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(thisId))
                {
                    thisEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(thisId));
                    if (thisEntry != null)
                    {
                        thisTask = new sdk_task_dal().FindNoDeleteById(thisEntry.task_id);
                    }
                }

                if (thisEntry == null || thisTask == null)
                {
                    Response.Write("<script>alert('未找到该工时信息!');window.close();self.opener.location.reload();</script>");
                }
                else
                {
                    if (thisEntry.contract_id != null)
                    {
                        var thisObject = new sdk_work_entry_dal().GetSingle($"select f_get_labor_rate({(long)thisEntry.contract_id},{thisEntry.cost_code_id.ToString()},{thisEntry.role_id.ToString()})");
                        if (thisObject != null)
                        {
                            searchRate = (decimal)thisObject;
                        }
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var thisContractId = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(thisContractId))
                {
                    thisContract = new ctt_contract_dal().FindNoDeleteById(long.Parse(thisContractId));
                }
                if (thisContract != null)
                {
                    ShowNoteList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_NOTE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_NOTE + "&con1054=" + thisContract.id;
                }

                var taskId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                }
                if (thisTask != null)
                {
                    ShowNoteList.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.PROJECT_NOTE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.PROJECT_NOTE + "&con1054=" + thisTask.id;
                    thisAccount      = new BLL.CompanyBLL().GetCompany(thisTask.account_id);
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var account_id = Request.QueryString["account_id"];

            if (!string.IsNullOrEmpty(account_id))
            {
                thisAccount = new CompanyBLL().GetCompany(long.Parse(account_id));
            }
            var ticket_id = Request.QueryString["ticket_id"];

            if (!string.IsNullOrEmpty(ticket_id))
            {
                thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id));
                if (thisTicket != null)
                {
                    thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                }
            }

            var info = new BLL.QueryCommonBLL().GetQueryGroup((int)DicEnum.QUERY_CATE.TICKET_ACCOUNT_LIST);

            if (info != null && info.Count > 0)
            {
                groupId = info[0].id;
            }
            if (thisAccount == null)
            {
                Response.Write("<script>alert('未查询到该客户信息!');window.close();</script>");
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var ticketId = Request.QueryString["ticket_id"];

            if (!string.IsNullOrEmpty(ticketId))
            {
                thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticketId));
            }
            if (thisTicket == null)
            {
                Response.Write("<script>alert('未查询到该工单信息!');window.close();</script>");
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long ticketId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["ticketId"]) && long.TryParse(Request.QueryString["ticketId"], out ticketId))
            {
                ticket = new TicketBLL().GetTask(ticketId);
            }

            if (ticket != null)
            {
                account = new CompanyBLL().GetCompany(ticket.account_id);
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var tId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(tId))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(tId));
                    if (thisTask != null)
                    {
                        objId = thisTask.id;
                    }
                }
                isFromTicket = !string.IsNullOrEmpty(Request.QueryString["fromTicket"]);

                if (thisTask == null)
                {
                    Response.End();
                }
                else
                {
                    catId       = (int)DicEnum.QUERY_CATE.TASK_HISTORY;
                    queryTypeId = (int)QueryType.TASK_HISTORY;
                    var groups = bll.GetQueryGroup(catId);
                    foreach (var g in groups)
                    {
                        if (g.query_type_id == queryTypeId)
                        {
                            if (paraGroupId != 0)   // 一个query_type下有多个group,不能判断使用哪个
                            {
                                Response.Close();
                                return;
                            }
                            paraGroupId = g.id;
                        }
                    }

                    QueryData();
                    CalcTableWidth();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var tId = Request.QueryString["ticket_id"];
         if (!string.IsNullOrEmpty(tId))
         {
             ticket = new sdk_task_dal().FindNoDeleteById(long.Parse(tId));
         }
         if (ticket == null)
         {
             Response.Write("<script>alert('主工单已经删除');window.close();</script>");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var callId   = Request.QueryString["callId"];
         var ticketId = Request.QueryString["ticketId"];
         if (!string.IsNullOrEmpty(callId) && !string.IsNullOrEmpty(ticketId))
         {
             thisTicketCall = new sdk_service_call_task_dal().GetSingTaskCall(long.Parse(callId), long.Parse(ticketId));
         }
         if (thisTicketCall == null)
         {
             Response.Write("<script>alert('未查询到相关信息,请重新打开');window.close();</script>");
             return;
         }
         else
         {
             thisTicket = new sdk_task_dal().FindNoDeleteById(thisTicketCall.task_id);
             if (thisTicket != null)
             {
                 ticketRes = new sdk_task_resource_dal().GetResByTaskId(thisTicket.id);
                 if (thisTicket.owner_resource_id != null)
                 {
                     priRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id);
                 }
                 resNameList = new sys_resource_dal().GetResByTicket(thisTicket.id);
             }
             else
             {
                 Response.Write("<script>alert('工单已删除');window.close();</script>");
                 return;
             }
             resList = new sdk_service_call_task_resource_dal().GetTaskResList(thisTicketCall.id);
             //resNameList
         }
     }
     catch (Exception msg)
     {
         Response.Write("<script>alert('" + msg.Message + "');window.close();</script>");
     }
 }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id));
                }
                if (thisEntry == null)
                {
                    Response.End();
                }
                else
                {
                    if (thisEntry.cost_code_id != null)
                    {
                        thisCost = new d_cost_code_dal().FindNoDeleteById((long)thisEntry.cost_code_id);
                        thisRate = new ContractRateBLL().GetRateByCodeAndRole((long)thisEntry.cost_code_id, (long)thisEntry.role_id);
                    }
                    thisTask = new sdk_task_dal().FindNoDeleteById(thisEntry.task_id);

                    if (thisTask != null && thisTask.project_id != null)
                    {
                        thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                        if (thisProject != null)
                        {
                            thisAccount = new CompanyBLL().GetCompany(thisProject.account_id);
                        }
                    }
                    if (thisEntry.contract_id != null)
                    {
                        thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisEntry.contract_id);
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 新增内部工时的时候新增Task
        /// </summary>
        public bool AddInterCodeTask(d_cost_code code, long userId)
        {
            if (code.cate_id != (int)DicEnum.COST_CODE_CATE.INTERNAL_ALLOCATION_CODE)
            {
                return(false);
            }
            var task = new TicketBLL().GetTask(code.id);

            if (task != null)
            {
                var oldCode = GetCodeById(code.id);
                code.id = _dal.GetNextIdCom();
                _dal.Update(code);
                OperLogBLL.OperLogUpdate <d_cost_code>(code, oldCode, code.id, userId, OPER_LOG_OBJ_CATE.D_COST_CODE, "");
                AddInterCodeTask(code, userId);
            }
            else
            {
                task = new sdk_task()
                {
                    id                 = code.id,
                    create_time        = Tools.Date.DateHelper.ToUniversalTimeStamp(),
                    update_time        = Tools.Date.DateHelper.ToUniversalTimeStamp(),
                    create_user_id     = userId,
                    update_user_id     = userId,
                    account_id         = 0,
                    title              = code.name,
                    no                 = new TaskBLL().ReturnTaskNo(),
                    status_id          = (int)DicEnum.TICKET_STATUS.NEW,
                    type_id            = (int)TASK_TYPE.INTERNAL_ALLOCATION_CODE,
                    last_activity_time = Tools.Date.DateHelper.ToUniversalTimeStamp(),
                };
                new sdk_task_dal().Insert(task);
                OperLogBLL.OperLogAdd <sdk_task>(task, task.id, userId, OPER_LOG_OBJ_CATE.PROJECT_TASK, "");
            }
            return(true);
        }
Exemplo n.º 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var taskId = Request.QueryString["task_id"];
         if (!string.IsNullOrEmpty(taskId))
         {
             thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
         }
         long id = 0;
         if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out id))
         {
             taskLib = new sdk_task_library_dal().FindNoDeleteById(id);
         }
         if (taskLib != null)
         {
             isAdd = false;
         }
     }
     catch (Exception msg)
     {
         Response.End();
     }
 }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var ticketId = Request.QueryString["ticket_id"];

            if (!string.IsNullOrEmpty(ticketId))
            {
                thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticketId));
            }
            if (thisTicket == null)
            {
                Response.Write($"<script>alert('工单已删除!');window.close();</script>");
                return;
            }
            else
            {
                thisOther = new sdk_task_other_person_dal().GetPerson(thisTicket.id, LoginUserId);
            }

            if (thisOther == null)
            {
                Response.Write($"<script>alert('工单审批人已删除!');window.close();</script>");
                return;
            }
        }
Exemplo n.º 14
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>");
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            actionTypeList = bll.GetCRMActionType();
            resourceList   = new UserResourceBLL().GetResourceList();

            if (!IsPostBack)
            {
                long noteid;
                if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out noteid))
                {
                    if (AuthBLL.GetUserTodoAuth(LoginUserId, LoginUser.security_Level_id, noteid).CanEdit == false)
                    {
                        Response.Write("<script>alert('您不能编辑此待办');</script>");
                        Response.End();
                        return;
                    }

                    note            = bll.GetActivity(noteid);
                    contactList     = new ContactBLL().GetContactByCompany((long)note.account_id);
                    opportunityList = new OpportunityBLL().GetOpportunityByCompany((long)note.account_id);
                    #region 记录浏览历史
                    var accountName = "";
                    if (note.account_id != null)
                    {
                        var account = new CompanyBLL().GetCompany((long)note.account_id);
                        accountName = account == null ? "" : account.name;
                    }
                    var history = new sys_windows_history()
                    {
                        title = "待办:" + note.description + ":" + accountName,
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                }

                if (long.TryParse(Request.QueryString["accountId"], out accountId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.CUSTOMER;
                    objId   = accountId;
                }
                if (long.TryParse(Request.QueryString["contactId"], out contactId))
                {
                    accountId = new ContactBLL().GetContact(contactId).account_id;
                    objType   = (int)DicEnum.OBJECT_TYPE.CONTACT;
                    objId     = contactId;
                }
                if (long.TryParse(Request.QueryString["opportunityId"], out opportunityId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.OPPORTUNITY;
                    objId   = opportunityId;
                    var opp = new OpportunityBLL().GetOpportunity(opportunityId).general;
                    accountId = opp.account_id;
                    if (opp.contact_id != null)
                    {
                        contactId = (long)opp.contact_id;
                    }
                }
                if (long.TryParse(Request.QueryString["saleorderId"], out saleOrderId))
                {
                    objType = (int)DicEnum.OBJECT_TYPE.SALEORDER;
                    objId   = saleOrderId;
                    var saleOrder = new SaleOrderBLL().GetSaleOrder(saleOrderId);
                    var opp       = new OpportunityBLL().GetOpportunity(saleOrder.opportunity_id).general;
                    opportunityId = opp.id;
                    accountId     = opp.account_id;
                    if (opp.contact_id != null)
                    {
                        contactId = (long)opp.contact_id;
                    }
                }
                if (long.TryParse(Request.QueryString["ticketId"], out ticketId))
                {
                    objType   = (int)DicEnum.OBJECT_TYPE.TICKETS;
                    objId     = ticketId;
                    ticket    = new DAL.sdk_task_dal().FindNoDeleteById(ticketId);
                    accountId = ticket.account_id;
                    if (ticket.contact_id != null)
                    {
                        contactId = (long)ticket.contact_id;
                    }
                    if (ticket.opportunity_id != null)
                    {
                        opportunityId = (long)ticket.opportunity_id;
                    }
                }
            }
            else
            {
                com_activity activity = AssembleModel <com_activity>();
                if (activity.contact_id == 0)
                {
                    activity.contact_id = null;
                }
                activity.start_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["start_date2"]));
                activity.end_date   = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["end_date2"]));

                if (!string.IsNullOrEmpty(Request.Form["is_completed"]) && Request.Form["is_completed"].Equals("on"))
                {
                    activity.status_id     = (int)DicEnum.ACTIVITY_STATUS.COMPLETED;
                    activity.complete_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["complete_time1"]));
                }
                else
                {
                    activity.status_id            = (int)DicEnum.ACTIVITY_STATUS.NOT_COMPLETED;
                    activity.complete_description = null;
                }

                if (string.IsNullOrEmpty(Request.Form["id"]))
                {
                    bll.AddTodo(activity, GetLoginUserId());
                }
                else
                {
                    bll.EditTodo(activity, GetLoginUserId());
                }

                if (Request.Form["action"] != null && Request.Form["action"].Equals("SaveNew"))
                {
                    Response.Write("<script>alert('保存待办成功');window.location.href='Notes.aspx';self.opener.location.reload();</script>");
                }
                else
                {
                    Response.Write("<script>alert('保存待办成功');window.close();self.opener.location.reload();</script>");
                }
            }
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                if (!IsPostBack)
                {
                    ThisPageDataBind();
                }
                task_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.TASK);
                var project_id = Request.QueryString["project_id"];
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = ppdal.FindNoDeleteById(long.Parse(project_id));
                }
                var parTaskId = Request.QueryString["par_task_id"];
                if (!string.IsNullOrEmpty(parTaskId))
                {
                    parTask = sdDal.FindNoDeleteById(long.Parse(parTaskId));
                    if (parTask != null)
                    {
                        if (parTask.project_id != null)
                        {
                            thisProject = ppdal.FindNoDeleteById((long)parTask.project_id);
                        }
                    }
                }

                var typeString = Request.QueryString["type_id"];
                if (!string.IsNullOrEmpty(typeString))
                {
                    type_id = int.Parse(typeString);
                    if (!IsPostBack)
                    {
                        switch (type_id)
                        {
                        case (int)DicEnum.TASK_TYPE.PROJECT_ISSUE:
                            isProject_issue.Checked = true;
                            break;

                        case (int)DicEnum.TASK_TYPE.PROJECT_TASK:
                            isProject_issue.Checked = false;
                            break;

                        default:
                            break;
                        }
                    }
                }
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisTask = sdDal.FindNoDeleteById(long.Parse(id));
                    if (thisTask != null)
                    {
                        if (thisTask.parent_id != null)
                        {
                            parTask = sdDal.FindNoDeleteById((long)thisTask.parent_id);
                        }
                        type_id = thisTask.type_id;
                        isAdd   = false;
                        var isCopyString = Request.QueryString["IsCopy"];
                        if (!string.IsNullOrEmpty(isCopyString) && thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_TASK)
                        {
                            isCopy = true;
                        }
                        if (thisTask.project_id != null)
                        {
                            thisProject = ppdal.FindNoDeleteById((long)thisTask.project_id);
                        }
                        task_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTask.id, task_udfList);
                        noteList          = new com_activity_dal().GetActiList($" and (task_id ={thisTask.id} or object_id={thisTask.id} )");

                        preList = new sdk_task_predecessor_dal().GetRelList(thisTask.id);
                        if (!IsPostBack)
                        {
                            status_id.SelectedValue = thisTask.status_id.ToString();
                            if (thisTask.is_visible_in_client_portal == 0)
                            {
                                DisplayInCapNone.Checked = true;
                            }
                            else
                            {
                                if (thisTask.can_client_portal_user_complete_task == 1)
                                {
                                    DisplayInCapYes.Checked = true;
                                }
                                else
                                {
                                    DisplayInCapYesNoComplete.Checked = true;
                                }
                            }

                            if (thisTask.is_project_issue == 1)
                            {
                                isProject_issue.Checked = true;
                            }
                            else
                            {
                                isProject_issue.Checked = false;
                            }

                            if (thisTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXWORK)
                            {
                                TaskTypeFixedWork.Checked = true;
                            }
                            else if (thisTask.estimated_type_id == (int)DicEnum.TIME_ENTRY_METHOD_TYPE.FIXDURATION)
                            {
                                TaskTypeFixedDuration.Checked = true;
                            }
                            else
                            {
                            }

                            department_id.SelectedValue = thisTask.department_id == null ? "" : ((int)thisTask.department_id).ToString();
                        }
                        var typeName = "任务";
                        //  判断是阶段,查询出相关项目的关联合同的里程碑  和自己的里程碑
                        if (type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE && thisProject != null && thisProject.contract_id != null)
                        {
                            typeName = "阶段";
                            // 获取该项目合同下未被关联的里程碑
                            var proConMilList = new ctt_contract_milestone_dal().GetListByProId(thisProject.id);
                            // 获取该阶段下的所有里程碑
                            var phaMilList = new sdk_task_milestone_dal().GetPhaMilList(thisTask.id);
                            thisPhaMile = new List <PageMile>();
                            if (proConMilList != null && proConMilList.Count > 0)
                            {
                                thisPhaMile.AddRange(proConMilList);
                            }
                            if (phaMilList != null && phaMilList.Count > 0)
                            {
                                thisPhaMile.AddRange(phaMilList);
                            }
                            if (thisPhaMile.Count > 0)
                            {
                                thisPhaMile = thisPhaMile.OrderBy(_ => _.dueDate).ToList();
                            }
                        }
                        #region 记录浏览历史
                        if (!isCopy && !isAdd)
                        {
                            var account = new CompanyBLL().GetCompany(thisTask.account_id);
                            var history = new sys_windows_history()
                            {
                                title = $"编辑{typeName}:" + (thisProject != null ? thisProject.name : "") + " " + thisTask.title + " " + (account != null ? account.name : ""),
                                url   = Request.RawUrl,
                            };
                            new IndexBLL().BrowseHistory(history, LoginUserId);
                        }
                        #endregion
                    }
                }
                if (type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE)
                {
                    isPhase = true;
                }

                if (thisProject == null)
                {
                    Response.End();
                }
                else
                {
                    if (thisProject.contract_id != null)
                    {
                        thisProContract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id);
                        rateList        = new ctt_contract_rate_dal().GetRateByConId((long)thisProject.contract_id);
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Exemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                showResList = new UserResourceBLL().GetAgentUser(LoginUserId, out isAllowAgentRes);

                isComplete = !string.IsNullOrEmpty(Request.QueryString["is_complete"]);
                if (!IsPostBack)
                {
                    GetPageDataBind();
                }
                var ticket_id = Request.QueryString["ticket_id"];
                if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id));
                    if (thisTicket != null)
                    {
                        if (thisTicket.contact_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id);
                        }
                        if (thisTicket.cost_code_id != null)
                        {
                            cost_code_id.SelectedValue = thisTicket.cost_code_id.ToString();
                        }
                    }
                }
                var service_id = Request.QueryString["service_id"];
                if (!string.IsNullOrEmpty(service_id))
                {
                    thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(service_id));
                }
                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    ticketLabour = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id));
                    if (ticketLabour != null)
                    {
                        isAdd      = false;
                        thisTicket = new sdk_task_dal().FindNoDeleteById(ticketLabour.task_id);
                        if (ticketLabour.resource_id != null)
                        {
                            resource_id.SelectedValue = ((long)ticketLabour.resource_id).ToString();
                        }
                        if (ticketLabour.cost_code_id != null)
                        {
                            cost_code_id.ClearSelection();
                            cost_code_id.SelectedValue = ticketLabour.cost_code_id.ToString();
                        }
                        if (ticketLabour.role_id != null)
                        {
                            role_id.SelectedValue = ticketLabour.role_id.ToString();
                        }
                        if (ticketLabour.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)ticketLabour.contract_id);
                        }
                    }
                }

                if (thisTicket != null)
                {
                    thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                    if (!isComplete)
                    {
                        status_id.SelectedValue = (thisTicket.status_id).ToString();
                    }
                    else
                    {
                        status_id.SelectedValue = ((int)DicEnum.TICKET_STATUS.DONE).ToString();
                    }
                }
                else
                {
                    Response.Write("<script>alert('未查询到该工单信息!');window.close();</script>");
                }

                if (thisAccount != null)
                {
                    accAlert = new crm_account_alert_dal().FindAlert(thisAccount.id, DicEnum.ACCOUNT_ALERT_TYPE.COMPANY_DETAIL_ALERT);
                }
            }
            catch (Exception msg)
            {
                Response.Write("<script>alert('" + msg.Message + "');window.close();</script>");
            }
        }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(id));
                if (thisTask != null && thisTask.project_id != null)
                {
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);
                    tvbDto.Add(new DictionaryEntryDto("type", "类型", 0));
                    tvbDto.Add(new DictionaryEntryDto("time", "操作时间", 0));
                    tvbDto.Add(new DictionaryEntryDto("resouName", "员工", 0));
                    tvbDto.Add(new DictionaryEntryDto("workHours", "实际工作时间", 0));
                    tvbDto.Add(new DictionaryEntryDto("notTiltle", "说明/标题", 0));
                    tvbDto.Add(new DictionaryEntryDto("billabled", "是否计费", 0));
                    tvbDto.Add(new DictionaryEntryDto("billed", "已计费", 0));

                    expDto.Add(new DictionaryEntryDto("type_id", "类型", 0));
                    expDto.Add(new DictionaryEntryDto("add_date", "费用日期", 0));
                    expDto.Add(new DictionaryEntryDto("create_user_id", "创建人", 0));
                    expDto.Add(new DictionaryEntryDto("expense_cost_code_id", "费用类别", 0));
                    expDto.Add(new DictionaryEntryDto("amount", "总额", 0));
                    expDto.Add(new DictionaryEntryDto("is_billable", "计费的", 0));
                    expDto.Add(new DictionaryEntryDto("approve_and_post_user_id", "已计费", 0));


                    v_task = new v_task_all_dal().FindById(thisTask.id);
                    if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_ISSUE)
                    {
                        taskType = "问题";
                    }
                    else if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_TASK)
                    {
                        taskType = "任务";
                    }
                    else
                    {
                        Response.End();
                    }
                    #region 记录浏览历史
                    var account = new CompanyBLL().GetCompany(thisTask.account_id);
                    var history = new sys_windows_history()
                    {
                        title = $"查看{taskType}:" + (thisProject != null ? thisProject.name : "") + " " + thisTask.title + " " + (account != null ? account.name : ""),
                        url   = Request.RawUrl,
                    };
                    new IndexBLL().BrowseHistory(history, LoginUserId);
                    #endregion
                    thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    if (thisProject != null)
                    {
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                        if (thisProject.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisProject.contract_id);
                        }
                    }
                    thisTaskResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTask.id);
                    var roleList = dic.FirstOrDefault(_ => _.Key == "role").Value as List <sys_role>;
                    var sysList  = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>;

                    #region 工时备注附件
                    var tasEntryList = new sdk_work_entry_dal().GetByTaskId(thisTask.id);
                    if (tasEntryList != null && tasEntryList.Count > 0)
                    {
                        var newList = (from a in tasEntryList
                                       join b in roleList on a.role_id equals b.id
                                       join c in sysList on a.resource_id equals long.Parse(c.val)
                                       select new TaskViewDto {
                            id = a.id, type = "entry", time = Tools.Date.DateHelper.ConvertStringToDateTime((long)(a.end_time ?? a.start_time)), resouName = c.show + "(" + b.name + ")", workHours = a.hours_worked, notTiltle = a.summary_notes, billabled = a.is_billable == 1?"✓":"", billed = a.approve_and_post_date == null?"": "✓", startDate = Tools.Date.DateHelper.ConvertStringToDateTime((long)a.start_time), workTypeId = a.cost_code_id, contractId = a.contract_id, showOnInv = a.show_on_invoice == 1, serviceId = a.service_id
                        }).ToList();

                        tvdList.AddRange(newList);
                    }
                    var conAttDal      = new com_attachment_dal();
                    var allTaskAttList = new List <com_attachment>();
                    var taskNoteList   = new com_activity_dal().GetActiList($" and (task_id ={thisTask.id} or object_id={thisTask.id} )");
                    if (taskNoteList != null && taskNoteList.Count > 0)
                    {
                        var newList = (from a in taskNoteList
                                       join c in sysList on a.resource_id equals long.Parse(c.val) into temp
                                       from tt in temp.DefaultIfEmpty()
                                       select new TaskViewDto {
                            id = a.id, type = "note", time = Tools.Date.DateHelper.ConvertStringToDateTime(a.create_time), resouName = tt == null ? "" : tt.show, notTiltle = a.name, noteDescr = a.description
                        }).ToList();
                        tvdList.AddRange(newList);

                        foreach (var thisTaskNote in taskNoteList)
                        {
                            var thisNoteAttList = conAttDal.GetAttListByOid(thisTaskNote.id);
                            if (thisNoteAttList != null && thisNoteAttList.Count > 0)
                            {
                                allTaskAttList.AddRange(thisNoteAttList);
                            }
                        }
                    }
                    var taskAttList = conAttDal.GetAttListByOid(thisTask.id);
                    if (taskAttList != null && taskAttList.Count > 0)
                    {
                        allTaskAttList.AddRange(taskAttList);
                    }
                    if (allTaskAttList.Count > 0)
                    {
                        var newList = (from a in allTaskAttList
                                       join c in sysList on a.create_user_id equals long.Parse(c.val) into temp
                                       from tt in temp.DefaultIfEmpty()
                                       select new TaskViewDto {
                            id = a.id, type = "atach", time = Tools.Date.DateHelper.ConvertStringToDateTime(a.create_time), resouName = tt == null?"":tt.show, notTiltle = a.title, fileType = a.type_id
                        }).ToList();
                        tvdList.AddRange(newList);
                    }
                    if (tvdList != null && tvdList.Count > 0)
                    {
                        tvbOrder = Request.QueryString["tvbOrder"];
                        tvdList  = tvdList.OrderBy(_ => _.time).ToList();
                        if (!string.IsNullOrEmpty(tvbOrder))
                        {
                            var tvbOrderArr = tvbOrder.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
                            var orderFile   = tvbDto.FirstOrDefault(_ => _.val == tvbOrderArr[0]);
                            if (tvbOrderArr[1] == "desc")
                            {
                                //tvdList = (from a in tvdList
                                //           orderby tvbOrderArr[0]  descending
                                //           select a).ToList();
                                tvdList.Sort(delegate(TaskViewDto t1, TaskViewDto t2) {
                                    return(GetObjectPropertyValue(t2, tvbOrderArr[0]).CompareTo(GetObjectPropertyValue(t1, tvbOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 2 : orderFile.select;
                            }
                            else
                            {
                                //tvdList = (from a in tvdList
                                //           orderby tvbOrderArr[0]
                                //           select a).ToList();
                                tvdList.Sort(delegate(TaskViewDto t1, TaskViewDto t2) {
                                    return(GetObjectPropertyValue(t1, tvbOrderArr[0]).CompareTo(GetObjectPropertyValue(t2, tvbOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 1 : orderFile.select;
                            }
                        }
                    }
                    #endregion

                    #region 费用
                    taskExpList = new sdk_expense_dal().GetExpByTaskId(thisTask.id);
                    if (taskExpList != null && taskExpList.Count > 0)
                    {
                        taskExpList = taskExpList.OrderByDescending(_ => _.add_date).ToList();
                        expOrder    = Request.QueryString["expOrder"];
                        if (!string.IsNullOrEmpty(expOrder))
                        {
                            var expOrderArr = expOrder.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            var orderFile   = expDto.FirstOrDefault(_ => _.val == expOrderArr[0]);
                            if (expOrderArr[1] == "desc")
                            {
                                //taskExpList = (from a in taskExpList
                                //           orderby expOrderArr[0] descending
                                //           select a).ToList();
                                taskExpList.Sort(delegate(sdk_expense t1, sdk_expense t2) {
                                    return(GetObjectPropertyValue(t2, expOrderArr[0]).CompareTo(GetObjectPropertyValue(t1, expOrderArr[0])));
                                });
                                orderFile.select = orderFile != null ? 2 : orderFile.select;
                            }
                            else
                            {
                                //taskExpList = (from a in taskExpList
                                //           orderby expOrderArr[0]
                                //           select a).ToList();
                                taskExpList.Sort(delegate(sdk_expense t1, sdk_expense t2) {
                                    return(GetObjectPropertyValue(t1, expOrderArr[0]).CompareTo(GetObjectPropertyValue(t2, expOrderArr[0])));
                                });

                                orderFile.select = orderFile != null ? 1 : orderFile.select;
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    Response.End();
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Exemplo n.º 19
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>");
            }
        }
Exemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long id = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out id))
            {
                deduction = invBll.GetDeduction(id);
            }

            //if (deduction == null)
            //{
            //    Response.Write("<script>alert('未获取到相关条目');window.close();</script>");
            //}
            long blockId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["blockId"]) && long.TryParse(Request.QueryString["blockId"], out blockId))
            {
                block = new ContractBlockBLL().GetBlockById(blockId);
            }

            if (deduction != null)
            {
                vItem   = new DAL.v_widget_posted_item_dal().FindById(deduction.id);
                rate    = vItem?.rate;
                account = new CompanyBLL().GetCompany(deduction.account_id);
                if (deduction.contract_id != null)
                {
                    contract = new ContractBLL().GetContract((long)deduction.contract_id);
                }
                if (deduction.task_id != null)
                {
                    task = new TicketBLL().GetTask((long)deduction.task_id);
                }
                labour = new WorkEntryBLL().GetEntryById((long)deduction.object_id);
                if (vItem?.tax_category_id != null && vItem?.tax_region_id != null)
                {
                    var thisTax = new DAL.d_tax_region_cate_dal().GetSingleTax((long)vItem?.tax_region_id, (long)vItem?.tax_category_id);
                    taxRate = thisTax?.total_effective_tax_rate;
                }
                if (vItem?.resource_id != null)
                {
                    resource = new UserResourceBLL().GetResourceById((long)vItem.resource_id);
                }
                if (deduction.contract_block_id != null)
                {
                    dedBlock = new ContractBlockBLL().GetBlockById((long)deduction.contract_block_id);
                }
            }
            if (block != null)
            {
                contract = new ContractBLL().GetContract(block.contract_id);
                if (contract != null)
                {
                    account      = new CompanyBLL().GetCompany(contract.account_id);
                    contractType = new GeneralBLL().GetSingleGeneral(contract.type_id);
                }
            }
            if (block == null && deduction == null)
            {
                Response.Write("<script>alert('未获取到相关条目');window.close();</script>");
            }
        }
Exemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId());
            var caDal  = new com_activity_dal();
            var stDal  = new sdk_task_dal();
            var ppDal  = new pro_project_dal();
            var accDal = new crm_account_dal();
            var ccDal  = new ctt_contract_dal();
            var id     = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(id))
            {
                thisNote = caDal.FindNoDeleteById(long.Parse(id));
                if (thisNote != null)
                {
                    isAdd = false;

                    thisNoteAtt = new com_attachment_dal().GetAttListByOid(thisNote.id);

                    thisTicket = stDal.FindNoDeleteById(thisNote.object_id);
                    if (thisTicket != null)
                    {
                        object_id = thisTicket.id;
                    }
                    else
                    {
                        thisProject = ppDal.FindNoDeleteById(thisNote.object_id);
                        if (thisProject != null)
                        {
                            object_id   = thisProject.id;
                            thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                        }
                        else
                        {
                            thisContract = ccDal.FindNoDeleteById(thisNote.object_id);
                            if (thisContract != null)
                            {
                                object_id   = thisContract.id;
                                thisAccount = accDal.FindNoDeleteById(thisContract.account_id);
                            }
                        }
                    }
                }
            }

            var ticketId = Request.QueryString["ticket_id"];

            if (!string.IsNullOrEmpty(ticketId))
            {
                thisTicket = stDal.FindNoDeleteById(long.Parse(ticketId));
            }
            if (thisTicket != null)
            {
                object_id = thisTicket.id;
                if (thisTicket.type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE)
                {
                    // isPhase = true;
                }
                if (thisTicket.contact_id != null)
                {
                    thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id);
                }
                thisAccount    = accDal.FindNoDeleteById(thisTicket.account_id);
                ticket_creator = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id);
                if (!IsPostBack)
                {
                    //status_id.SelectedValue = thisTicket.status_id.ToString();
                }

                if (thisTicket.project_id != null)
                {
                    thisProject = ppDal.FindNoDeleteById((long)thisTicket.project_id);
                    if (thisProject != null && thisAccount != null)
                    {
                        thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                    }
                }
            }
            if (thisAccount == null)
            {
                Response.End();
            }
            else
            {
                if (thisAccount.resource_id != null)
                {
                    thisAccManger = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id);
                }
            }

            if (!IsPostBack)
            {
                publish_type_id.DataTextField  = "name";
                publish_type_id.DataValueField = "id";
                var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE);
                if (pushList != null && pushList.Count > 0)
                {
                    pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TICKET_NOTE).ToString()).ToList();
                }
                publish_type_id.DataSource = pushList;
                publish_type_id.DataBind();

                status_id.DataTextField  = "show";
                status_id.DataValueField = "val";
                status_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value;
                status_id.DataBind();
                if (thisTicket != null)
                {
                    status_id.SelectedValue = thisTicket.status_id.ToString();
                }

                action_type_id.DataTextField  = "name";
                action_type_id.DataValueField = "id";
                var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE);
                actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                action_type_id.DataSource = actList;
                action_type_id.DataBind();


                if (thisNote != null)
                {
                    if (!IsPostBack)
                    {
                        if (thisNote.publish_type_id != null)
                        {
                            publish_type_id.SelectedValue = thisNote.publish_type_id.ToString();
                        }
                        action_type_id.SelectedValue = thisNote.action_type_id.ToString();
                    }
                }
                //else
                //{
                //    if (isContract)
                //    {
                //        publish_type_id.SelectedValue = ((int)DicEnum.NOTE_PUBLISH_TYPE.CONTRACT_INTERNA_USER).ToString();
                //    }
                //}

                var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.NONE);
                notify_id.DataTextField  = "name";
                notify_id.DataValueField = "id";
                notify_id.DataSource     = tempList;
                notify_id.DataBind();
            }
        }
Exemplo n.º 22
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>");
            }
        }
Exemplo n.º 23
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
            }
        }
Exemplo n.º 24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
         var callId   = Request.QueryString["callId"];
         var tickeTId = Request.QueryString["ticketId"];
         if (!string.IsNullOrEmpty(callId))
         {
             thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(callId));
         }
         if (!string.IsNullOrEmpty(tickeTId))
         {
             thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(tickeTId));
         }
         if (thisTicket != null)
         {
             thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
             if (thisTicket.contact_id != null)
             {
                 ticketCon = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id);
             }
             resList = new List <sys_resource>();
             var srDal = new sys_resource_dal();
             if (thisTicket.owner_resource_id != null)
             {
                 var priRes = srDal.FindNoDeleteById((long)thisTicket.owner_resource_id);
                 if (priRes != null)
                 {
                     resList.Add(priRes);
                 }
             }
             var other = srDal.GetResByTicket(thisTicket.id);
             if (other != null && other.Count > 0)
             {
                 resList.AddRange(other);
             }
         }
         if (thisCall != null && thisTicket != null)
         {
             thisCallTask = new sdk_service_call_task_dal().GetSingTaskCall(thisCall.id, thisTicket.id);
             thisAccount  = new CompanyBLL().GetCompany(thisCall.account_id);
         }
         var callTaskId = Request.Form["id"];
         if (!string.IsNullOrEmpty(callTaskId))
         {
             thisCallTask = new sdk_service_call_task_dal().FindNoDeleteById(long.Parse(callTaskId));
         }
         if (thisCallTask != null)
         {
             isAdd       = false;
             serResList  = new sdk_service_call_task_resource_dal().GetTaskResList(thisCallTask.id);
             callCreater = new sys_resource_dal().FindNoDeleteById(thisCallTask.id);
         }
         var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
         if (thisAccount != null)
         {
             if (thisAccount.resource_id != null)
             {
                 accMan = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id);
             }
             accCallList = new sdk_service_call_dal().GetCallByAccount(thisAccount.id);
             if (accCallList != null && accCallList.Count > 0)
             {
                 pageCallList = (from a in accCallList
                                 join b in statusList on a.status_id equals b.id
                                 select new CallDto {
                     id = a.id, startDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(a.start_time).ToString("yyyy-MM-dd HH:mm"), endDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(a.end_time).ToString("yyyy-MM-dd HH:mm"), statusId = a.status_id, statusName = b.name, isLimtThri = (timeNow - a.start_time) > (2592000000)
                 }).ToList();
                 // 2592000000 = 30 * 24 * 60 * 60 * 1000  30天的毫秒数
             }
         }
         else
         {
             Response.Write($"<script>alert('为获取到相关客户信息,请重新打开!');window.close();</script>");
             return;
         }
     }
     catch (Exception msg)
     {
         Response.Write($"<script>alert('{msg.Message}!');window.close();</script>");
     }
 }
Exemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var cost_id     = Request.QueryString["id"];
                var contract_id = Request.QueryString["contract_id"];
                var project_id  = Request.QueryString["project_id"];
                var task_id     = Request.QueryString["task_id"];
                var ticket_id   = Request.QueryString["ticket_id"];
                var costCodeId  = Request.QueryString["cost_code_id"];
                if (!string.IsNullOrEmpty(costCodeId))
                {
                    costCode = new d_cost_code_dal().FindNoDeleteById(long.Parse(costCodeId));
                }

                #region  拉框赋值
                cost_type_id.DataTextField  = "show";
                cost_type_id.DataValueField = "val";
                cost_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "chargeType").Value;
                cost_type_id.DataBind();
                cost_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                cost_type_id.SelectedValue = ((int)DicEnum.COST_TYPE.OPERATIONA).ToString();

                // status_id
                status_id.DataTextField  = "show";
                status_id.DataValueField = "val";
                var statuList = dic.FirstOrDefault(_ => _.Key == "chargeStatus").Value as List <DictionaryEntryDto>;

                #endregion
                if (!string.IsNullOrEmpty(contract_id))
                {
                    contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                    if (contract != null)
                    {
                        if (!IsPostBack)
                        {
                            isbillable.Checked = true;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(cost_id))
                {
                    conCost = new ctt_contract_cost_dal().FindNoDeleteById(long.Parse(cost_id));
                    if (conCost != null)
                    {
                        isAdd    = false;
                        costCode = new d_cost_code_dal().FindNoDeleteById(conCost.cost_code_id);

                        cost_type_id.SelectedValue = conCost.cost_type_id == null ? ((int)DicEnum.COST_TYPE.OPERATIONA).ToString() : conCost.cost_type_id.ToString();
                        if (!IsPostBack)
                        {
                            status_id.SelectedValue = conCost.status_id.ToString();
                        }


                        if (conCost.contract_id != null)
                        {
                            contract = new ctt_contract_dal().FindNoDeleteById((long)conCost.contract_id);
                        }
                        if (conCost.project_id != null)
                        {
                            thisProject = new pro_project_dal().FindNoDeleteById((long)conCost.project_id);
                        }
                        if (conCost.task_id != null)
                        {
                            thisTask = new sdk_task_dal().FindNoDeleteById((long)conCost.task_id);
                            if (thisTask.type_id == (int)DicEnum.TASK_TYPE.SERVICE_DESK_TICKET)
                            {
                                thisTask   = null;
                                thisTicket = new sdk_task_dal().FindNoDeleteById((long)conCost.task_id);
                            }
                        }

                        if (!IsPostBack)
                        {
                            isbillable.Checked    = conCost.is_billable == 1;
                            AddConfigItem.Checked = conCost.create_ci == 1;
                        }

                        if (conCost.status_id == (int)DicEnum.COST_STATUS.UNDETERMINED)
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.PENDING_PURCHASE).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                        else if (conCost.status_id == (int)DicEnum.COST_STATUS.CANCELED)
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.PENDING_PURCHASE).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                        else
                        {
                            statuList = statuList.Where(_ => _.val == (conCost.status_id).ToString() || _.val == ((int)DicEnum.COST_STATUS.CANCELED).ToString()).ToList();
                        }
                    }
                }
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                }
                if (!string.IsNullOrEmpty(task_id))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(task_id));
                    if (thisTask != null && thisTask.project_id != null)
                    {
                        thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    }
                }
                if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id));
                }
                if (thisTicket != null)
                {
                    thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                }

                status_id.DataSource = statuList;
                status_id.DataBind();
                //status_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                if (!IsPostBack)
                {
                    if (isAdd)
                    {
                        status_id.SelectedValue = ((int)DicEnum.COST_STATUS.PENDING_DELIVERY).ToString();
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Exemplo n.º 26
0
        protected bool isFromReport             = false; // 是否从报表页面进行新增操作
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    PageDataBind();
                }
                isShowWorkType = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_EXPENSE_SHOW_WORK_TYPE) == "1";// SDK_EXPENSE_SHOW_WORK_TYPE
                var seDal = new sdk_expense_dal();
                var stDal = new sdk_task_dal();
                var eId   = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(eId))
                {
                    thisExpense = seDal.FindNoDeleteById(long.Parse(eId));
                    if (thisExpense != null)
                    {
                        if (thisExpense.approve_and_post_date != null || thisExpense.approve_and_post_user_id != null)
                        {
                            Response.Write("<script>alert('审批提交的费用不可以更改!')window.close();</script>");
                            Response.End();
                        }
                        if (!new TaskBLL().CanEditExpense(thisExpense.id))
                        {
                            Response.Write("<script>alert('相关报表状态已经更改,不可以进行编辑!');window.close();</script>");
                            Response.End();
                        }

                        isAdd = false;

                        if (!IsPostBack)
                        {
                            if (thisExpense.cost_code_id != null)
                            {
                                cost_code_id.SelectedValue = thisExpense.cost_code_id.ToString();
                            }
                            expense_cost_code_id.SelectedValue = thisExpense.expense_cost_code_id.ToString();
                            RDAddExiRep.Checked           = true;
                            isBillable.Checked            = thisExpense.is_billable == 1;
                            payment_type_id.SelectedValue = thisExpense.payment_type_id.ToString();
                            hasReceipt.Checked            = thisExpense.has_receipt == 1;
                            if (thisExpense.project_id != null)
                            {
                                rbAssProTask.Checked = true;
                            }
                            else
                            {
                                rbAssNone.Checked = true;
                            }
                        }

                        if (thisExpense.project_id != null)
                        {
                            thisProject = new pro_project_dal().FindNoDeleteById((long)thisExpense.project_id);
                        }
                        if (thisExpense.project_id != null && thisExpense.task_id != null)
                        {
                            thisTask = new sdk_task_dal().FindNoDeleteById((long)thisExpense.task_id);
                        }
                        if (thisExpense.project_id == null && thisExpense.task_id != null)
                        {
                            thisTicket = new sdk_task_dal().FindNoDeleteById((long)thisExpense.task_id);
                        }
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisExpense.account_id);
                        thisExpRep  = new sdk_expense_report_dal().FindNoDeleteById(thisExpense.expense_report_id);
                    }
                }
                var task_id = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(task_id))
                {
                    thisTask = stDal.FindNoDeleteById(long.Parse(task_id));
                    if (thisTask != null && thisTask.project_id != null)
                    {
                        thisProject = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                        if (thisProject != null)
                        {
                            thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                        }
                    }
                }
                var project_id = Request.QueryString["project_id"];
                if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(project_id));
                    if (thisProject != null)
                    {
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisProject.account_id);
                    }
                }

                var report_id = Request.QueryString["report_id"];
                if (!string.IsNullOrEmpty(report_id))
                {
                    thisExpRep = new sdk_expense_report_dal().FindNoDeleteById(long.Parse(report_id));
                    if (thisExpRep != null)
                    {
                        isFromReport = true;
                        thisAccount  = new CompanyBLL().GetDefaultAccount();
                    }
                }

                var ticket_id = Request.QueryString["ticket_id"];
                if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(ticket_id));
                    if (thisTicket != null)
                    {
                        thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id);
                    }
                }
            }
            catch (Exception msg)
            {
                Response.End();
            }
        }
Exemplo n.º 27
0
        protected bool noTime = false;      // 可以不输入开始结束时间(根据系统设置进行判断)
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //  是否需要输入开始结束时间
                var isNeedTimeString = Request.QueryString["NoTime"];
                var noTimeSet        = new SysSettingBLL().GetSetById(SysSettingEnum.SDK_ENTRY_REQUIRED);
                if (!string.IsNullOrEmpty(isNeedTimeString))
                {
                    if (noTimeSet != null && noTimeSet.setting_value == "0")
                    {
                        noTime = true;
                    }
                }
                var callId = Request.QueryString["callId"];
                if (!string.IsNullOrEmpty(callId))
                {
                    thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(callId));
                }
                thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId());
                var resList = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value as List <DictionaryEntryDto>;
                if (!IsPostBack)
                {
                    resource_id.DataTextField  = "show";
                    resource_id.DataValueField = "val";
                    var  entryProxySet = new SysSettingBLL().GetValueById(SysSettingEnum.SDK_ENTRY_PROXY);
                    bool isAgent       = false;
                    if (entryProxySet == ((int)DicEnum.PROXY_TIME_ENTRY.DISABLED).ToString())
                    {
                        if (resList != null && resList.Count > 0)
                        {
                            resList = resList.Where(_ => _.val == LoginUserId.ToString()).ToList();
                        }
                    }
                    else
                    {
                        var agentResList = new UserResourceBLL().GetAgentUser(LoginUserId, out isAgent);
                        if (agentResList != null && agentResList.Count > 0)
                        {
                            resList = (from a in agentResList
                                       select new DictionaryEntryDto()
                            {
                                val = a.id.ToString(), show = a.name
                            }).ToList();
                        }
                    }
                    resource_id.DataSource    = resList;
                    resource_id.SelectedValue = LoginUserId.ToString();
                    resource_id.DataBind();

                    var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>;
                    //statusList.Remove(statusList.FirstOrDefault(_=>_.val==((int)DicEnum.TICKET_STATUS.NEW).ToString()));
                    status_id.DataTextField  = "show";
                    status_id.DataValueField = "val";
                    status_id.DataSource     = statusList;
                    status_id.DataBind();


                    cost_code_id.DataTextField  = "name";
                    cost_code_id.DataValueField = "id";
                    cost_code_id.DataSource     = new d_cost_code_dal().GetCostCodeByWhere((int)DicEnum.COST_CODE_CATE.GENERAL_ALLOCATION_CODE);
                    cost_code_id.DataBind();

                    notify_id.DataTextField  = "name";
                    notify_id.DataValueField = "id";
                    notify_id.DataSource     = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.TICKET_TIME_ENTRY_CREATED_EDITED);
                    notify_id.DataBind();
                }

                var taskId = Request.QueryString["task_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTask = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId));
                }

                var id = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisWorkEntry = new sdk_work_entry_dal().FindNoDeleteById(long.Parse(id));
                    if (thisWorkEntry != null)
                    {
                        if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null)
                        {
                            Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>");
                            Response.End();
                        }

                        if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString()))
                        {
                            Response.Write("<script>alert('系统设置不能代理操作!');window.close();</script>");
                            return;
                        }
                        if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0")
                        {
                            noTime = true;
                        }
                        entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id);
                        isAdd     = false;
                        thisTask  = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id);
                        if (!IsPostBack)
                        {
                            resource_id.ClearSelection();
                            resource_id.SelectedValue  = ((long)thisWorkEntry.resource_id).ToString();
                            cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString();
                            // status_id.SelectedValue = ((long)thisWorkEntry.)
                            // thisTask  = new crm_account_dal().FindNoDeleteById(thisWorkEntry.);
                        }

                        if (thisWorkEntry.contract_id != null)
                        {
                            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id);
                        }
                        if (!IsPostBack)
                        {
                            isBilled.Checked  = thisWorkEntry.is_billable == 0;
                            ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1;
                            if (isBilled.Checked)
                            {
                                ShowOnInv.Enabled = true;
                            }
                        }
                    }
                    else
                    {
                        Response.Write("<script>alert('工时已被删除!')window.close();</script>");
                        Response.End();
                    }
                }
                #region 根据批次获取相关工时
                //var batchId = Request.QueryString["batchId"];
                //if (!string.IsNullOrEmpty(batchId))
                //{
                //    entryList = new sdk_work_entry_dal().GetBatchList(long.Parse(batchId));
                //    if(entryList!=null&& entryList.Count > 0)
                //    {
                //        thisWorkEntry = entryList[0];
                //        if (thisWorkEntry.approve_and_post_date != null || thisWorkEntry.approve_and_post_user_id != null)
                //        {
                //            Response.Write("<script>alert('审批提交的工时不可以更改!');window.close();</script>");
                //            Response.End();
                //        }

                //        if (!resList.Any(_ => _.val == thisWorkEntry.create_user_id.ToString()))
                //        {
                //            Response.Write("<script>alert('系统设置不能代理操作!')window.close();</script>");
                //            Response.End();
                //        }
                //        if (thisWorkEntry.end_time == null && noTimeSet != null && noTimeSet.setting_value == "0")
                //        {
                //            noTime = true;
                //        }
                //        entryList = new sdk_work_entry_dal().GetBatchList(thisWorkEntry.batch_id);
                //        isAdd = false;
                //        thisTask = new sdk_task_dal().FindNoDeleteById(thisWorkEntry.task_id);
                //        if (!IsPostBack)
                //        {
                //            resource_id.SelectedValue = ((long)thisWorkEntry.resource_id).ToString();
                //            cost_code_id.SelectedValue = ((long)thisWorkEntry.cost_code_id).ToString();
                //            // status_id.SelectedValue = ((long)thisWorkEntry.)
                //            // thisTask  = new crm_account_dal().FindNoDeleteById(thisWorkEntry.);

                //        }

                //        if (thisWorkEntry.contract_id != null)
                //        {
                //            thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisWorkEntry.contract_id);
                //        }
                //        if (!IsPostBack)
                //        {
                //            isBilled.Checked = thisWorkEntry.is_billable == 0;
                //            ShowOnInv.Checked = thisWorkEntry.show_on_invoice == 1;
                //            if (isBilled.Checked)
                //            {
                //                ShowOnInv.Enabled = true;
                //            }
                //        }
                //    }
                //}
                #endregion
                if (thisTask != null)
                {
                    v_task      = new v_task_all_dal().FindById(thisTask.id);
                    thisProjetc = new pro_project_dal().FindNoDeleteById((long)thisTask.project_id);
                    if (thisProjetc != null)
                    {
                        thisAccount = new crm_account_dal().FindNoDeleteById(thisProjetc.account_id);
                        if (!IsPostBack)
                        {
                            status_id.SelectedValue = thisTask.status_id.ToString();
                        }
                    }
                }
                // 项目关联合同,并且合同中设置-工时录入需要输入开始结束时间
                if (thisProjetc != null && thisProjetc.contract_id != null)
                {
                    var thisCttContract = new ctt_contract_dal().FindNoDeleteById((long)thisProjetc.contract_id);
                    if (thisCttContract != null)
                    {
                        if (thisCttContract.timeentry_need_begin_end == 1)
                        {
                            noTime = false;
                        }
                    }
                }

                if (thisCall != null)
                {
                    showStartDate = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.start_time);
                    showEndDate   = EMT.Tools.Date.DateHelper.ConvertStringToDateTime(thisCall.end_time);
                }
                if (!string.IsNullOrEmpty(Request.QueryString["chooseDate"]))
                {
                    showStartDate = DateTime.Parse(Request.QueryString["chooseDate"]);
                    showEndDate   = DateTime.Parse(Request.QueryString["chooseDate"]);
                }
            }
            catch (Exception msg)
            {
                Response.Write($"<script>alert('{msg.Message}');window.close();</script>");
            }
        }
Exemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisUser = new sys_resource_dal().FindNoDeleteById(GetLoginUserId());
                var caDal  = new com_activity_dal();
                var stDal  = new sdk_task_dal();
                var ppDal  = new pro_project_dal();
                var accDal = new crm_account_dal();
                var ccDal  = new ctt_contract_dal();
                var id     = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(id))
                {
                    thisNote = caDal.FindNoDeleteById(long.Parse(id));
                    if (thisNote != null)
                    {
                        isAdd = false;

                        thisNoteAtt = new com_attachment_dal().GetAttListByOid(thisNote.id);

                        thisTask = stDal.FindNoDeleteById(thisNote.object_id);
                        if (thisTask != null)
                        {
                            object_id = thisTask.id;
                            if (thisTask.type_id == (int)DicEnum.TASK_TYPE.SERVICE_DESK_TICKET)
                            {
                                isTicket   = true;
                                thisTask   = null;
                                thisTicket = stDal.FindNoDeleteById(thisNote.object_id);
                            }
                        }
                        else
                        {
                            thisProject = ppDal.FindNoDeleteById(thisNote.object_id);
                            if (thisProject != null)
                            {
                                isProject   = true;
                                object_id   = thisProject.id;
                                thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                            }
                            else
                            {
                                thisContract = ccDal.FindNoDeleteById(thisNote.object_id);
                                if (thisContract != null)
                                {
                                    isContract  = true;
                                    object_id   = thisContract.id;
                                    thisAccount = accDal.FindNoDeleteById(thisContract.account_id);
                                }
                            }
                        }
                    }
                }
                var taskId      = Request.QueryString["task_id"];
                var project_id  = Request.QueryString["project_id"];
                var contract_id = Request.QueryString["contract_id"];
                var ticket_id   = Request.QueryString["ticket_id"];
                var call_id     = Request.QueryString["call_id"];
                if (!string.IsNullOrEmpty(taskId))
                {
                    thisTask = stDal.FindNoDeleteById(long.Parse(taskId));
                }
                else if (!string.IsNullOrEmpty(project_id))
                {
                    thisProject = ppDal.FindNoDeleteById(long.Parse(project_id));
                    if (thisProject != null)
                    {
                        isProject   = true;
                        object_id   = thisProject.id;
                        thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                    }
                }
                else if (!string.IsNullOrEmpty(contract_id))
                {
                    thisContract = ccDal.FindNoDeleteById(long.Parse(contract_id));
                    if (thisContract != null)
                    {
                        object_id   = thisContract.id;
                        thisAccount = accDal.FindNoDeleteById(thisContract.account_id);
                        isContract  = true;
                    }
                }
                else if (!string.IsNullOrEmpty(ticket_id))
                {
                    thisTicket = stDal.FindNoDeleteById(long.Parse(ticket_id));
                }
                else if (!string.IsNullOrEmpty(call_id))
                {
                    thisCall = new sdk_service_call_dal().FindNoDeleteById(long.Parse(call_id));
                    if (thisCall != null)
                    {
                        isCall         = true;
                        thisAccount    = new CompanyBLL().GetCompany(thisCall.account_id);
                        callTicketList = stDal.GetTciketByCall(thisCall.id);
                        if (callTicketList != null && callTicketList.Count > 0)
                        {
                            thisTask = callTicketList[0];
                            if (callTicketList.Any(_ => _.id != thisTask.id && _.status_id != thisTask.status_id))
                            {
                                isMantStatus = true;
                            }
                            if (callTicketList.Any(_ => _.id != thisTask.id && _.account_id != thisTask.account_id))
                            {
                                isManyAccount = true;
                            }
                            if (callTicketList.Any(_ => _.id != thisTask.id && _.title != thisTask.title))
                            {
                                isManyTitle = true;
                            }
                        }
                        else
                        {
                            Response.Write("<script>alert('服务预定下暂无工单!');window.close();</script>");
                            return;
                        }
                    }
                }


                if (thisTask != null)
                {
                    thisAccount = accDal.FindNoDeleteById(thisTask.account_id);
                    object_id   = thisTask.id;
                    if (thisTask.type_id == (int)DicEnum.TASK_TYPE.PROJECT_PHASE)
                    {
                        isPhase = true;
                    }
                    task_creator = new sys_resource_dal().FindNoDeleteById(thisTask.create_user_id);
                    if (thisTask.project_id != null)
                    {
                        thisProject = ppDal.FindNoDeleteById((long)thisTask.project_id);
                        if (thisProject != null)
                        {
                            thisAccount = accDal.FindNoDeleteById(thisProject.account_id);
                        }
                    }
                }
                if (thisTicket != null)
                {
                    isTicket     = true;
                    object_id    = thisTicket.id;
                    task_creator = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id);
                    thisAccount  = accDal.FindNoDeleteById(thisTicket.account_id);
                    if (thisTicket.contact_id != null)
                    {
                        thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id);
                    }
                }
                if (thisAccount == null)
                {
                    Response.End();
                }
                else
                {
                    if (thisAccount.resource_id != null)
                    {
                        thisAccManger = new sys_resource_dal().FindNoDeleteById((long)thisAccount.resource_id);
                    }
                }
                if (!IsPostBack)
                {
                    publish_type_id.DataTextField  = "name";
                    publish_type_id.DataValueField = "id";
                    var pushList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.NOTE_PUBLISH_TYPE);
                    if (pushList != null && pushList.Count > 0)
                    {
                        if (isProject)
                        {
                            pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList();
                        }
                        else if (isContract)
                        {
                            pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.CONTRACT_NOTE).ToString()).ToList();
                        }
                        else if (isTicket)
                        {
                            pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                        else
                        {
                            pushList = pushList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                    }
                    publish_type_id.DataSource = pushList;
                    publish_type_id.DataBind();

                    status_id.DataTextField  = "show";
                    status_id.DataValueField = "val";
                    var statusList = dic.FirstOrDefault(_ => _.Key == "ticket_status").Value as List <DictionaryEntryDto>;
                    if (isMantStatus)
                    {
                        statusList.Add(new DictionaryEntryDto()
                        {
                            val = "0", show = "多个值,保持不变"
                        });
                    }
                    status_id.DataSource = statusList;
                    status_id.DataBind();
                    if (isMantStatus)
                    {
                        status_id.SelectedValue = "0";
                    }
                    else if (thisTask != null)
                    {
                        status_id.SelectedValue = thisTask.status_id.ToString();
                    }
                    else if (thisTicket != null)
                    {
                        status_id.SelectedValue = thisTicket.status_id.ToString();
                    }
                    action_type_id.DataTextField  = "name";
                    action_type_id.DataValueField = "id";
                    var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE);
                    if (actList != null && actList.Count > 0)
                    {
                        if (isProject)
                        {
                            actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.PROJECT_NOTE).ToString()).ToList();
                        }
                        else if (isContract)
                        {
                            actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.CONTRACT_NOTE).ToString()).ToList();
                        }
                        else if (isTicket)
                        {
                            actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                        else
                        {
                            actList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList();
                        }
                    }
                    action_type_id.DataSource = actList;
                    action_type_id.DataBind();
                    if (thisNote != null)
                    {
                        if (!IsPostBack)
                        {
                            if (thisNote.publish_type_id != null)
                            {
                                publish_type_id.SelectedValue = thisNote.publish_type_id.ToString();
                            }
                            action_type_id.SelectedValue = thisNote.action_type_id.ToString();
                            isAnnounce.Checked           = thisNote.announce == 1;
                        }
                    }
                    else
                    {
                        if (isContract)
                        {
                            publish_type_id.SelectedValue = ((int)DicEnum.NOTE_PUBLISH_TYPE.CONTRACT_INTERNA_USER).ToString();
                        }
                    }

                    var tempList = new sys_notify_tmpl_dal().GetTempByEvent(DicEnum.NOTIFY_EVENT.NONE);
                    notify_id.DataTextField  = "name";
                    notify_id.DataValueField = "id";
                    notify_id.DataSource     = tempList;
                    notify_id.DataBind();
                }

                if (isProject)
                {
                    tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.PROJECT_NOTE, LoginUserId);
                }
                else if (isTicket && thisTicket != null)
                {
                    tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.TICKET_NOTE, LoginUserId);
                }
                else if (thisTask != null)
                {
                    tmplList = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.TASK_NOTE, LoginUserId);
                }
            }
            catch (Exception msg)
            {
                Response.Write(msg);
                Response.End();
            }
        }