Exemplo n.º 1
0
        private bool AddRecipient(AutocompleteResult res, string email)
        {
            //add a dummy cp to enable sync back to appt
            ContactPoint cp = new ContactPoint()
            {
                Name = email, Primitive = ContactPointPrimitive.Email
            };

            if (res.EntityType == EntityTypes.Person)
            {
                //Person per = new Person() { Id = res.Id, changeType = ChangeType.Update, Name = res.Name, ImageUrl = res.ImageUrlThumb };
                Person per = new Person();// { Id = res.Id, changeType = ChangeType.Update, Name = res.Name, ImageUrl = res.ImageUrlThumb };
                per = DataAPI.GetPerson(res.Id);
                per.ContactPoints.Add(cp);
                per.changeType = ChangeType.Update;
                _touch.People.Add(per);
                MakeDirty();
            }
            else if (res.EntityType == EntityTypes.Organization)
            {
                //Group org = new Group() { Id = res.Id, changeType = ChangeType.Update, Name = res.Name, ImageUrl = res.ImageUrlThumb, GrpType = GroupType.Organization };
                Group org = new Group();// { Id = res.Id, changeType = ChangeType.Update, Name = res.Name, ImageUrl = res.ImageUrlThumb };
                org = DataAPI.GetOrganization(res.Id);
                org.ContactPoints.Add(cp);
                org.changeType = ChangeType.Update;
                _touch.Groups.Add(org);
                MakeDirty();
            }
            _touch.changeType = ChangeType.Update;
            return(true);
        }
Exemplo n.º 2
0
 private void bLogin_Click(object sender, RibbonControlEventArgs e)
 {
     if (!Globals.ThisAddIn.LoggingIn)
     {
         DataAPI.Login(false);
     }
 }
Exemplo n.º 3
0
        private void ResolveForm_Load(object sender, EventArgs e)
        {
            lblResolve.Text = _resolve;
            List <AutocompleteResult> theList = DataAPI.ResolveEmail(_resolve);

            lbGuesses.DataSource    = theList;
            lbGuesses.DisplayMember = "Name";
            lbGuesses.ValueMember   = "Id";
            lbGuesses.ClearSelected();
            //lblGuesses.Text = string.Format("{0} Suggestions", theList.Count);

            ddDatabase.Items.Clear();
            foreach (Subscription sub in DataAPI.TheUser.Subscriptions)
            {
                if (sub.Group_Id != Guid.Empty && sub.UpdatableGroup)
                {
                    // if (sub.Group_Id != Guid.Empty && sub.Updatable && DataAPI.TheUser.UpdatableSubscriptionIds.Contains(sub.Group_Id))

                    ddDatabase.Items.Add(sub);
                    if (sub.Group_Id == DataAPI.TheUser.DefaultCollection_Id)
                    {
                        ddDatabase.SelectedItem = sub;
                    }
                }
            }
            lbAComplete.BringToFront();

            SetUI();
            txtRecipient.Focus();
            Cursor = Cursors.Default;
        }
Exemplo n.º 4
0
 private void bLogin_Click(object sender, EventArgs e)
 {
     SetUIWorking();
     DataAPI.Login(false);
     Globals.ThisAddIn.InitTheSync();
     Initialize(sender, e);
 }
Exemplo n.º 5
0
        public ActionResult CreateSurvey()
        {
            try
            {
                var survey = new Mihai.Survey.Data.Survey()
                {
                    Name       = Guid.NewGuid().ToString(),
                    UserId     = User.Identity.IsAuthenticated ? User.Identity.Name : "Anonymous",
                    CreateDate = DateTime.UtcNow,
                    UpdateDate = DateTime.UtcNow
                };

                var questions = DataAPI.GetQuestions();
                foreach (var question in questions)
                {
                    BuildSurvey(survey, question);
                }

                DataAPI.SaveSurvey(survey);
            }
            catch (Exception e)
            {
                // log exception
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 6
0
        public async Task <List <ValueResult <Skin> > > CalculateValue(List <Skin> items, bool takeHighestValue)
        {
            var skinItemGrps = await DataAPI.GetSkinItemGroups(items.Select(x => x.ID).ToList());

            List <int> ids = new List <int>();

            foreach (var IDGroup in skinItemGrps.Values)
            {
                ids.AddRange(IDGroup);
            }
            var sellableItems = await DataAPI.GetItemSellable(ids);

            var allListings = await CommerceAPI.ListingsAggregated(sellableItems);

            var results = new List <ValueResult <Skin> >();

            foreach (var skin in skinItemGrps)
            {
                if (takeHighestValue)
                {
                    var listing = allListings.Where(x => skin.Value.Contains(x.ItemID)).OrderBy(x => x.Sells.Price).FirstOrDefault();
                    results.Add(new ValueResult <Skin> {
                        Item = items.Where(x => x.ID == skin.Key).FirstOrDefault(), Value = listing?.Sells.Price
                    });
                }
                else
                {
                    var listing = allListings.Where(x => skin.Value.Contains(x.ItemID)).OrderBy(x => x.Sells.Price).FirstOrDefault();
                    results.Add(new ValueResult <Skin> {
                        Item = items.Where(x => x.ID == skin.Key).FirstOrDefault(), Value = listing?.Buys.Price
                    });
                }
            }
            return(results);
        }
Exemplo n.º 7
0
        public static Location GeoCode(string address)
        {
            Location loc = new Location();

            try
            {
                address = HttpUtility.UrlEncode(address);
                string url = String.Format(GoogResources.Geocode, address);
                using (HttpResponseMessage response = Task.Run <HttpResponseMessage>(() => TheApiClient.GetAsync(url)).Result)
                {
                    string respString = response.Content.ReadAsStringAsync().Result;
                    if (response.IsSuccessStatusCode)
                    {
                        GoogleGeoCodeResponse geo = JsonConvert.DeserializeObject <GoogleGeoCodeResponse>(respString);
                        if (geo.status.ToUpper() == "OK")
                        {
                            return(LocFromGeo(geo));
                        }
                        else
                        {
                            return(loc);
                        }
                    }
                    else
                    {
                        return(loc);
                    }
                }
            }
            catch (Exception ex)
            {
                DataAPI.HandleError("GoogleAPI.GeoCode", ex);
                return(loc);
            }
        }
Exemplo n.º 8
0
        public async Task <IHttpActionResult> GetSessionRequest(int requestId)
        {
            try
            {
                using (var client = new DataAPI(_dataApiUri))
                {
                    var sessionRequest = await client.SessionRequest.GetByRequestIdAsync(requestId);

                    var json = JsonConvert.SerializeObject(sessionRequest, new JsonSerializerSettings
                    {
                        NullValueHandling          = NullValueHandling.Ignore,
                        PreserveReferencesHandling = PreserveReferencesHandling.All
                    });
                    return(ResponseMessage(new HttpResponseMessage
                    {
                        Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
                    }));
                }
            }
            catch (HttpOperationException apiEx)
            {
                Log.Logger.Error("Failed to GET session! Error: {Error}", apiEx.Message);
                return(InternalServerError(apiEx));
            }
            catch (Exception ex)
            {
                Log.Logger.Error("Failed to GET session! Error: {Error}", ex.Message);
                return(InternalServerError(ex));
            }
        }
Exemplo n.º 9
0
        private void Initialize(object sender, EventArgs e)
        {
            //Globals.ThisAddIn.IsInspectorOpen = true;

            //Debug.WriteLine("Initialize {0:T}", DateTime.Now);
            if (DataAPI.Ready())
            {
                _timerForm.timerApptRibbon.Stop();

                Outlook.Inspector insp = this.Context as Outlook.Inspector;
                if (insp.CurrentItem is Outlook.MailItem)
                {
                    _mail = insp.CurrentItem;
                    _mail.BeforeDelete += new Outlook.ItemEvents_10_BeforeDeleteEventHandler(Item_BeforeDelete);
                    _itemType           = Outlook.OlItemType.olMailItem;
                }
                else if (insp.CurrentItem is Outlook.AppointmentItem)
                {
                    _appt = insp.CurrentItem;
                    _appt.BeforeDelete   += new Outlook.ItemEvents_10_BeforeDeleteEventHandler(Item_BeforeDelete);
                    _appt.PropertyChange += _appt_PropertyChange;
                    _itemType             = Outlook.OlItemType.olAppointmentItem;
                }
                insp = null;
                RefreshTouch();
                SetUI();
            }
            else
            {
                _timerForm.timerApptRibbon.Interval = (_timerForm.timerApptRibbon.Interval * 2);
            }
        }
Exemplo n.º 10
0
        public async Task <IHttpActionResult> PostEmail(int submId)
        {
            try
            {
                Submission Submission;
                using (var client = new DataAPI(_dataApiUri))
                {
                    Submission = await client.Submissions.GetBySubmissionIdAsync(submId);
                }

                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("email.usc.edu");
                mail.From = new MailAddress("*****@*****.**");
                mail.To.Add(Submission.Session.UserEmail);
                mail.Subject    = "Session Request Result (Request ID: " + Submission.RequestId + ")";
                mail.IsBodyHtml = true;
                mail.Body       = ComposeEmail(Submission);

                SmtpServer.Send(mail);
                return(Ok());
            }
            catch (HttpOperationException apiEx)
            {
                Log.Logger.Error("Failed to GET session! Error: {Error}", apiEx.Message);
                return(InternalServerError(apiEx));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }   // email
Exemplo n.º 11
0
        private void bBreakSync_Click(object sender, RibbonControlEventArgs e)
        {
            if (_touch.Id != Guid.Empty)
            {
                //ask to delete app touch
                string       msg = string.Format("Ready to break the sync.\n\nDelete the synced touch in the app, too?");
                DialogResult res = MessageBox.Show(msg, "Break Sync", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
                _isSynced = false;
                if (res == DialogResult.Cancel)
                {
                    _isSynced = true;
                }
                else if (res == DialogResult.Yes)
                {
                    //delete touch
                    DataAPI.DeleteTouch(_touch.Id);
                }

                if (!_isSynced)
                {
                    if (IsEmail)
                    {
                        BreakSync(_mail);
                    }
                    else
                    {
                        BreakSync(_appt);
                    }
                }

                SetUI();
            }
        }
Exemplo n.º 12
0
        private void Initialize(object sender, EventArgs e)
        {
            //Debug.WriteLine("Initialize {0:T}", DateTime.Now);
            SetUIWorking();
            if (DataAPI.Ready())
            {
                //Debug.WriteLine("Ready {0:T}", DateTime.Now);
                _timerForm.timerCalRibbon.Stop();
                //initial mail or appt item
                Outlook.Selection explSelection = Globals.ThisAddIn.Application.ActiveExplorer().Selection;
                if (explSelection != null && explSelection.Count > 0)
                {
                    if (explSelection[1] is Outlook.MailItem)
                    {
                        SetMailItem(explSelection[1] as Outlook.MailItem);
                    }
                    else if (explSelection[1] is Outlook.AppointmentItem)
                    {
                        SetApptItem(explSelection[1] as Outlook.AppointmentItem);
                    }
                }
                explSelection = null;

                if (DataAPI.Online)
                {
                    lblStatus.Label = Globals.ThisAddIn.SyncStatus;
                }
                else
                {
                    lblStatus.Label = "";
                }
            }
            SetUI();
        }
Exemplo n.º 13
0
        private void lvUnknown_Click(object sender, EventArgs e)
        {
            //check if filters and warn of clearing
            //Debug.WriteLine("click");
            var ok2Continue = false;

            if (DataAPI.DBsFiltered && !_clearWarningShown)
            {
                var ok2Clear = MessageBox.Show("This will clear your database filters. All databases will be now be visible.  \n\nOK to continue?", "OK to See All Databases?", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (ok2Clear == DialogResult.OK)
                {
                    _clearWarningShown = true;
                    DataAPI.ClearDBFilters();
                    ok2Continue = true;
                }
            }
            else
            {
                ok2Continue = true;
            }

            if (ok2Continue)
            {
                ResolveUnknown(lvUnknown.SelectedItems[0].Text);
            }
        }
Exemplo n.º 14
0
        private void textboxUser_TextChanged(object sender, EventArgs e)
        {
            SetEnableReg();
            lblInUse.Visible = false;
            bool isValid  = false;
            bool showIcon = false;

            if (!string.IsNullOrWhiteSpace(textboxUser.Text))
            {
                showIcon = true;
                if (DataAPI.IsValidEmail(textboxUser.Text))
                {
                    //bool inU
                    isValid          = DataAPIAnon.IsUsernameOK(textboxUser.Text);
                    lblInUse.Visible = !isValid;
                }
            }
            textboxUser.Tag    = isValid;
            pbUsername.Visible = showIcon;
            if (isValid)
            {
                pbUsername.Image = imageOK;
            }
            else
            {
                pbUsername.Image = imageNO;
            }
        }
Exemplo n.º 15
0
        public IActionResult AddSchool() // The Information of School can Send as Object using Serialize json or as strings Data
        {
            DataAPI dataAPI = new DataAPI();

            var Result = _schoolLogic.AddSchool(dataAPI.Name, dataAPI.Address, dataAPI.City, dataAPI.District);

            return(Ok(Result));// The Receive will Check the Result
        }
Exemplo n.º 16
0
        private void bLogout_Click(object sender, EventArgs e)
        {
            Utilities.DeleteRegKey(Properties.Resources.OAuthToken);
            Globals.ThisAddIn.Enabled = false;
            bool res = DataAPI.Logout();

            this.DialogResult = DialogResult.Cancel;
        }
Exemplo n.º 17
0
        private bool RemoveRecipient(object entity)
        {
            if (_isInitialized)
            {
                Guid        entityId   = Guid.Empty;
                EntityTypes entityType = EntityTypes.All;
                string      name       = "";
                if (entity is Person)
                {
                    Person perNew = (Person)entity;
                    perNew.changeType = ChangeType.Remove;
                    name       = perNew.Name;
                    entityId   = perNew.Id;
                    entityType = EntityTypes.Person;
                    Person per = _touch.People.Find(p => p.Id == perNew.Id);
                    if (per != null)
                    {
                        per.changeType = ChangeType.Remove;
                    }
                    _touch.changeType = ChangeType.Update;
                }
                else if (entity is Group)
                {
                    Group orgNew = (Group)entity;
                    orgNew.changeType = ChangeType.Remove;
                    name       = orgNew.Name;
                    entityId   = orgNew.Id;
                    entityType = EntityTypes.Group;
                    Group org = _touch.Groups.Find(p => p.Id == orgNew.Id);
                    if (org != null)
                    {
                        org.changeType = ChangeType.Remove;
                    }
                    _touch.changeType = ChangeType.Update;
                }

                if (entityId != Guid.Empty && entityType != EntityTypes.All)
                {
                    string email = DataAPI.EmailForEntity(entityId, entityType);
                    if (string.IsNullOrWhiteSpace(email))
                    {
                        MessageBox.Show("No email address on record for " + name, "Get Email Address Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else if (email.Length >= 5 && email.Substring(0, 5).ToLower() == "error")
                    {
                        MessageBox.Show(email, "Get Email Address Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else if (email.IndexOf("@") > 0)
                    {
                        //todo fix
                        //_ribbon.RemoveRecipient(name, email);
                        _touch.changeType = ChangeType.Update;
                    }
                }
                MakeDirty();
            }
            return(true);
        }
Exemplo n.º 18
0
        private bool RecipientSelected(AutocompleteResult res)
        {
            if (res != null)
            {
                if (res.EntityType == EntityTypes.Private)
                {
                    Group grp = DataAPI.GetGroup(res.Id, true);
                    foreach (Person p in grp.People)
                    {
                        AutocompleteResult per = new AutocompleteResult()
                        {
                            EntityType = EntityTypes.Person,
                            Id         = p.Id,
                            Name       = p.Name
                        };
                        if (p.ContactPoints.Count > 0 && Utilities.IsValidEmail(p.ContactPoints[0].Name))
                        {
                            AddRecipient(per, p.ContactPoints[0].Name);
                        }
                    }
                    foreach (Group o in grp.Groups)
                    {
                        AutocompleteResult org = new AutocompleteResult()
                        {
                            EntityType = EntityTypes.Organization,
                            Id         = o.Id,
                            Name       = o.Name
                        };
                        if (o.ContactPoints.Count > 0 && Utilities.IsValidEmail(o.ContactPoints[0].Name))
                        {
                            AddRecipient(org, o.ContactPoints[0].Name);
                        }
                    }
                }
                else
                {
                    string email = DataAPI.EmailForEntity(res.Id, res.EntityType);
                    if (string.IsNullOrWhiteSpace(email))
                    {
                        MessageBox.Show("No email address on record for " + res.Name, "Get Email Address Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else if (email.Length >= 5 && email.Substring(0, 5).ToLower() == "error")
                    {
                        MessageBox.Show(email, "Get Email Address Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else if (email.IndexOf("@") > 0)
                    {
                        //add to appt
                        AddRecipient(res, email);
                    }
                }
            }
            ResetACRecip(true);
            PaintTouch();
            txtRecipient.Focus();

            return(true);
        }
Exemplo n.º 19
0
        private void bLoc_Click(object sender, RibbonControlEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            Location loc         = new Location();
            Guid     origId      = Guid.Empty;
            string   origAddress = "";

            if (_appt != null)
            {
                if (_touch.Locations.Count == 0)
                {
                    loc = new Location()
                    {
                        UserType_Id     = Guids.Loc_Business,
                        Address         = _appt.Location,
                        changeType      = ChangeType.Update,
                        Collection_Id   = _touch.Collection_Id,
                        OwnedByGroup_Id = _touch.OwnedByGroup_Id,
                        OwnedBy_Id      = _touch.OwnedBy_Id
                    };
                }
                else
                {
                    loc         = _touch.Locations[0];
                    origId      = loc.Id;
                    origAddress = loc.Address;
                }

                locationForm frm    = new locationForm(loc);
                DialogResult result = frm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    loc = frm.TheLocation;
                    if (origAddress == "" || origAddress != loc.Address)
                    {
                        //ReplaceLocation(origId, loc);
                        foreach (Location l in _touch.Locations)
                        {
                            l.changeType = ChangeType.Remove;
                            DataAPI.DeleteLocation(l.Id);
                        }

                        loc.changeType = ChangeType.Update;
                        loc.Id         = DataAPI.PostLocation(loc);
                        DataAPI.PostRelationship(new RelationshipPost()
                        {
                            entityType1 = EntityTypes.Touch, entityId1 = _touch.Id, entityType2 = EntityTypes.Location, entityId2 = loc.Id
                        });
                        _touch.Locations.Add(loc);

                        _touch.changeType = ChangeType.Update;

                        _appt.Location = loc.Address;
                    }
                    //SyncApptDetails();
                }
            }
        }
Exemplo n.º 20
0
        public async Task <IHttpActionResult> GetSubmissions()
        {
            string department = null;
            string status     = null;

            try
            {
                var user = new UserHelper();

                if (user.IsAdmin == false)
                {
                    return(NotFound());
                }

                if (user.IsFao)     // Get the FAO Queue
                {
                    department = "Fao";
                    status     = "Pending";
                }

                if (user.IsRnr)     // Get the RNR Queue
                {
                    department = "Rnr";
                    status     = "Pending";
                }

                if (user.IsBur)     // Get the BUR Queue
                {
                    department = "Bur";
                }

                using (var client = new DataAPI(_dataApiUri))
                {
                    var sessionRequest = await client.Submissions.GetByDepartmentStatusAsync(department, status);

                    var json = JsonConvert.SerializeObject(sessionRequest, new JsonSerializerSettings
                    {
                        NullValueHandling          = NullValueHandling.Ignore,
                        PreserveReferencesHandling = PreserveReferencesHandling.All
                    });
                    return(ResponseMessage(new HttpResponseMessage
                    {
                        Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json")
                    }));
                }
            }
            catch (HttpOperationException apiEx)
            {
                Log.Logger.Error("Failed to GET submissions! Error: {Error}", apiEx.Message);
                return(InternalServerError(apiEx));
            }
            catch (Exception ex)
            {
                Log.Logger.Error("Failed to GET submissions! Error: {Error}", ex.Message);
                return(InternalServerError(ex));
            }
        }
Exemplo n.º 21
0
        private void bSave_Click(object sender, EventArgs e)
        {
            _touch.Id = DataAPI.PostTouch(_touch, true);
            var ty = (_isEmail) ? Outlook.OlItemType.olMailItem : Outlook.OlItemType.olAppointmentItem;

            Globals.ThisAddIn.RegisterTouchUpdate(_touch, ty);
            // Debug.WriteLine("Touch updated by details form.");
            this.DialogResult = DialogResult.Yes;
        }
Exemplo n.º 22
0
        private bool GetACResultsRecip()
        {
            List <AutocompleteResult> results = DataAPI.AutocompleteEmailRecipients(txtRecipient.Text, _noRecs);

            LoadLbAC(results);
            _isSearching = false;
            Cursor       = Cursors.Default;
            return(true);
        }
Exemplo n.º 23
0
        private bool GetACResultsTag()
        {
            _acResultsTag = DataAPI.GetTagsAC(txtTag.Text);
            List <AutocompleteResult> results = _acResultsTag.FindAll(r => !(IsTagInTouch(r.Id)));

            LoadLbACTags(results);
            _isSearchingTag = false;
            Cursor          = Cursors.Default;
            return(true);
        }
Exemplo n.º 24
0
        private void UpdateData()
        {
            lbAComplete.DataSource    = DataAPI.AutocompletePeopleOrgs(txtRecipient.Text);
            lbAComplete.DisplayMember = "Name";
            lbAComplete.ValueMember   = "Id";
            lbAComplete.Visible       = txtRecipient.Enabled = true;
            gbAddNew.Visible          = !lbAComplete.Visible;

            _isSearching = false;
            Cursor       = Cursors.Default;
        }
Exemplo n.º 25
0
 private bool ResolveOrgAndClose(Group org)
 {
     //update touch in ribbon
     org.changeType = ChangeType.Update;
     _touch.Groups.Add(org);
     _touch.resolveStrings.RemoveAll(s => s == _resolve);
     _touch.changeType = ChangeType.Update;
     DataAPI.AssociateEmail(org.Id, EntityTypes.Group, _resolve);
     this.DialogResult = DialogResult.OK;
     return(true);
 }
Exemplo n.º 26
0
        private void bAdd_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            Subscription sub = (Subscription)ddDatabase.SelectedItem;

            Group db = DataAPI.GetGroup(sub.Group_Id, false);

            if (db.Id != Guid.Empty)
            {
                if (rbOrg.Checked)
                {
                    Group org = new Group()
                    {
                        Name = txtOrgname.Text, OwnedBy_Id = DataAPI.TheUser.Id, GrpType = GroupType.Organization, Collection_Id = db.Id, OwnedByGroup_Id = db.OwnedByGroup_Id, changeType = ChangeType.Update
                    };
                    org.Id = DataAPI.PostGroup(org);
                    ContactPoint cp = new ContactPoint()
                    {
                        Name = _resolve, UserType_Id = Guids.CP_Email, OwnedBy_Id = DataAPI.TheUser.Id, Collection_Id = db.Id, OwnedByGroup_Id = db.OwnedByGroup_Id, Primitive = ContactPointPrimitive.Email
                    };
                    cp.Id = DataAPI.PostCP(cp);
                    org.ContactPoints.Add(cp);
                    DataAPI.PostRelationship(new RelationshipPost()
                    {
                        entityId1 = org.Id, entityId2 = cp.Id, entityType1 = EntityTypes.Group, entityType2 = EntityTypes.ContactPoint
                    });
                    ResolveOrgAndClose(org);
                }
                else
                {
                    Person per = new Person()
                    {
                        Firstname = txtFirst.Text, Lastname = txtLast.Text, Name = txtFirst.Text + " " + txtLast.Text, OwnedBy_Id = DataAPI.TheUser.Id, Collection_Id = db.Id, OwnedByGroup_Id = db.OwnedByGroup_Id, changeType = ChangeType.Update
                    };
                    per.Id = DataAPI.PostPerson(per);
                    ContactPoint cp = new ContactPoint()
                    {
                        Name = _resolve, UserType_Id = Guids.CP_Email, OwnedBy_Id = DataAPI.TheUser.Id, Collection_Id = db.Id, OwnedByGroup_Id = db.OwnedByGroup_Id, Primitive = ContactPointPrimitive.Email
                    };
                    cp.Id = DataAPI.PostCP(cp);
                    per.ContactPoints.Add(cp);
                    DataAPI.PostRelationship(new RelationshipPost()
                    {
                        entityId1 = per.Id, entityId2 = cp.Id, entityType1 = EntityTypes.Person, entityType2 = EntityTypes.ContactPoint
                    });
                    ResolvePersonAndClose(per);
                }
            }
            else
            {
                MessageBox.Show("Unable to get db info", "Error");
            }
        }
Exemplo n.º 27
0
 public ActionResult Survey()
 {
     try
     {
         var questions = DataAPI.GetQuestionsAndAnswers();
         return(View(questions));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 28
0
        private void cb_CheckedChanged(object sender, EventArgs e)
        {
            if (_initialized)
            {
                CheckBox cb = (CheckBox)sender;

                string prefname  = cb.Name.Substring(2).ToLower();
                string prefvalue = cb.Checked.ToString().ToLower();

                DataAPI.PostUserPreference(prefname, prefvalue);
            }
        }
Exemplo n.º 29
0
 private bool AddTagEmailCheck(Guid tagId)
 {
     //existing email touch: save the relationship
     if (_isEmail && _touch.Id != Guid.Empty)
     {
         DataAPI.PostRelationship(new RelationshipPost()
         {
             entityType1 = EntityTypes.Touch, entityId1 = _touch.Id, entityType2 = EntityTypes.Tag, entityId2 = tagId
         });
     }
     return(true);
 }
Exemplo n.º 30
0
        private bool ResolvePersonAndClose(Person per)
        {
            //update touch in ribbon
            per.changeType = ChangeType.Update;
            _touch.People.Add(per);
            _touch.resolveStrings.RemoveAll(s => s == _resolve);
            _touch.changeType = ChangeType.Update;

            DataAPI.AssociateEmail(per.Id, EntityTypes.Person, _resolve);

            this.DialogResult = DialogResult.OK;
            return(true);
        }