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); } }
public HttpResponseMessage GetContact(int contactId) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); Contact contact = ContactBLL.GetContact(contactId); UserPrincipal loggedInUser = (UserPrincipal)HttpContext.Current.User; if (loggedInUser.AccountSession.ClubId == contact.ClubId) { response.Content = new ObjectContent <ContactModel>(new ContactModel(contact), new JsonMediaTypeFormatter()); } else { LogHelper.LogWarn(string.Format("UserId: {0} trying to get a contact outside of the club, contact: {1}", loggedInUser.AccountSession.AccountId, contactId), null, loggedInUser.AccountSession.ClubId); response.StatusCode = HttpStatusCode.Forbidden; } return(response); }
public HttpResponseMessage DeleteContact(int contactId) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); Contact contact = ContactBLL.GetContact(contactId); UserPrincipal loggedInUser = (UserPrincipal)HttpContext.Current.User; if (loggedInUser.AccountSession.ClubId == contact.ClubId) { ContactBLL.DeleteContact(contact); } else { LogHelper.LogWarn(string.Format("UserId: {0} trying to delete a contact outside of the club, contact: {1}", loggedInUser.AccountSession.AccountId, contactId), null, loggedInUser.AccountSession.ClubId); response.StatusCode = HttpStatusCode.Forbidden; } return(response); }
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 bool isTemp = false; // 是否是查看联系人活动模板 protected void Page_Load(object sender, EventArgs e) { try { var groupId = Request.QueryString["groupId"]; if (!string.IsNullOrEmpty(groupId)) { pageGroup = conBll.GetGroupById(long.Parse(groupId)); } if (pageGroup != null && Request.QueryString["isGroup"] == "1") { var contactList = conBll.GetGroupContactByGroup(pageGroup.id); if (contactList != null && contactList.Count > 0) { var accoubtId = Request.QueryString["accountId"]; contactList.ForEach(_ => { var thisContact = conBll.GetContact(_.contact_id); if (thisContact != null) { if (!string.IsNullOrEmpty(accoubtId)) { if (thisContact.account_id.ToString() == Request.QueryString["accountId"]) { conIds += _.contact_id.ToString() + ","; } } else { conIds += _.contact_id.ToString() + ","; } } }); if (!string.IsNullOrEmpty(conIds)) { conIds = conIds.Substring(0, conIds.Length - 1); } } } if (string.IsNullOrEmpty(conIds)) { conIds = Request.QueryString["ids"]; } if (!string.IsNullOrEmpty(conIds)) { conIdArr = conIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } chooseType = Request.QueryString["chooseType"]; if (noteTypeList != null && noteTypeList.Count > 0) { noteTypeList = noteTypeList.Where(_ => _.parent_id == (int)DTO.DicEnum.CALENDAR_DISPLAY.LIST).ToList(); } if (!string.IsNullOrEmpty(Request.QueryString["tempId"])) { actionTemp = conBll.GetTempById(long.Parse(Request.QueryString["tempId"])); } if (actionTemp != null && Request.QueryString["isTemp"] == "1") { isTemp = true; } if (string.IsNullOrEmpty(conIds) && (!isTemp)) { Response.Write($"<script>alert('请选择相关联系人!');window.close();</script>"); return; } if (IsPostBack) { ExexuteContactDto param = new ExexuteContactDto(); param.ids = conIds; if (!string.IsNullOrEmpty(Request.Form["ckNote"]) && Request.Form["ckNote"].Equals("on")) { param.isHasNote = true; } if (param.isHasNote) { param.note_action_type = int.Parse(Request.Form["note_action_type"]); param.note_content = Request.Form["note_content"]; } if (!string.IsNullOrEmpty(Request.Form["ckTodo"]) && Request.Form["ckTodo"].Equals("on")) { param.isHasTodo = true; } if (param.isHasTodo) { param.todo_action_type = int.Parse(Request.Form["todo_action_type"]); param.todo_content = Request.Form["todo_content"]; param.assignRes = long.Parse(Request.Form["todo_resource_id"]); param.startDate = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["startDate"])); param.endDate = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["endDate"])); } var result = false; if (param.isHasTodo || param.isHasNote) { result = conBll.ExectueContactAction(param, LoginUserId); } ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('执行{(result?"成功":"失败")}');window.close();</script>"); } } catch (Exception msg) { Response.Write($"<script>alert('{msg.Message}');window.close();</script>"); } }
// GET: Contact public ActionResult Index() { return(View(contactBLL.GetContact())); }
public ApiResultDto Contact([FromUri] long id) { return(ResultSuccess(_bll.GetContact(id))); }