/// <summary> /// 编辑联系人 /// </summary> public void EditContact(crm_contact contact, long userId) { var oldcon = _dal.FindNoDeleteById(contact.id); if (oldcon == null) { return; } contact.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); contact.update_user_id = userId; _dal.Update(contact); OperLogBLL.OperLogUpdate <crm_contact>(contact, oldcon, contact.id, userId, OPER_LOG_OBJ_CATE.CONTACTS, ""); }
/// <summary> /// 删除联系人 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool DeleteContact(long id, long user_id) { crm_contact contact = GetContact(id); if (contact == null) { return(false); } if (_dal.SoftDelete(contact, user_id)) { OperLogBLL.OperLogDelete <crm_contact>(contact, contact.id, user_id, OPER_LOG_OBJ_CATE.CONTACTS, ""); } return(true); // 该联系人是公司的外包联系人(工单中的外包人员) // 该联系人有关联的工单或任务 // 该联系人在自助服务台创建过工单备注或者附件 // 该联系人是客户的账单联系人 // 该联系人是客户的唯一的一个发票邮件接收人 // todo 删除校验本期暂时不做 07-13=====08-15 }
protected void Page_Load(object sender, EventArgs e) { long fromConId = 0; long toConId = 0; long accountId = 0; if (!string.IsNullOrEmpty(Request.QueryString["fromConId"])) { if (long.TryParse(Request.QueryString["fromConId"], out fromConId)) { fromContact = conBll.GetContact(fromConId); } } if (!string.IsNullOrEmpty(Request.QueryString["toConId"])) { if (long.TryParse(Request.QueryString["toConId"], out toConId)) { toContact = conBll.GetContact(toConId); } } if (!string.IsNullOrEmpty(Request.QueryString["isDel"]) && Request.QueryString["isDel"] == "1") { isDel = true; } if (!string.IsNullOrEmpty(Request.QueryString["accountId"])) { if (long.TryParse(Request.QueryString["accountId"], out accountId)) { account = accBll.GetCompany(accountId); } } if (fromContact != null) { liLeft.Text = GetDetailByContact(fromContact.id); } if (toContact != null) { liRight.Text = GetDetailByContact(toContact.id); } }
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(); } }
protected void Page_Load(object sender, EventArgs e) { try { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); callBackFiled = Request.QueryString["callBackFiled"]; var opportunity_id = Request.QueryString["opportunity_id"]; if (!string.IsNullOrEmpty(opportunity_id)) { if (AuthBLL.GetUserOppAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(opportunity_id)).CanEdit == false) { Response.End(); return; } opportunity = new crm_opportunity_dal().GetOpportunityById(Convert.ToInt64(opportunity_id)); } dic = new OpportunityBLL().GetField(); #region 配置下拉框的数据源 // 商机负责人 resource_id.DataTextField = "show"; resource_id.DataValueField = "val"; resource_id.DataSource = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value; resource_id.DataBind(); resource_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 当前阶段 stage_id.DataTextField = "show"; stage_id.DataValueField = "val"; stage_id.DataSource = dic.FirstOrDefault(_ => _.Key == "opportunity_stage").Value; stage_id.DataBind(); stage_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); stage_id.SelectedValue = ((int)OPPORTUNITY_STAGE.NEW_CLUE).ToString(); // 感兴趣等级 interest_degree_id.DataTextField = "show"; interest_degree_id.DataValueField = "val"; interest_degree_id.DataSource = dic.FirstOrDefault(_ => _.Key == "opportunity_interest_degree").Value; interest_degree_id.DataBind(); interest_degree_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 商机来源 source_id.DataTextField = "show"; source_id.DataValueField = "val"; source_id.DataSource = dic.FirstOrDefault(_ => _.Key == "opportunity_source").Value; source_id.DataBind(); source_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 状态 status_id.DataTextField = "show"; status_id.DataValueField = "val"; status_id.DataSource = dic.FirstOrDefault(_ => _.Key == "oppportunity_status").Value; status_id.DataBind(); status_id.SelectedValue = ((int)OPPORTUNITY_STATUS.ACTIVE).ToString(); //status_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 主要竞争对手 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 }); // 赢单原因 win_reason_type_id.DataTextField = "show"; win_reason_type_id.DataValueField = "val"; win_reason_type_id.DataSource = dic.FirstOrDefault(_ => _.Key == "oppportunity_win_reason_type").Value; win_reason_type_id.DataBind(); win_reason_type_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); // 丢单原因 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 }); // 通知模板 --todo 需要过滤商机创建或编辑相关的通知模板 //notify_tmpl_id.DataTextField = "show"; //notify_tmpl_id.DataValueField = "val"; //notify_tmpl_id.DataSource = dic.FirstOrDefault(_ => _.Key == "notify_tmpl").Value; //notify_tmpl_id.DataBind(); //notify_tmpl_id.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); var formTemplateList = new FormTemplateBLL().GetTemplateOpportunityByUser(GetLoginUserId()); formTemplate.DataTextField = "speed_code"; formTemplate.DataValueField = "id"; formTemplate.DataSource = formTemplateList; formTemplate.DataBind(); formTemplate.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); #endregion opportunity_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.OPPORTUNITY); if (opportunity != null) { isAdd = false; //company_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.COMPANY); } if (!isAdd) { opportunity_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.OPPORTUNITY, opportunity.id, opportunity_udfList); if (!IsPostBack) { resource_id.SelectedValue = opportunity.resource_id.ToString(); stage_id.SelectedValue = opportunity.stage_id == null ? "0" : opportunity.stage_id.ToString(); interest_degree_id.SelectedValue = opportunity.interest_degree_id == null ? "0" : opportunity.interest_degree_id.ToString(); source_id.SelectedValue = opportunity.source_id == null ? "0" : opportunity.source_id.ToString(); status_id.SelectedValue = opportunity.status_id == null ? "0" : opportunity.status_id.ToString(); competitor_id.SelectedValue = opportunity.competitor_id == null ? "0" : opportunity.competitor_id.ToString(); win_reason_type_id.SelectedValue = opportunity.win_reason_type_id == null ? "0" : opportunity.win_reason_type_id.ToString(); loss_reason_type_id.SelectedValue = opportunity.loss_reason_type_id == null ? "0" : opportunity.loss_reason_type_id.ToString(); is_use_quote.Checked = opportunity.use_quote == 1; } } else { // 联系人查看的时候穿过来客户ID,和联系人ID,联系人不能更改,只有更改客户才可以更改联系人 var contact_id = Request.QueryString["oppo_contact_id"]; if (!string.IsNullOrEmpty(contact_id)) { contact = new ContactBLL().GetContact(Convert.ToInt64(contact_id)); } var account_id = Request.QueryString["oppo_account_id"]; if (!string.IsNullOrEmpty(account_id)) { account = new CompanyBLL().GetCompany(Convert.ToInt64(account_id)); } } } catch (Exception msg) { Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { try { // var account_id = Request.QueryString["account_id"]; // 客户ID var contact_id = Request.QueryString["id"]; // 联系人ID if (AuthBLL.GetUserContactAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(contact_id)).CanView == false) { Response.End(); return; } contact = contactBLL.GetContact(Convert.ToInt64(contact_id)); thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + Convert.ToInt64(contact_id), LoginUserId); if (contact != null) { account = companyBll.GetCompany(contact.account_id); } type = Request.QueryString["type"]; if (string.IsNullOrEmpty(type)) { type = "activity"; } if (type == "activity" || type == "note" || type == "todo") { isHide.Value = "show"; } switch (type) // 根据传过来的不同的类型,为页面中的iframe控件选择不同的src { case "activity": actType = "活动"; break; case "todo": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=112&con659=" + contact_id + "¶m1=contactId¶m2=" + contact_id; // 待办 actType = "待办"; break; case "note": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=110&con646=" + contact_id + "¶m1=contactId¶m2=" + contact_id; // 备注 actType = "备注"; break; case "opportunity": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.OPPORTUNITY_CONTACT_VIEW + "&type=" + (int)QueryType.OpportunityContactView + "&id=" + contact_id; // 商机 actType = "商机"; break; case "configura": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.INSTALLEDPRODUCT + "&type=" + (int)QueryType.InstalledProductView + "&con966=" + contact_id; actType = "配置项"; break; case "ticket": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con5602=" + contact_id + "¶m1=ShowPara"; actType = "工单"; break; case "group": actType = "联系人组"; iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.ACCOUNT_CONTACT_GROUP_SEARCH + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ACCOUNT_CONTACT_GROUP_SEARCH; // todo 添加参数 break; default: iframeSrc = ""; // 默认 break; } if (type.Equals("activity")) { var typeList = new ActivityBLL().GetCRMActionType(); noteType.DataSource = typeList; noteType.DataTextField = "name"; noteType.DataValueField = "id"; noteType.DataBind(); } if (account != null && contact != null) { dic = new CompanyBLL().GetField(); contactUDFList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTACT); contactEDFValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONTACT, contact.id, contactUDFList); } else { Response.End(); } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { // todo - 商机的重新指派 var sid = Request.QueryString["id"]; if (AuthBLL.GetUserSaleorderAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(sid)).CanView == false) { Response.End(); return; } thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + sid, LoginUserId); type = Request.QueryString["type"]; sale_order = new crm_sales_order_dal().GetSingleSale(long.Parse(sid)); opportunity = new crm_opportunity_dal().GetOpportunityById(sale_order.opportunity_id); account = new CompanyBLL().GetCompany(opportunity.account_id); quote = new QuoteBLL().GetPrimaryQuote(opportunity.id); if (sale_order.contact_id != null) { contact = new ContactBLL().GetContact((long)sale_order.contact_id); } switch (type) { case "activity": actType = "活动"; isShowLeft.Value = "1"; break; case "todo": actType = "待办"; iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=131&con676=" + sale_order.id + "¶m1=saleorderId¶m2=" + sale_order.id; isShowLeft.Value = "1"; break; case "note": actType = "备注"; iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=129&con675=" + sale_order.id + "¶m1=saleorderId¶m2=" + sale_order.id; isShowLeft.Value = "1"; break; case "ticket": actType = "工单"; break; case "attachment": actType = "附件"; iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.SALES_ORDER_VIEW_ATTACHMENT + "&type=" + (int)QueryType.SalesOrderViewAttachment + "&con977=" + sale_order.id; break; case "entry": actType = "报价项"; iframeSrc = "../QuoteItem/QuoteItemManage.aspx?isShow=1"e_id=" + quote.id + "&isSaleOrder=1&sale_order_id=" + sale_order.id; break; case "purchaseOrder": actType = "采购订单"; break; default: actType = "活动"; type = "activity"; isShowLeft.Value = "1"; break; } if (type.Equals("activity")) { var typeList = new ActivityBLL().GetCRMActionType(); noteType.DataSource = typeList; noteType.DataTextField = "name"; noteType.DataValueField = "id"; noteType.DataBind(); } } catch (Exception) { Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { try { var id = Request.QueryString["id"]; if (AuthBLL.GetUserOppAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(id)).CanView == false) { Response.End(); return; } opportunity = new crm_opportunity_dal().GetOpportunityByOtherId(Convert.ToInt64(id)); type = Request.QueryString["type"]; if (opportunity != null) { dic = new OpportunityBLL().GetField(); quoteList = new crm_quote_dal().GetQuoteByOpportunityId(opportunity.id); account = new CompanyBLL().GetCompany(opportunity.account_id); if (opportunity.contact_id != null) { contact = new ContactBLL().GetContact((long)opportunity.contact_id); } thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + opportunity.id, LoginUserId); switch (type) // 根据传过来的不同的类型,为页面中的iframe控件选择不同的src { case "todo": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=112&con660=" + opportunity.id + "¶m1=opportunityId¶m2=" + opportunity.id; // 待办 actType = "待办"; break; case "note": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=110&con647=" + opportunity.id + "¶m1=opportunityId¶m2=" + opportunity.id; // 备注 actType = "备注"; break; case "activity": iframeSrc = ""; // 活动 actType = "活动"; break; case "ticket": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con5603=" + opportunity.id + "¶m1=ShowPara"; actType = "工单"; break; case "quoteItem": var oppoQuoteList = new crm_quote_dal().GetQuoteByWhere($" and opportunity_id = {opportunity.id} "); if (oppoQuoteList != null && oppoQuoteList.Count > 0) { iframeSrc = "../QuoteItem/QuoteItemManage?isShow=show&opportunity_id=" + opportunity.id; // 报价项 isAddQuote.Value = "0"; } else { isAddQuote.Value = "1"; //ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>if(confirm('商机尚未创建报价,需要现在创建吗?')){window.open('../Quote/QuoteAddAndUpdate.aspx?quote_opportunity_id=" + opportunity.id + "', '" + (int)EMT.DoneNOW.DTO.OpenWindow.QuoteAdd + "', 'left=200,top=200,width=960,height=750', false);}</script>"); //Response.Write("<script>debugger;</script>"); } actType = "报价项"; break; case "att": iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.OPPORTUNITY_VIEW_ATTACHMENT + "&type=" + (int)QueryType.OpportunityViewAttachment + "&con976=" + opportunity.id; actType = "附件"; break; default: iframeSrc = ""; // 默认 actType = "活动"; type = "activity"; break; } if (type == "activity" || type == "note" || type == "todo") { isHide.Value = "show"; } if (type.Equals("activity")) { var typeList = new ActivityBLL().GetCRMActionType(); noteType.DataSource = typeList; noteType.DataTextField = "name"; noteType.DataValueField = "id"; noteType.DataBind(); } } else { Response.End(); } } catch (Exception) { Response.End(); } }
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(); } }
public ApiResultDto UpdateContact([FromBody] crm_contact contact) { return(Result(_bll.Update(contact, GetToken()))); }
public ApiResultDto AddContact([FromBody] crm_contact contact) { return(Result(_bll.Insert(contact, GetToken()))); }
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 } }
protected void Page_Load(object sender, EventArgs e) { try { var taskId = Request.QueryString["id"]; if (!string.IsNullOrEmpty(taskId)) { thisTicket = new sdk_task_dal().FindNoDeleteById(long.Parse(taskId)); if (thisTicket != null) { isAdd = false; thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + taskId, LoginUserId); ticketUdfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.TASK, thisTicket.id, tickUdfList); thisAccount = new CompanyBLL().GetCompany(thisTicket.account_id); if (thisTicket.contact_id != null) { thisContact = new crm_contact_dal().FindNoDeleteById((long)thisTicket.contact_id); } if (thisTicket.owner_resource_id != null && thisTicket.role_id != null) { var resDepList = new sys_resource_department_dal().GetResDepByResAndRole((long)thisTicket.owner_resource_id, (long)thisTicket.role_id); if (resDepList != null && resDepList.Count > 0) { proResDep = resDepList[0]; priRes = new sys_resource_dal().FindNoDeleteById((long)thisTicket.owner_resource_id); } } if (thisTicket.installed_product_id != null) { insPro = new crm_installed_product_dal().FindNoDeleteById((long)thisTicket.installed_product_id); } if (thisTicket.contract_id != null) { thisContract = new ctt_contract_dal().FindNoDeleteById((long)thisTicket.contract_id); } if (thisTicket.cost_code_id != null) { thisCostCode = new d_cost_code_dal().FindNoDeleteById((long)thisTicket.cost_code_id); } ticketCheckList = new sdk_task_checklist_dal().GetCheckByTask(thisTicket.id); if (ticketCheckList != null && ticketCheckList.Count > 0) { ticketCheckList = ticketCheckList.OrderBy(_ => _.sort_order).ToList(); } entryList = new sdk_work_entry_dal().GetList(thisTicket.id); var otherResList = new sdk_task_resource_dal().GetTaskResByTaskId(thisTicket.id); if (otherResList != null && otherResList.Count > 0) { ticketResList = new List <sys_resource_department>(); var srdDal = new sys_resource_department_dal(); foreach (var resRole in otherResList) { if (resRole.resource_id == null || resRole.role_id == null) { continue; } var thisResDep = srdDal.GetResDepByResAndRole((long)resRole.resource_id, (long)resRole.role_id); if (thisResDep != null && thisResDep.Count > 0) { ticketResList.Add(thisResDep[0]); } } } if (thisTicket.service_id != null) { thisService = new ivt_service_dal().FindNoDeleteById((long)thisTicket.service_id); if (thisService == null) { thisServiceBun = new ivt_service_bundle_dal().FindNoDeleteById((long)thisTicket.service_id); } } createRes = new sys_resource_dal().FindNoDeleteById(thisTicket.create_user_id); var slaValue = new sdk_task_dal().GetSlaTime(thisTicket); string slaTimeValue = ""; if (slaValue != null) { slaTimeValue = slaValue.ToString(); } if (!string.IsNullOrEmpty(slaTimeValue)) { if (slaTimeValue.Substring(0, 1) == "{") { slaDic = new EMT.Tools.Serialize().JsonToDictionary(slaTimeValue); } } var actList = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.ACTION_TYPE); if (actList != null && actList.Count > 0) { ticketNoteTypeList = actList.Where(_ => _.ext2 == ((int)DicEnum.ACTIVITY_CATE.TASK_NOTE).ToString()).ToList(); } ticketOther = new sdk_task_other_dal().GetTicketOther(thisTicket.id); ticketOtherList = new sdk_task_other_person_dal().GetTicketOther(thisTicket.id); } } var ticketIds = Request.QueryString["ids"]; if (!string.IsNullOrEmpty(ticketIds)) { pageTicketList = new sdk_task_dal().GetTicketByIds(ticketIds); } if (thisTicket == null) { Response.Write("<script>alert('未查询到该工单信息!');window.close();</script>"); return; } var history = new sys_windows_history() { title = "工单:" + thisTicket.no + ":" + thisTicket.title, url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }
protected string GetDetailByContact(long conId) { StringBuilder html = new StringBuilder(); crm_contact thisContact = conBll.GetContact(conId); if (thisContact == null) { return(""); } html.Append("<div class='workspace'>"); html.Append("<div style='padding-left: 10px;'><table cellspacing='0' cellpadding='4' border='0' class='FieldLabels'><tbody>"); // #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 contact_id = {conId.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>"); }); } else { html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有商机</td></tr>"); } #endregion #region 销售订单信息 销售订单没有name 使用商机name html.Append("<tr><td align='left' style='padding-top:20px;'>销售订单</td></tr>"); List <crm_opportunity> saleList = accBll.GetBySql <crm_opportunity>($"SELECT s.id,p.name from crm_sales_order s INNER JOIN crm_opportunity p on s.opportunity_id = p.id where s.delete_time = 0 and p.delete_time =0 and s.contact_id = {conId.ToString()} "); if (saleList != null && saleList.Count > 0) { saleList.ForEach(_ => { html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>"); }); } else { html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有销售订单</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 contact_id = {conId.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>"); }); } else { html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有待办</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 contact_id = {conId.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>"); }); } else { html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有活动</td></tr>"); } #endregion #region 工单信息 html.Append("<tr><td align='left' style='padding-top:20px;'>工单</td></tr>"); List <sdk_task> ticketList = accBll.GetBySql <sdk_task>($"SELECT id from sdk_task where type_id = 1809 and delete_time = 0 and contact_id = {conId.ToString()}"); if (ticketList != null && ticketList.Count > 0) { ticketList.ForEach(_ => { html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.no}-{_.title}</td></tr>"); }); } else { html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有工单</td></tr>"); } #endregion #region 调查问卷信息 #endregion #region 任务信息 html.Append("<tr><td align='left' style='padding-top:20px;'>任务</td></tr>"); List <sdk_task> taskList = accBll.GetBySql <sdk_task>($"SELECT t.id,t.title,p.name as description from sdk_task t INNER JOIN pro_project p where t.type_id = 1807 and t.delete_time = 0 and p.delete_time =0 and t.contact_id = {conId.ToString()}"); // if (taskList != null && taskList.Count > 0) { taskList.ForEach(_ => { html.Append($"<tr><td style='padding-left:10px;'>项目: <span style='font-weight :normal;'>{_.description}</span> <br> 任务: < span style='font-weight :normal;'>{_.title}</span></td></tr>"); }); } else { html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有任务</td></tr>"); } #endregion #region 联系人群组信息 html.Append("<tr><td align='left' style='padding-top:20px;'>联系人群组</td></tr>"); List <crm_contact_group> groupList = accBll.GetBySql <crm_contact_group>($"SELECT ccg.* from crm_contact_group ccg INNER JOIN crm_contact_group_contact ccgc on ccg.id = ccgc.contact_group_id where ccg.delete_time =0 and ccgc.delete_time = 0 and ccgc.contact_id = {conId.ToString()}"); if (groupList != null && groupList.Count > 0) { groupList.ForEach(_ => { html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>"); }); } else { html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有联系人群组</td></tr>"); } #endregion #region 合同信息 html.Append("<tr><td align='left' style='padding-top:20px;'>合同</td></tr>"); List <ctt_contract> contractList = accBll.GetBySql <ctt_contract>($"SELECT id, name from ctt_contract where delete_time = 0 and contact_id = { conId.ToString()}"); if (contractList != null && contractList.Count > 0) { contractList.ForEach(_ => { html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>"); }); } else { html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有合同</td></tr>"); } #endregion html.Append("</tbody></table></div>"); html.Append("</div>"); return(html.ToString()); }
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>"); } }
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>"); } }
protected void Page_Load(object sender, EventArgs e) { try { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); iProduct_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONFIGURATION_ITEMS); var contract_id = Request.QueryString["contract_id"]; if (!string.IsNullOrEmpty(contract_id)) { contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id)); if (contract != null) { account = new CompanyBLL().GetCompany(contract.account_id); } } var contactId = Request.QueryString["contact_id"]; if (!string.IsNullOrEmpty(contactId)) { contact = new ContactBLL().GetContact(long.Parse(contactId)); if (contact != null) { account = new CompanyBLL().GetCompany(contact.account_id); } } var id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { iProduct = new crm_installed_product_dal().GetInstalledProduct(long.Parse(id)); if (iProduct != null) { account = new CompanyBLL().GetCompany((long)iProduct.account_id); product = new ivt_product_dal().FindNoDeleteById(iProduct.product_id); } } var account_id = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(account_id)) { account = new CompanyBLL().GetCompany(long.Parse(account_id)); } //var contactList = new crm_contact_dal().GetContactByAccountId(account.id); //var serviceList = new ivt_service_dal().GetServiceList($" and vendor_id = {account.id}"); #region 配置下拉框数据源 var udfGroup = new d_general_dal().GetGeneralByTableId((int)GeneralTableEnum.UDF_FILED_GROUP); List <d_general> cateList = null; if (udfGroup != null && udfGroup.Count > 0) { cateList = udfGroup.Where(_ => _.parent_id == (int)UDF_CATE.CONFIGURATION_ITEMS).ToList(); } installed_product_cate_id.DataTextField = "name"; installed_product_cate_id.DataValueField = "id"; installed_product_cate_id.DataSource = cateList; installed_product_cate_id.DataBind(); installed_product_cate_id.Items.Insert(0, new ListItem() { Value = "", Text = " ", Selected = true }); //contact_id.DataTextField = "name"; //contact_id.DataValueField = "id"; //contact_id.DataSource = contactList; //contact_id.DataBind(); //contact_id.Items.Insert(0, new ListItem() { Value = "", Text = " ", Selected = true }); // //service.DataTextField = "name"; //service.DataValueField = "id"; //service.DataSource = serviceList; //service.DataBind(); //service.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); //service.Enabled = false; // 所选合同如果是服务类型的,则此下拉框可选。可选内容为合同项 #endregion if (iProduct != null) { //account_id = iProduct.account_id.ToString(); iProduct_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.CONFIGURATION_ITEMS, iProduct.id, iProduct_udfList); var isCopy = Request.QueryString["isCopy"]; product = new EMT.DoneNOW.BLL.ProductBLL().GetProduct(iProduct.product_id); isAdd = false; if (!string.IsNullOrEmpty(isCopy) && isCopy == "1") { isAdd = true; } if (!isAdd) { #region 记录浏览历史 var history = new sys_windows_history() { title = "配置项:" + (product == null ? "" : product.name) + account.name, url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); #endregion } if (iProduct.contract_id != null) { contract = new ctt_contract_dal().FindNoDeleteById((long)iProduct.contract_id); } if (iProduct.cate_id != null) { installed_product_cate_id.SelectedValue = iProduct.cate_id.ToString(); } if (iProduct.contact_id != null) { contact_id.SelectedValue = iProduct.contact_id.ToString(); } viewSubscription_iframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONFIGSUBSCRIPTION + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.CONFIGSUBSCRIPTION + "&id=" + iProduct.id; view_ticket_iframe.Src = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con3962=" + iProduct.id + "¶m1=ShowPara"; // todo 订阅的通用查询 // "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.CONTACT_COMPANY_VIEW + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ContactCompanyView + "&id=" + id; thisNoteAtt = new com_attachment_dal().GetAttListByOid(iProduct.id); if (!isAdd) { if (iProduct.parent_id != null) { parentInsPro = new crm_installed_product_dal().GetInstalledProduct((long)iProduct.parent_id); } childInsProList = new crm_installed_product_dal().GetChildInsPro(iProduct.id); } } if (!IsPostBack) { is_active_.Checked = true; if (iProduct != null) { is_active_.Checked = iProduct.is_active == 1; } } } catch (Exception msg) { Response.Write("<script>alert('" + msg.Message + "');window.close();</script>"); } }
public bool MergeContact(long fromConId, long toConId, long userId, bool isDelete = false) { crm_contact fromCon = GetContact(fromConId); crm_contact toCon = GetContact(toConId); if (fromCon == null || toCon == null || fromConId == toConId) { return(false); } CompanyBLL accBll = new CompanyBLL(); // 商机// 销售订单 OpportunityBLL oppoBll = new OpportunityBLL(); List <crm_opportunity> oppoList = new OpportunityBLL().GetOppoBySql($"SELECT * from crm_opportunity where delete_time =0 and contact_id = {fromConId.ToString()} "); if (oppoList != null && oppoList.Count > 0) { oppoList.ForEach(_ => { _.contact_id = toConId; oppoBll.EdotOpportunity(_, userId); }); } // 待办 // 活动 ActivityBLL actBll = new ActivityBLL(); List <com_activity> activityList = new ActivityBLL().GetToListBySql($"select * from com_activity where delete_time =0 and contact_id = {fromConId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)"); if (activityList != null && activityList.Count > 0) { activityList.ForEach(_ => { _.contact_id = toConId; actBll.EditActivity(_, userId); }); } // 工单 // 任务 TicketBLL taskBll = new TicketBLL(); List <sdk_task> ticketList = accBll.GetBySql <sdk_task>($"SELECT * from sdk_task where type_id in (1809,1807) and delete_time = 0 and contact_id = {fromConId.ToString()}"); if (ticketList != null && ticketList.Count > 0) { ticketList.ForEach(_ => { _.contact_id = toConId; taskBll.EditTicket(_, userId); }); } // 调查 // 联系人群组 List <crm_contact_group> groupList = accBll.GetBySql <crm_contact_group>($"SELECT ccg.* from crm_contact_group ccg INNER JOIN crm_contact_group_contact ccgc on ccg.id = ccgc.contact_group_id where ccg.delete_time =0 and ccgc.delete_time = 0 and ccgc.contact_id = {fromConId.ToString()}"); crm_contact_group_contact_dal ccgcDal = new crm_contact_group_contact_dal(); if (groupList != null && groupList.Count > 0) { groupList.ForEach(_ => { var list = GetGroupContactByGroup(_.id); if (list != null && list.Count > 0) { var from = list.FirstOrDefault(l => l.contact_id == toConId); if (from != null) { if (list.Any(l => l.contact_id == toConId)) // 删除源 { ccgcDal.SoftDelete(from, userId); } else // 更改源 { from.contact_id = toConId; ccgcDal.Update(from); } } } }); } // 合同 ContractBLL contractBll = new ContractBLL(); List <ctt_contract> contractList = accBll.GetBySql <ctt_contract>($"SELECT id, name from ctt_contract where delete_time = 0 and contact_id = { fromConId.ToString()}"); if (contractList != null && contractList.Count > 0) { contractList.ForEach(_ => { _.contact_id = toConId; contractBll.EditContractOnly(_, userId); }); } if (isDelete) { DeleteContact(fromConId, userId); } return(true); }
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(); } }