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; } } }