Beispiel #1
0
    protected void SaveEmailMobiles()
    {
        CaseUserProfile u    = new CaseUserProfile(ContactCaseID);
        UserEmail       ueop = new UserEmail();

        foreach (UserEmail ue in u.Emails)
        {
            if (Request.Form["tbEmail_" + ue.ID.ToString()] != null)
            {
                string Email = Request.Form["tbEmail_" + ue.ID.ToString()].ToString();
                if (ue.Email != Email)
                {
                    ueop.Update(ue.ID, Email);
                }
            }
            else
            {
                ueop.Delete(ue.ID);
            }
        }
        UserMobile umop = new UserMobile();

        foreach (UserMobile um in u.Mobiles)
        {
            if (Request.Form["tbMobileNo_" + um.ID.ToString()] != null)
            {
                string MobileNo = Request.Form["tbMobileNo_" + um.ID.ToString()].ToString();
                if (um.Mobile != MobileNo)
                {
                    umop.Update(um.ID, MobileNo);
                }
            }
            else
            {
                umop.Delete(um.ID);
            }
        }

        //新增
        string tbMobileNo = Request.Form["tbMobileNo"] ?? "";
        string tbEmail    = Request.Form["tbEmail"] ?? "";

        tbMobileNo = tbMobileNo.TrimEnd(',');
        tbEmail    = tbEmail.TrimEnd(',');

        //Response.Write(ContactCaseID.ToString() + tbMobileNo);
        //Response.End();
        if (tbEmail != "")
        {
            ueop.Add(ContactCaseID, tbEmail);
        }
        if (tbMobileNo != "")
        {
            umop.Add(ContactCaseID, tbMobileNo);
        }

        u.UpdateMainMobileCol(ContactCaseID);
    }