protected void btnSave_Click(object sender, EventArgs e) { int NewContactID = 0; UserContact uc = new UserContact(); if (ContactID != 0) { uc.ContactID = ContactID; uc.IsMain = cbMain.Checked; uc.RelationShip = Convert.ToInt32(ddlRS.SelectedValue); uc.Update(); } else { uc.CaseID = CaseID; uc.ContactCaseID = ContactCaseID; uc.IsMain = cbMain.Checked; uc.RelationShip = Convert.ToInt32(ddlRS.SelectedValue); NewContactID = uc.Add(); ReadSession(NewContactID); } //Response.Write(ContactID); //Response.Write(cbMain.Checked.ToString ()); UpdateContactData(); SaveEmailMobiles(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('成功!');" + (CaseID == 0 && NewContactID != 0 ? "window.opener.AddContactTr(" + NewContactID.ToString() + ")" : "window.opener.LoadContactList()") + ";window.close();", true); }