Exemplo n.º 1
0
    private static Guid?ImportPeople(RedBloodDataContext db, People outerP)
    {
        //Importing people
        if (outerP == null || db == null)
        {
            return(null);
        }

        People innerP = PeopleBLL.GetByID(outerP.ID);

        if (innerP == null)
        {
            People newP = new People();

            newP.Name    = outerP.Name;
            newP.DOB     = outerP.DOB;
            newP.DOBYear = outerP.DOBYear;
            newP.CMND    = outerP.CMND;
            newP.SexID   = outerP.SexID;

            GeoBLL.Insert(
                outerP.ResidentGeo1 != null ? outerP.ResidentGeo1.Name : ""
                , outerP.ResidentGeo2 != null ? outerP.ResidentGeo2.Name : ""
                , outerP.ResidentGeo3 != null ? outerP.ResidentGeo3.Name : "");

            newP.ResidentAddress = outerP.ResidentAddress;
            newP.SetResidentGeo3(outerP.FullResidentalGeo);

            if (outerP.EnableMailingAddress.HasValue &&
                outerP.EnableMailingAddress.Value)
            {
                GeoBLL.Insert(
                    outerP.MailingGeo1 != null ? outerP.MailingGeo1.Name : ""
                    , outerP.MailingGeo2 != null ? outerP.MailingGeo2.Name : ""
                    , outerP.MailingGeo3 != null ? outerP.MailingGeo3.Name : "");

                newP.MailingAddress = outerP.MailingAddress;
                newP.SetMailingGeo3(outerP.FullMaillingGeo);

                newP.EnableMailingAddress = outerP.EnableMailingAddress;
            }

            newP.Job   = outerP.Job;
            newP.Email = outerP.Email;
            newP.Phone = outerP.Phone;
            newP.Note  = outerP.Note;

            db.Peoples.InsertOnSubmit(newP);
            db.SubmitChanges();

            return(newP.ID);
        }
        else
        {
            return(innerP.ID);
        }
    }
Exemplo n.º 2
0
    protected void btnLevel1New_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(txtLevel1.Text.Trim()))
        {
            return;
        }

        GeoBLL.Insert(txtLevel1.Text.Trim(), 1, null);

        txtLevel1.Text = "";

        GridView1.DataBind();
    }
Exemplo n.º 3
0
    protected void btnLevel3New_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(txtLevel3.Text.Trim()))
        {
            return;
        }

        if (GridView2.SelectedValue == null)
        {
            return;
        }

        GeoBLL.Insert(txtLevel3.Text.Trim(), 3, (Guid)GridView2.SelectedValue);

        txtLevel3.Text = "";

        GridView3.DataBind();
    }