示例#1
0
 protected List <sdk_expense> expList    = null;   // 报表下的费用
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var thisId = Request.QueryString["id"];
         if (!string.IsNullOrEmpty(thisId))
         {
             thisReport = new sdk_expense_report_dal().FindNoDeleteById(long.Parse(thisId));
         }
         if (thisReport == null)
         {
             Response.Write("<script>alert('报表已删除');window.close();</script>");
         }
         else if (thisReport.status_id != (int)DTO.DicEnum.EXPENSE_REPORT_STATUS.WAITING_FOR_APPROVAL)
         {
             Response.Write("<script>alert('报表的状态必须是待审批!');window.close();</script>");
         }
         else
         {
             if (thisReport.submit_user_id != null)
             {
                 subRes = new sys_resource_dal().FindNoDeleteById((long)thisReport.submit_user_id);
             }
             expList = new sdk_expense_dal().GetExpByReport(thisReport.id);
         }
     }
     catch (Exception msg)
     {
         Response.Write($"<script>alert('{msg.Message}!');window.close();</script>");
     }
 }
示例#2
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))
            {
                thisActivity = new ActivityBLL().GetActivity(id);
            }


            if (thisActivity == null)
            {
                Response.Write("<script>alert('为获取到相关信息!请刷新页面后重试!');window.close();</script>");
            }
            else
            {
                if (thisActivity.account_id != null)
                {
                    account = new CompanyBLL().GetCompany((long)thisActivity.account_id);
                }
                if (thisActivity.resource_id != null)
                {
                    assignUser = new UserResourceBLL().GetResourceById((long)thisActivity.resource_id);
                }
                createUser = new UserResourceBLL().GetResourceById(thisActivity.create_user_id);

                actType = new GeneralBLL().GetSingleGeneral(thisActivity.action_type_id, true);

                if (thisActivity.action_type_id == (int)DTO.DicEnum.ACTIVITY_CATE.TODO)
                {
                    isTodo = true;
                }
            }
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["type"]) && Request.QueryString["type"] == "expense")
            {
                type = "expense";
            }
            long resId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["resId"]) && long.TryParse(Request.QueryString["resId"], out resId))
            {
                thisRes = new UserResourceBLL().GetResourceById(resId);
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long objId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                long.TryParse(Request.QueryString["id"], out objId);
            }
            if (objId != 0)
            {
                thisRes = userBll.GetResourceById(objId);
            }

            if (thisRes == null)
            {
                Response.Write("<script>alert('未获取到相关员工信息');window.close();</script>");
            }
        }
 public static void AssertAreEqual(sys_resource expected, sys_resource actual)
 {
     Assert.AreEqual(expected.url, actual.url);
     Assert.AreEqual(expected.parent_id, actual.parent_id);
     Assert.AreEqual(expected.Description, actual.Description);
     Assert.AreEqual(expected.tree_level, actual.tree_level);
     Assert.AreEqual(expected.deleted, actual.deleted);
     Assert.AreEqual(expected.update_time, actual.update_time);
     Assert.AreEqual(expected.is_show, actual.is_show);
     Assert.AreEqual(expected.icon_class, actual.icon_class);
     Assert.AreEqual(expected.update_user, actual.update_user);
     Assert.AreEqual(expected.Name, actual.Name);
     Assert.AreEqual(expected.btn_type, actual.btn_type);
     Assert.AreEqual(expected.create_user, actual.create_user);
     Assert.AreEqual(expected.remark, actual.remark);
     Assert.AreEqual(expected.create_time, actual.create_time);
     Assert.AreEqual(expected.type, actual.type);
     Assert.AreEqual(expected.sort, actual.sort);
 }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var accountId = Request.QueryString["accountId"];

            if (!string.IsNullOrEmpty(accountId))
            {
                account = comBll.GetCompany(long.Parse(accountId));
            }
            if (account == null)
            {
                Response.Write("<script>alert('未获取到客户信息');window.close();</script>");
                return;
            }
            accLocation = new DAL.crm_location_dal().GetLocationByAccountId(account.id);
            if (accLocation != null)
            {
                var disDal = new DAL.d_district_dal();
                if (accLocation.country_id != null)
                {
                    var country = new DAL.d_country_dal().FindById((long)accLocation.country_id);
                    countryName = country != null ? country.country_name_display : "";
                }
                var province = disDal.FindById((long)accLocation.province_id);
                provinceName = province != null ? province.name : "";
                var city = disDal.FindById((long)accLocation.city_id);
                cityName = city != null ? city.name : "";
                var district = disDal.FindById((long)accLocation.district_id);
                districtName = district != null ? district.name : "";
            }
            if (account.resource_id != null)
            {
                accMan = new DAL.sys_resource_dal().FindNoDeleteById((long)account.resource_id);
            }
            startDate = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01");
            endDate   = startDate.AddMonths(1).AddDays(-1);

            contractMoney = new DAL.crm_account_deduction_dal().GetContractSum(account.id, startDate, endDate);
            projectMoney  = new DAL.crm_account_deduction_dal().GetProjectSum(account.id, startDate, endDate);
            if (account.classification_id != null)
            {
                accClass = new DAL.d_account_classification_dal().FindNoDeleteById((long)account.classification_id);
            }
        }
示例#7
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>");
     }
 }
示例#8
0
        /// <summary>
        /// 编辑员工的周目标
        /// </summary>
        public bool EditResProtected(long resId, bool isEdit, bool isView, bool isEditUn, bool isViewUn, long userId)
        {
            var thisRes = GetResourceById(resId);

            if (thisRes == null)
            {
                return(false);
            }
            sys_resource oldRes = GetResourceById(resId);

            thisRes.edit_protected_data   = (sbyte)(isEdit?1:0);
            thisRes.view_protected_data   = (sbyte)(isView ? 1 : 0);
            thisRes.edit_unprotected_data = (sbyte)(isEditUn ? 1 : 0);
            thisRes.view_unprotected_data = (sbyte)(isViewUn ? 1 : 0);
            thisRes.update_user_id        = userId;
            thisRes.update_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            _dal.Update(thisRes);
            OperLogBLL.OperLogUpdate <sys_resource>(thisRes, oldRes, thisRes.id, userId, OPER_LOG_OBJ_CATE.RESOURCE, "");

            return(true);
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var artId = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(artId))
                {
                    thisArt = new DAL.sdk_kb_article_dal().FindNoDeleteById(long.Parse(artId));
                }
                if (thisArt == null)
                {
                    Response.Write($"<script>alert('未查询到该知识库!');window.close();</script>");
                    return;
                }
                var dgDal = new DAL.d_general_dal();
                cataString = new KnowledgeBLL().GetCateString(thisArt.kb_category_id, cataString);
                if (!string.IsNullOrEmpty(cataString))
                {
                    cataString = cataString.Substring(0, cataString.Length - 1);
                }
                publish     = dgDal.FindNoDeleteById((long)thisArt.publish_to_type_id);
                creater     = srDal.FindById(thisArt.create_user_id);
                update      = srDal.FindById(thisArt.update_user_id);
                ticList     = new DAL.sdk_kb_article_ticket_dal().GetArtTicket(thisArt.id);
                thisNoteAtt = new DAL.com_attachment_dal().GetAttListByOid(thisArt.id);
                commList    = new DAL.sdk_kb_article_comment_dal().GetCommByArt(thisArt.id);

                var history = new sys_windows_history()
                {
                    title = "知识库文档:" + thisArt.title,
                    url   = Request.RawUrl,
                };
                new IndexBLL().BrowseHistory(history, LoginUserId);
            }
            catch (Exception msg)
            {
                Response.Write($"<script>alert('{msg.Message}');window.close();</script>");
            }
        }
示例#10
0
        protected crm_contact thisCon     = null; // 成员的联系人
        protected void Page_Load(object sender, EventArgs e)
        {
            var idString = Request.QueryString["id"];

            if (!string.IsNullOrEmpty(idString))
            {
                thisProTeam = new pro_project_team_dal().FindNoDeleteById(long.Parse(idString));
                if (thisProTeam != null)
                {
                    isAdd = false;
                    thisProTeamRoleList = new pro_project_team_role_dal().GetListTeamRole(thisProTeam.id);
                    thisProject         = new pro_project_dal().FindNoDeleteById(thisProTeam.project_id);
                    if (thisProTeam.resource_id != null)
                    {
                        thisRes = new sys_resource_dal().FindNoDeleteById((long)thisProTeam.resource_id);
                    }
                    if (thisProTeam.contact_id != null)
                    {
                        thisCon = new crm_contact_dal().FindNoDeleteById((long)thisProTeam.contact_id);
                    }
                }
            }
            var pId = Request.QueryString["project_id"];

            if (!string.IsNullOrEmpty(pId))
            {
                thisProject = new pro_project_dal().FindNoDeleteById(long.Parse(pId));
            }
            if (thisProject != null)
            {
                thisAccount = new CompanyBLL().GetCompany(thisProject.account_id);
            }
            if (thisProject == null || thisAccount == null)
            {
                Response.End();
            }
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long objId = 0; long resId = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                long.TryParse(Request.QueryString["id"], out objId);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["resId"]))
            {
                long.TryParse(Request.QueryString["resId"], out resId);
            }
            if (objId != 0)
            {
                resAva = userBll.GetResourceAvailabilityById(objId);
            }
            if (resId != 0)
            {
                resAva = userBll.GetAvailabilityByResId(resId);
            }
            if (resAva != null)
            {
                thisRes = userBll.GetResourceById(resAva.resource_id);
            }
            if (resAva == null)
            {
                Response.Write("<script>alert('请先到员工管理中设置员工工作时间!');window.close();</script>");
                return;
            }

            if (thisRes == null)
            {
                Response.Write("<script>alert('未获取到相关员工信息,请刷新页面后重试');window.close();</script>");
                return;
            }
        }
示例#12
0
 public void UpdatePermission(sys_resource res, long user_id)
 {
     res.update_user_id = user_id;
     res.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
     if (_dal.Update(res))
     {
         var add_account_log = new sys_oper_log();
         var user            = UserInfoBLL.GetUserInfo(user_id);
         add_account_log = new sys_oper_log()
         {
             user_cate           = "用户",
             user_id             = (int)user.id,
             name                = user.name,
             phone               = user.mobile == null ? "" : user.mobile,
             oper_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now),
             oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.CONTACTS,
             oper_object_id      = res.id,// 操作对象id
             oper_type_id        = (int)OPER_LOG_TYPE.UPDATE,
             oper_description    = _dal.AddValue(res),
             remark              = "更新客户信息权限"
         };          // 创建日志
         new sys_oper_log_dal().Insert(add_account_log);
     }
 }
示例#13
0
        string GetHtml(List <crm_account> accountList)
        {
            StringBuilder htmlText = new StringBuilder();

            foreach (var account in accountList)
            {
                htmlText.Append($"<div style='margin-left: calc(50 % -300px); margin-top:20px;margin-bottom:200px;'>");

                htmlText.Append($"<table cellspacing='0' cellpadding='0' style='width: 600px;'><tr><td style='font-weight:600;'>{account.name}<br />");
                crm_location accLocation = new DAL.crm_location_dal().GetLocationByAccountId(account.id);
                if (accLocation != null)
                {
                    var       disDal  = new DAL.d_district_dal();
                    d_country country = null;
                    if (accLocation.country_id != null)
                    {
                        country = new DAL.d_country_dal().FindById((long)accLocation.country_id);
                    }
                    var province = disDal.FindById((long)accLocation.province_id);
                    var city     = disDal.FindById((long)accLocation.city_id);
                    var district = disDal.FindById((long)accLocation.district_id);
                    htmlText.Append($"{country?.country_name_display}  {province?.name}  {city?.name}  {district?.name}");
                    htmlText.Append($"<br />{accLocation.address}  {accLocation.additional_address}");
                }
                htmlText.Append($"</td><td rowspan='3' style='text-align:center; vertical-align: middle;width:40 %;min-width:240px;'>");
                if (account.classification_id != null)
                {
                    var accClass = new DAL.d_account_classification_dal().FindNoDeleteById((long)account.classification_id);
                    htmlText.Append($"<img src='..{accClass?.icon_path}' />");
                }
                htmlText.Append("</td></tr>");
                sys_resource accMan = null;
                if (account.resource_id != null)
                {
                    accMan = userBll.GetResourceById((long)account.resource_id);
                }
                htmlText.Append($"<tr><td>{accMan?.name}<br /><br />{accMan.home_phone}</td></tr> ");
                htmlText.Append($"<tr><td>报表周期<br /><br />{startDate.ToString("yyyy-MM-dd")} - {endDate.ToString("yyyy-MM-dd")}</td></tr> ");

                #region 合同,项目 表格查询

                string contractSql = $@"select ifnull(contract_name,'汇总'),sum(dollars) from 
(select ifnull(contract_name, ' 无合同')contract_name, dollars, posted_date, account_id, account_manager_id, territory_id, contract_type_id
from v_posted_all a)t
where posted_date between '{startDate.ToString("yyyy-MM-dd")}' and '{endDate.ToString("yyyy-MM-dd")}' and account_id = {account.id.ToString()}
GROUP BY contract_name with ROLLUP
";
                if (!ContractByName)
                {
                    contractSql = $@"select ifnull(contract_type_name,'汇总'),sum(dollars) from 
(select dollars,posted_date,account_id,account_manager_id,territory_id,contract_type_id ,
ifnull((select name from d_general where id=a.contract_type_id),' 无合同')contract_type_name
from  v_posted_all a)t 
where posted_date between '{startDate.ToString("yyyy-MM-dd")}' and '{endDate.ToString("yyyy-MM-dd")}' and account_id={account.id.ToString()} 
GROUP BY contract_type_name with ROLLUP
";
                }
                htmlText.Append($"<tr><td colspan='2'><div style='width:100%;height:100%;'><br /><span class='Boild' style='font-size:11pt;'>财务回顾</span><br /><div style='padding-left:20px;'><br />");

                htmlText.Append($"<span class='Boild'>合同</span><div style='margin-right:20px;'><table  cellspacing ='0' cellpadding = '0' style = 'width:100%;' class='NoBoard'>");

                var contractTable = comBll.GetTable(contractSql);
                if (contractTable != null && contractTable.Rows.Count > 0)
                {
                    foreach (DataRow item in contractTable.Rows)
                    {
                        htmlText.Append($"<tr><td style='text-align:left;padding-left:10px;'>{item[0]}</td><td style ='text-align:right;' > {item[1]} </td></tr>");
                    }
                }
                htmlText.Append(" </table></div><br /><br /><br /><br />");
                htmlText.Append($"<span class='Boild'>项目</span><div style='margin-right:20px;'><table  cellspacing ='0' cellpadding = '0' style = 'width:100%;' class='NoBoard'>");
                var projectTable = comBll.GetTable($@"select ifnull(project_name,'汇总'),sum(dollars) from v_posted_all where posted_date between '{startDate.ToString("yyyy-MM-dd")}' and '{endDate.ToString("yyyy-MM-dd")}' and account_id={account.id.ToString()} and project_name is not null
GROUP BY project_name with ROLLUP
");
                if (projectTable != null && projectTable.Rows.Count > 0)
                {
                    foreach (DataRow item in projectTable.Rows)
                    {
                        htmlText.Append($"<tr><td style='text-align:left;padding-left:10px;'>{item[0]}</td><td style ='text-align:right;' > {item[1]} </td></tr>");
                    }
                }
                htmlText.Append($"</table></div><br /><br /></div>");
                #endregion

                #region 工单按照优先级汇总

                var priorityTicketTable = comBll.GetTable($@"select priority_type_name,count(1),round(avg(duaration_hours),2),round(avg(Business_Hours),2)
from(
select t.priority_type_id,(select name from d_general where id=t.priority_type_id)priority_type_name ,
f_get_sla_hours(null,(select id from sys_organization_location where is_default=1 and delete_time=0 limit 1),fs_unix2date(t.create_time), fs_unix2date(t.Date_Completed)  )Business_Hours,
(t.Date_Completed - t.create_time)/1000/3600 duaration_hours
from sdk_task t where type_id=1809 and status_id=1894 and recurring_ticket_id is null and  account_id={account.id.ToString()} and fs_unix2date(Date_Completed) between '{startDate.ToString("yyyy-MM-dd")}' and '{endDate.ToString("yyyy-MM-dd")}'
)t GROUP BY t.priority_type_name 
");
                if (priorityTicketTable != null && priorityTicketTable.Rows.Count > 0)
                {
                    htmlText.Append($"<span class'Boild' style='font-size:11pt;'>工单按优先级汇总</span><div style='padding: 20px;'><table cellspacing='0' cellpadding='0' style='width: 100 %; border-collapse:collapse;'>");
                    htmlText.Append("<tr><td> 优先级 </td><td>工单数</td><td>占比</td><td>平均耗时</td><td>平均耗时(工作时间)</td></tr>");
                    foreach (DataRow item in priorityTicketTable.Rows)
                    {
                        htmlText.Append($"<tr><td>{item[0]}</td><td>{item[1]}</td><td>{item[2]}</td><td>{item[3]}</td></tr>");
                    }
                    htmlText.Append($"</table></div>");
                }
                htmlText.Append($"</div></td></tr></table>");

                #endregion

                htmlText.Append("<br /><br />");

                var issuePriottyTable = comBll.GetTable($@"select Issue_Type_name ,Sub_Issue_Type_name ,sum(严重) ,sum(高) ,sum(中) ,sum(低),count(1)
from(
select Sub_Issue_Type_ID,(select name from d_general where id=Sub_Issue_Type_ID)Sub_Issue_Type_name,(select name from d_general where id=Issue_Type_ID)Issue_Type_name,
if(priority_type_id=1883,1,0)严重,if(priority_type_id=1884,1,0)高,if(priority_type_id=1885,1,0)中,if(priority_type_id=1886,1,0)低 
from sdk_task t where type_id=1809 and status_id=1894 and recurring_ticket_id is null and  account_id={account.id.ToString()} and fs_unix2date(Date_Completed) between '{startDate.ToString("yyyy-MM-dd")}' and '{endDate.ToString("yyyy-MM-dd")}'
 )t GROUP BY Issue_Type_name ,Sub_Issue_Type_name with ROLLUP
");
                if (issuePriottyTable != null && issuePriottyTable.Rows.Count > 0)
                {
                    htmlText.Append($"<span class'Boild' style='font-weight:600;'>工单按问题类型和优先级汇总</span><br /><br /><div><table cellspacing='0' cellpadding='0' style='width:600px;border-collapse:collapse'>");
                    htmlText.Append($"<tr><td>问题类型</td><td>子问题类型</td><td>严重</td><td>高</td><td>中</td><td>低</td><td>汇总</td></tr>");
                    foreach (DataRow item in issuePriottyTable.Rows)
                    {
                        htmlText.Append($"<tr><td>{item[0]}</td><td>{item[1]}</td><td>{item[2]}</td><td>{item[3]}</td><td>{item[4]}</td><td>{item[5]}</td><td>{item[6]}</td></tr>");
                    }
                    htmlText.Append($"</table></div>");
                }

                htmlText.Append($"</div>");
            }
            return(htmlText.ToString());
        }
示例#14
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>");
            }
        }
示例#15
0
        protected string GetDetailByRes(long resId)
        {
            StringBuilder html    = new StringBuilder();
            sys_resource  thisRes = userBll.GetResourceById(resId);

            if (thisRes == null)
            {
                return("");
            }
            //
            html.Append("<div class='workspace'>");
            #region  用户信息
            html.Append($"<p align='left' style='padding-left: 10px;' class='FieldLabels'>{thisRes.name}<br />");

            if (!string.IsNullOrEmpty(thisRes.office_phone))
            {
                html.Append($"<span style='font-weight:normal;'>办公电话: {thisRes.office_phone} </span ><br />");
            }
            if (!string.IsNullOrEmpty(thisRes.home_phone))
            {
                html.Append($"<span style='font-weight:normal;'>家庭电话: {thisRes.home_phone} </span ><br />");
            }
            if (!string.IsNullOrEmpty(thisRes.email))
            {
                html.Append($"<span style='font-weight:normal;'>邮箱: {thisRes.email} </span ><br />");
            }
            html.Append("</p>");
            #endregion
            html.Append("<div style='padding-left: 10px;'><table cellspacing='0' cellpadding='4' border='0' class='FieldLabels'><tbody>");

            #region  客户信息
            html.Append("<tr><td align='left'>客户</td></tr>");
            List <crm_account> accList = new CompanyBLL().GetBySql <crm_account>("SELECT id,name,phone from crm_account a where a.delete_time =0 and a.resource_id = " + resId.ToString());
            if (accList != null && accList.Count > 0)
            {
                accList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}-手机号 : &nbsp; {_.phone}</td></tr>");
                });
            }
            #endregion

            #region  商机信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>商机</td></tr>");
            List <crm_opportunity> oppoList = new OpportunityBLL().GetOppoBySql($"SELECT id,name from crm_opportunity where delete_time =0 and resource_id = {resId.ToString()} and status_id not in ({(int)DicEnum.OPPORTUNITY_STATUS.LOST},{(int)DicEnum.OPPORTUNITY_STATUS.CLOSED},{(int)DicEnum.OPPORTUNITY_STATUS.IMPLEMENTED})");
            if (oppoList != null && oppoList.Count > 0)
            {
                oppoList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }

            #endregion

            #region  待办信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>待办</td></tr>");
            List <com_activity> todoList = new ActivityBLL().GetToListBySql($"select id,name,description from com_activity where delete_time =0 and cate_id = {(int)DicEnum.ACTIVITY_CATE.TODO} and resource_id = {resId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");
            if (todoList != null && todoList.Count > 0)
            {
                todoList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.description}</td></tr>");
                });
            }
            #endregion

            #region  活动信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>活动</td></tr>");
            List <com_activity> actList = new ActivityBLL().GetToListBySql($"select id,name,description from com_activity where delete_time =0 and cate_id <> {(int)DicEnum.ACTIVITY_CATE.TODO} and resource_id = {resId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");
            if (actList != null && actList.Count > 0)
            {
                actList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.description}</td></tr>");
                });
            }
            #endregion
            html.Append("</tbody></table></div>");
            html.Append("</div>");

            return(html.ToString());
        }
示例#16
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>");
            }
        }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var eid = Request.QueryString["id"];
                thisReport = new sdk_expense_report_dal().FindNoDeleteById(long.Parse(eid));
                if (thisReport != null)
                {
                    creRes = new sys_resource_dal().FindNoDeleteById(thisReport.create_user_id);
                    if (thisReport.submit_user_id != null)
                    {
                        subRes = new sys_resource_dal().FindNoDeleteById((long)thisReport.submit_user_id);
                    }
                    var chooseDateString = Request.QueryString["startDate"];
                    if (!string.IsNullOrEmpty(chooseDateString))
                    {
                        chooseStartDate = GetMonday(DateTime.Parse(chooseDateString));
                    }
                    var allExpList = new sdk_expense_dal().GetExpByReport(thisReport.id);
                    if (allExpList != null && allExpList.Count > 0)
                    {
                        if (chooseStartDate != null)
                        {
                            expList = allExpList.Where(_ => _.add_date >= chooseStartDate && _.add_date <= ((DateTime)chooseStartDate).AddDays(6)).ToList();
                        }
                    }
                    #region 完善日期下拉框信息
                    GetSelect();  // 获取日期下拉框
                    var choese = dateList.FirstOrDefault(_ => _.select == 1);
                    if (choese == null)
                    {
                        dateList.Add(new DictionaryEntryDto()
                        {
                            select = 1, show = "选择日期", val = ""
                        });
                    }
                    else
                    {
                        dateList.Add(new DictionaryEntryDto()
                        {
                            show = "选择日期", val = ""
                        });
                    }
                    dateList = dateList.OrderBy(_ => _.val).ToList();
                    #endregion

                    if (expList != null && expList.Count > 0)
                    {
                        var dccDal = new d_cost_code_dal();
                        // 获取到招待相关的费用
                        entertainList = expList.Where(_ =>
                        {
                            if (_.cost_code_id != null)
                            {
                                var thisCost = dccDal.FindNoDeleteById((long)_.cost_code_id);
                                if (thisCost != null && thisCost.expense_type_id == (int)DicEnum.EXPENSE_TYPE.ENTERTAINMENT_EXPENSES)
                                {
                                    return(true);
                                }
                            }
                            return(false);
                        }).ToList();

                        if (entertainList != null && entertainList.Count > 0)
                        {
                            noEntertainList = expList.Where(_ => !entertainList.Any(el => el.id == _.id)).ToList();
                        }
                        else
                        {
                            noEntertainList = expList;
                        }
                    }
                }
                else
                {
                    Response.Write($"<script>alerl('未查询到相关报表,请刷新页面后重试!');window.close();</script>");
                }
            }
            catch (Exception msg)
            {
                Response.Write($"<script>alerl('{msg.Message}');</script>");
            }
        }
示例#18
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>");
            }
        }
示例#19
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>");
            }
        }
示例#20
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>");
            }
        }
示例#21
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
            }
        }
示例#22
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>");
     }
 }
示例#23
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();
            }
        }
示例#24
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();
            }
        }
示例#25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var dic = new OpportunityBLL().GetField();
                #region  拉框赋值
                stage_id.DataTextField  = "show";
                stage_id.DataValueField = "val";
                stage_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "opportunity_stage").Value;
                stage_id.DataBind();


                resource_id.DataTextField  = "show";
                resource_id.DataValueField = "val";
                resource_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
                resource_id.DataBind();


                //opportunity_id.DataTextField = "name";
                //opportunity_id.DataValueField = "id";
                //opportunity_id.DataSource = new crm_opportunity_dal().FindOpHistoryByAccountId(opportunity.account_id);
                //opportunity_id.DataBind();

                loss_reason_type_id.DataTextField  = "show";
                loss_reason_type_id.DataValueField = "val";
                loss_reason_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "oppportunity_loss_reason_type").Value;
                loss_reason_type_id.DataBind();
                loss_reason_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                // competition  competitor_id
                competitor_id.DataTextField  = "show";
                competitor_id.DataValueField = "val";
                competitor_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "competition").Value;
                competitor_id.DataBind();
                competitor_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                #endregion

                var account_id = Request.QueryString["account_id"];

                var opportunityId = Request.QueryString["id"];
                if (!string.IsNullOrEmpty(opportunityId))
                {
                    if (string.IsNullOrEmpty(account_id))
                    {
                        if (!IsPostBack)
                        {
                            opportunity_id.Enabled = false;
                        }
                    }
                    opportunity = new crm_opportunity_dal().GetOpportunityById(long.Parse(opportunityId));
                    if (opportunity != null)
                    {
                        account    = new CompanyBLL().GetCompany(opportunity.account_id);
                        account_id = account.id.ToString();
                        ownRes     = new UserResourceBLL().GetResourceById(opportunity.resource_id);
                    }
                }
                if (!string.IsNullOrEmpty(account_id))
                {
                    account = new CompanyBLL().GetCompany(long.Parse(account_id));
                    var oppoList = new crm_opportunity_dal().FindOpHistoryByAccountId(long.Parse(account_id));
                    if (oppoList != null && oppoList.Count > 0)
                    {
                        opportunity_id.DataTextField  = "name";
                        opportunity_id.DataValueField = "id";
                        opportunity_id.DataSource     = oppoList;
                        opportunity_id.DataBind();
                    }
                    else
                    {
                        Response.Write("<script>alert('该客户还没有商机!');window.close();</script>");
                    }
                    if (string.IsNullOrEmpty(opportunityId))
                    {
                        opportunity = oppoList[0];
                    }
                    opportunity_id.SelectedValue = opportunity.id.ToString();
                }
                if (opportunity == null)
                {
                    Response.End();
                }
                // 商机已经关闭,丢失提示信息
                if (!IsPostBack)
                {
                    if (opportunity.status_id == (int)OPPORTUNITY_STATUS.CLOSED)
                    {
                        Response.Write("<script>alert('商机已关闭,继续则以前创建的已确认计费项和合同不会受影响!');</script>");
                        Response.Write("<script>if(!confirm('本操作将会改变商机状态,相关的销售订单将被取消,是否继续?')){window.close();}</script>");
                    }
                }


                stage_id.SelectedValue       = opportunity.stage_id == null ? "0" : opportunity.stage_id.ToString();
                resource_id.SelectedValue    = opportunity.resource_id.ToString();
                opportunity_id.SelectedValue = opportunity.id.ToString();
                competitor_id.SelectedValue  = opportunity.competitor_id == null ? "0" : opportunity.competitor_id.ToString();
            }
            catch (Exception)
            {
                Response.End();
            }
        }