/// <summary> /// 删除联系人的事件 /// </summary> /// <param name="context"></param> /// <param name="contact_id"></param> public void DeleteContact(HttpContext context, long contact_id) { if (AuthBLL.GetUserContactAuth(LoginUserId, LoginUser.security_Level_id, contact_id).CanDelete == false) { return; } var result = new ContactBLL().DeleteContact(contact_id, LoginUserId); if (result) { context.Response.Write("删除联系人成功!"); } else { context.Response.Write("删除联系人失败!"); } }
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) { bool is_edit = long.TryParse(Request.QueryString["id"], out id); thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); if (is_edit) { if (AuthBLL.GetUserContactAuth(LoginUserId, LoginUser.security_Level_id, id).CanEdit == false) { Response.End(); return; } } try { var account_id = Request.QueryString["account_id"]; if (!string.IsNullOrEmpty(account_id)) { account = new CompanyBLL().GetCompany(long.Parse(account_id)); } callBackFiled = Request.QueryString["callback"]; } catch (Exception) { Response.End(); } if (IsPostBack) { SaveFormData(); } else { var dic = new ContactBLL().GetField(); // 称谓 sufix.DataTextField = "show"; sufix.DataValueField = "val"; sufix.DataSource = dic.FirstOrDefault(_ => _.Key == "sufix").Value; sufix.DataBind(); sufix.Items.Insert(0, new ListItem() { Value = "0", Text = " ", Selected = true }); contact_udfList = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.CONTACT); if (is_edit) { dto = new ContactBLL().GetContactDto(long.Parse(Request.QueryString["id"])); active.Checked = dto.contact.is_active == 1 ? true : false; primary.Checked = dto.contact.is_primary_contact == 1 ? true : false; allowEmail.Checked = dto.contact.allow_notify_email_task_ticket == 1 ? true : false; optoutEmail.Checked = dto.contact.is_optout_contact_group_email == 1 ? true : false; optoutSurvey.Checked = dto.contact.is_optout_survey == 1 ? true : false; if (!string.IsNullOrEmpty(dto.contact.avatar)) { avatarPath = dto.contact.avatar; } } else { dto.contact = new crm_contact(); dto.udf = new List <UserDefinedFieldValue>(); dto.location = new crm_location(); dto.location2 = new crm_location(); active.Checked = true; allowEmail.Checked = true; } } }