Exemple #1
0
        public ActionResult ProcessNoMatches()
        {
            foreach (string s in Request.Form)
            {
                if (s.StartsWith("SyncIt"))
                {
                    string f1IndividualID = s.Split('-')[1];

                    Model.F1.person p = this.NoMatches.FindF1PersonByID(f1IndividualID);

                    if (!this.AttributeID.HasValue)
                    {
                        this.AttributeID = this.F1GetAttributeID("SyncMe");
                    }
                    Model.F1.peopleAttribute peopleAttribute = p.attributes.FindByID(this.AttributeID.Value);

                    if (Request.Form[s].ToString() == "1")
                    {
                        F1toPCO.Model.PCO.person pcop = new F1toPCO.Model.PCO.person();
                        this.UpdatePerson(p, ref pcop);

                        try
                        {
                            Model.PCO.person createdPerson = this.PCOCreatePerson(this.SerializeEntity(pcop));
                            if (createdPerson != null)
                            {
                                peopleAttribute.comment = createdPerson.id.Value;
                                this.F1UpdatePeopleAttribute(peopleAttribute);
                            }
                        }
                        catch
                        {
                            this.PersonErrors.Add(p);
                        }
                    }
                    else
                    {
                        this.F1DeletePeopleAttribute(peopleAttribute);
                    }
                }
            }
            this.NoMatches.Clear();

            if (this.Matches.Count > 0)
            {
                return(RedirectToAction("MultipleMatches"));
            }

            return(RedirectToAction("Success"));
        }
Exemple #2
0
        public ActionResult ProcessMatches()
        {
            foreach (string f1ID in Request.Form)
            {
                Model.PCO.person createdPerson = null;
                Model.F1.person  p             = this.Matches.FindF1PersonByID(f1ID);

                if (!this.AttributeID.HasValue)
                {
                    this.AttributeID = this.F1GetAttributeID("SyncMe");
                }

                Model.F1.peopleAttribute peopleAttribute = p.attributes.FindByID(this.AttributeID.Value);

                string f1IndividualID = Request.Form[f1ID].ToString();
                switch (Request.Form[f1ID].ToString())
                {
                case "0":
                    this.F1DeletePeopleAttribute(peopleAttribute);
                    break;

                case "-1":
                    Model.PCO.person newPCO = new Model.PCO.person();
                    this.UpdatePerson(p, ref newPCO);

                    try
                    {
                        createdPerson = this.PCOCreatePerson(this.SerializeEntity(newPCO));
                    }
                    catch
                    {
                        this.PersonErrors.Add(p);
                    }

                    if (createdPerson != null)
                    {
                        peopleAttribute.comment = createdPerson.id.Value;
                        this.F1UpdatePeopleAttribute(peopleAttribute);
                    }

                    break;

                default:
                    var pcoPerson = this.Matches.FindPCOPersonByID(Request.Form[f1ID].ToString());
                    this.UpdatePerson(p, ref pcoPerson);

                    try
                    {
                        this.PCOUpdatePerson(this.SerializeEntity(pcoPerson), Request.Form[f1ID].ToString());
                    }
                    catch
                    {
                        this.PersonErrors.Add(p);
                    }
                    peopleAttribute.comment = pcoPerson.id.Value;
                    this.F1UpdatePeopleAttribute(peopleAttribute);

                    break;
                }
            }
            this.Matches.Clear();

            return(RedirectToAction("Success"));
        }