Exemplo n.º 1
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePostContactCreate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService    service = localContext.OrganizationService;
            ITracingService         trace   = localContext.TracingService;
            Entity contactEntity            = (Entity)context.InputParameters["Target"];

            string message = context.MessageName;
            string error   = "";

            try
            {
                ContactHandler contactHandler = new ContactHandler(service, trace);

                contactHandler.SetCity(contactEntity);
                contactHandler.PopulateTaxRate(contactEntity);
                contactHandler.ReplicateAddresstoBillingAddress(contactEntity);
                contactHandler.ConcatenateAddress(contactEntity);
            }
            catch (Exception ex)
            {
                //throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace, Environment.NewLine, error));
                throw new InvalidPluginExecutionException(ex.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePreContactCreate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService    service = localContext.OrganizationService;
            ITracingService         trace   = localContext.TracingService;
            Entity contactEntity            = (Entity)context.InputParameters["Target"];

            string message = context.MessageName;
            string error   = "";

            try
            {
                ContactHandler contactHandler = new ContactHandler(service, trace);
                contactHandler.GetDepartment(contactEntity);
                contactHandler.GetPosition(contactEntity);
                contactHandler.GenerateEmployeeCredentials(contactEntity);

                contactEntity["address3_line1"] = contactEntity.GetAttributeValue <EntityReference>("gsc_dealerid") != null
                            ? contactEntity.GetAttributeValue <EntityReference>("gsc_dealerid").Id
                            : Guid.Empty;

                contactEntity["address3_line2"] = contactEntity.GetAttributeValue <EntityReference>("gsc_branchid") != null
                            ? contactEntity.GetAttributeValue <EntityReference>("gsc_branchid").Id
                            : Guid.Empty;
            }
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace, Environment.NewLine, error));
            }
        }
Exemplo n.º 3
0
        public IActionResult Donation(Donation donate1)
        {
            ContactHandler handler      = new ContactHandler(_configuration);
            var            newDonation1 = handler.AddDonations(donate1);

            return(View());
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int            id      = Convert.ToInt32(Request.QueryString["id"]);
                ContactHandler handler = new ContactHandler();
                SmsContactInfo info    = handler.GetContact(id);
                name     = info.Name;
                phone    = info.Mobile;
                birthday = handler.DateTostr(info.Birthday);
                remark   = info.Comment;
                string st0 = "", st1 = "", st2 = "";
                switch (info.Sex)
                {
                case 0:
                    st0 = "selected='selected'";
                    break;

                case 1:
                    st1 = "selected='selected'";
                    break;

                case 2:
                    st2 = "selected='selected'";
                    break;
                }

                sex = "  <option value='0' " + st0 + ">保密</option>"
                      + " <option value='1' " + st1 + ">男</option>"
                      + " <option value='2' " + st2 + ">女</option>";
                Page.DataBind();
            }
        }
Exemplo n.º 5
0
 public CreateContactHandlerTests()
 {
     _validCommand   = new CreateContactCommand("Leonardo", "Masculino", new DateTime(1984, 2, 16));;
     _invalidCommand = new CreateContactCommand("", "", new DateTime());
     _handler        = new ContactHandler(new FakeContactRepository());
     _result         = new GenericCommandResult();
 }
Exemplo n.º 6
0
        public void Start()
        {
            communicator = new DriverCommunicator();

            contactHandler        = new ContactHandler(IntPtr.Zero);
            contactHandler.Frame += contactHandler_Frame;
        }
 public GenericCommandResult Delete(
     [FromBody] DeleteContactCommand command,
     [FromServices] ContactHandler handler
     )
 {
     return((GenericCommandResult)handler.Handle(command));
 }
Exemplo n.º 8
0
 void ContactDialogResponseHandler(object o, ResponseArgs args, ContactHandler contactHandler)
 {
     var dialog = (ContactDialog)o;
     if (args.ResponseId.Equals(ResponseType.Ok)) {
         contactHandler(dialog.GetContact());
     }
     dialog.Hide();
 }
Exemplo n.º 9
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Proceed?", "Delete Contact", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No) == MessageBoxResult.Yes)
     {
         ContactHandler.DeleteContact(Contact);
         Close();
     }
 }
Exemplo n.º 10
0
        public ActionResult DeleteMessage(int id)
        {
            ContactHandler contactHandler = new ContactHandler();

            contactHandler.DeleteUserMessages(id);

            return(Json("Delete", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 11
0
        public ActionResult GetAllMessages()

        {
            ContactHandler contactHandler = new ContactHandler();
            List <Contact> contacts       = contactHandler.GetAllContactsList();

            return(View(contacts));
        }
Exemplo n.º 12
0
        public IActionResult Contactus(GetInTouch1 contact1)
        {
            ContactHandler handler        = new ContactHandler(_configuration);
            var            newGetInTouch1 = handler.AddGetInTouch1(contact1);

            //contact1.DateCreated = DateTime.Now;
            return(RedirectToAction("Listing"));
        }
Exemplo n.º 13
0
        public IActionResult Listing()
        {
            ContactHandler handler = new ContactHandler(_configuration);

            var contacts = handler.GetAllGetInTouch1();

            return(View(contacts));
        }
Exemplo n.º 14
0
        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            WindowInteropHelper helper = new WindowInteropHelper(this);

            contactHandler        = new ContactHandler(helper.Handle);
            contactHandler.Frame += HandleFrame;
            contactHandler.ReceiveImageType(ImageType.Binarized, true);
            contactHandler.ReceiveEmptyFrames = true;
        }
Exemplo n.º 15
0
 private void Form1_Load(object sender, EventArgs e)
 {
     contactHandler                 = new ContactHandler(Handle);
     contactHandler.NewContact     += HandleContact;
     contactHandler.ContactRemoved += HandleContact;
     contactHandler.ContactMoved   += HandleContact;
     contactHandler.Frame          += HandleFrame;
     contactHandler.ReceiveImageType(ImageType.Normalized, true);
     contactHandler.ReceiveImageType(ImageType.Binarized, true);
     contactHandler.ReceiveEmptyFrames = true;
 }
Exemplo n.º 16
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePreValidateContactCreate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService    service = localContext.OrganizationService;
            ITracingService         trace   = localContext.TracingService;
            Entity contactEntity            = (Entity)context.InputParameters["Target"];

            if (!(context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity))
            {
                return;
            }

            if (contactEntity.LogicalName != "contact")
            {
                return;
            }

            string message = context.MessageName;

            if (context.Mode == 0) //synchronous plugin
            {
                try
                {
                    var recordtype = contactEntity.Contains("gsc_recordtype")
                    ? contactEntity.GetAttributeValue <OptionSetValue>("gsc_recordtype").Value
                    : 0;

                    ContactHandler contactHandler = new ContactHandler(service, trace);
                    contactHandler.CheckForExistingRecords(contactEntity);
                    contactHandler.SetAccessLevel(contactEntity);
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("This record has been identified as a fraud account. Please ask the customer to provide further information."))
                    {
                        throw new InvalidPluginExecutionException("This record has been identified as a fraud account. Please ask the customer to provide further information.");
                    }
                    else if (ex.Message.Contains("This record already exists."))
                    {
                        throw new InvalidPluginExecutionException("This record already exists.");
                    }
                    else
                    {
                        throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace));
                    }
                }
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePreValidateContactDelete(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService    service = localContext.OrganizationService;
            ITracingService         trace   = localContext.TracingService;
            var    contact = (EntityReference)context.InputParameters["Target"];
            string message = context.MessageName;

            if (context.Depth > 1)
            {
                return;
            }

            try
            {
                ContactHandler contactHandler = new ContactHandler(service, trace);

                EntityCollection contactCollection = CommonHandler.RetrieveRecordsByOneValue("contact", "contactid", contact.Id, service,
                                                                                             null, OrderType.Ascending, new[] { "parentcontactid", "gsc_recordtype", "gsc_ispotential" });

                Entity  contactEntity = contactCollection.Entities[0];
                Boolean isProspect    = contactEntity.GetAttributeValue <Boolean>("gsc_ispotential");

                if (contactEntity.Contains("gsc_recordtype") && contactEntity.GetAttributeValue <OptionSetValue>("gsc_recordtype").Value == 100000003)
                {
                    contactHandler.ClearPrimaryContactDetails(contactEntity);
                }

                if (contactHandler.IsUsedInTransaction(contactEntity) == true)
                {
                    throw new InvalidPluginExecutionException("Unable to delete individual record(s) used in transaction");
                }
            }

            catch (Exception ex)
            {
                if (ex.Message.Contains("Unable to delete individual record(s) used in transaction"))
                {
                    throw new InvalidPluginExecutionException(ex.Message);
                }
                else
                {
                    throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace));
                }
            }
        }
        private void ContactManagerWindow_Loaded(object sender, RoutedEventArgs e)
        {
            contacts = ContactHandler.LoadContacts();
            ContactListBox.ItemsSource = contacts;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(ContactListBox.ItemsSource);

            view.Filter = ContactFilter;
            ContactListBox.SelectedIndex = 0;

            CreditsWindow credits = new CreditsWindow();

            credits.Show();
        }
Exemplo n.º 19
0
        public MultitouchInputProvider(PresentationSource source)
        {
            this.source              = source;
            contactsQueue            = new Queue <RawMultitouchReport>();
            inputManagerProcessInput = InputManagerProcessInput;

            contactHandler = new ContactHandler(((HwndSource)source).Handle);
            contactHandler.ContactMoved   += HandleContact;
            contactHandler.ContactRemoved += HandleContact;
            contactHandler.NewContact     += HandleContact;

            inputManager    = InputManager.Current;
            multitouchLogic = MultitouchLogic.Current;
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            try
            {
                // Der Dateiname der XML-Datei
                string xmlFileName = Path.Combine(Application.StartupPath, "contacts.xml");

                // Neues XML-Dokument erzeugen
                ContactHandler ch = new ContactHandler(xmlFileName, true, Encoding.UTF8);

                // Kontakt hinzufügen
                ch.AddContact(1000, "Zap", "BBrox", "01234-12345");
                ch.AddContact(1001, "Ford", "Prefect", "01234-12346");

                // Dokument speichern
                ch.Save();

                // Dokument einlesen
                ch = new ContactHandler(xmlFileName, false, null);

                // Kontakt hinzufügen
                ch.AddContact(1002, "Tricia", "McMillan", "01234-12347");

                // Kontakt ändern
                ch.ChangeContact(1000, "Zaphod", "Beeblebrox", "042-42");

                // Kontakt löschen
                ch.RemoveContact(1001);

                // Kontakt auslesen
                string firstName, lastName, phone;
                ch.ReadContact(1000, out firstName, out lastName, out phone);
                Console.WriteLine("Kontakt 1000:");
                Console.WriteLine(firstName);
                Console.WriteLine(lastName);
                Console.WriteLine(phone);

                // Dokument speichern
                ch.Save();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("Fertig");
            Console.ReadLine();
        }
Exemplo n.º 21
0
        protected override object ConvertToJsonModel(ContactResource resource)
        {
            ContactResource c = new ContactHandler().Get();

            var fn = new object[4] {
                "fn", new { }, "text", c.Contact.FullName
            };
            var tel = new object[4] {
                "tel", new { type = new object[] { "work" } }, "text", "" + c.Contact.Phone
            };
            var contactProperties = new object[] { fn, tel };

            return(new object[]
            {
                "vcard",
                contactProperties
            });
        }
Exemplo n.º 22
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (FirstNameTextBox.Text != Contact.FirstName)
            {
                Contact.FirstName = FirstNameTextBox.Text;
            }
            if (MiddleNameTextBox.Text != Contact.MiddleName)
            {
                Contact.MiddleName = MiddleNameTextBox.Text;
            }
            if (LastNameTextBox.Text != Contact.LastName)
            {
                Contact.LastName = LastNameTextBox.Text;
            }
            if (EmailTextBox.Text != Contact.Email)
            {
                Contact.Email = EmailTextBox.Text;
            }
            if (PhoneTextBox.Text != Contact.PhoneNumber)
            {
                Contact.PhoneNumber = PhoneTextBox.Text;
            }
            if (HasIconCheckBox.IsChecked != Contact.HasIcon)
            {
                Contact.HasIcon = (bool)HasIconCheckBox.IsChecked;
            }

            if (!string.IsNullOrWhiteSpace(FirstNameTextBox.Text))
            {
                ContactHandler.SaveContact(Contact);
                Close();
                if (Contact.HasIcon)
                {
                    MessageBox.Show($"Place your Icon to '{Directory.GetParent(Contact.Icon)}' and name it '{Contact.LastName}_{Contact.FirstName}.png'", "Icon", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            else
            {
                MessageBox.Show("You Cannot save an empty contact!\nAdd at least 'First Name'.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePostContactUpdate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService    service = localContext.OrganizationService;
            ITracingService         trace   = localContext.TracingService;

            Entity preImageEntity  = (context.PreEntityImages != null && context.PreEntityImages.Contains(this.preImageAlias)) ? context.PreEntityImages[this.preImageAlias] : null;
            Entity postImageEntity = (context.PostEntityImages != null && context.PostEntityImages.Contains(this.postImageAlias)) ? context.PostEntityImages[this.postImageAlias] : null;

            if (!(context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity))
            {
                return;
            }

            if (postImageEntity.LogicalName != "contact")
            {
                return;
            }
            Entity contactEntity = (Entity)context.InputParameters["Target"];

            string message = context.MessageName;

            if (context.Mode == 0) //Synchronous plugin
            {
                try
                {
                    ContactHandler contactHandler = new ContactHandler(service, trace);

                    #region Pre-images
                    String preImageStreet = preImageEntity.Contains("address1_line1")
                        ? preImageEntity.GetAttributeValue <String>("address1_line1")
                        : String.Empty;

                    Guid preImageProvinceId = preImageEntity.GetAttributeValue <EntityReference>("gsc_provinceid") != null
                        ? preImageEntity.GetAttributeValue <EntityReference>("gsc_provinceid").Id
                        : Guid.Empty;

                    Guid preImageCountryId = preImageEntity.GetAttributeValue <EntityReference>("gsc_countryid") != null
                        ? preImageEntity.GetAttributeValue <EntityReference>("gsc_countryid").Id
                        : Guid.Empty;

                    String preImageZipCode = preImageEntity.Contains("address1_postalcode")
                        ? preImageEntity.GetAttributeValue <String>("address1_postalcode")
                        : String.Empty;

                    String preImageTelephone = preImageEntity.Contains("telephone1")
                        ? preImageEntity.GetAttributeValue <String>("telephone1")
                        : String.Empty;

                    String preImageTin = preImageEntity.Contains("gsc_tin")
                        ? preImageEntity.GetAttributeValue <String>("gsc_tin")
                        : String.Empty;

                    Guid preImageTaxId = preImageEntity.GetAttributeValue <EntityReference>("gsc_taxid") != null
                        ? preImageEntity.GetAttributeValue <EntityReference>("gsc_taxid").Id
                        : Guid.Empty;

                    Guid preImageThemeId = preImageEntity.GetAttributeValue <EntityReference>("gsc_themes") != null
                     ? preImageEntity.GetAttributeValue <EntityReference>("gsc_themes").Id
                     : Guid.Empty;

                    var preImageMobile = preImageEntity.Contains("mobilephone")
                     ? preImageEntity.GetAttributeValue <String>("mobilephone")
                     : String.Empty;

                    var preImageEmail = preImageEntity.Contains("emailaddress1")
                     ? preImageEntity.GetAttributeValue <String>("emailaddress1")
                     : String.Empty;

                    var preImageRelation = preImageEntity.Contains("gsc_contactrelation")
                     ? preImageEntity.GetAttributeValue <String>("gsc_contactrelation")
                     : String.Empty;

                    var preImageFirstName = preImageEntity.Contains("firstname") ? preImageEntity.GetAttributeValue <string>("firstname")
                        : String.Empty;

                    var preImageLastName = preImageEntity.Contains("lastname") ? preImageEntity.GetAttributeValue <string>("lastname")
                        : String.Empty;

                    var preImageBirthdate = preImageEntity.Contains("birthdate") ? preImageEntity.GetAttributeValue <DateTime?>("birthdate")
                        : (DateTime?)null;

                    var preImageCityName = preImageEntity.Contains("gsc_cityname") ? preImageEntity.GetAttributeValue <string>("gsc_cityname")
                        : String.Empty;

                    var preImageCityIdName = preImageEntity.Contains("gsc_cityid") ? preImageEntity.GetAttributeValue <EntityReference>("gsc_cityid").Name
                        : String.Empty;
                    #endregion

                    #region Post-images
                    String postImageStreet = postImageEntity.Contains("address1_line1")
                        ? postImageEntity.GetAttributeValue <String>("address1_line1")
                        : String.Empty;

                    Guid postImageProvinceId = postImageEntity.GetAttributeValue <EntityReference>("gsc_provinceid") != null
                        ? postImageEntity.GetAttributeValue <EntityReference>("gsc_provinceid").Id
                        : Guid.Empty;

                    Guid postImageCountryId = postImageEntity.GetAttributeValue <EntityReference>("gsc_countryid") != null
                        ? postImageEntity.GetAttributeValue <EntityReference>("gsc_countryid").Id
                        : Guid.Empty;

                    String postImageZipCode = postImageEntity.Contains("address1_postalcode")
                        ? postImageEntity.GetAttributeValue <String>("address1_postalcode")
                        : String.Empty;

                    String postImageTelephone = postImageEntity.Contains("telephone1")
                        ? postImageEntity.GetAttributeValue <String>("telephone1")
                        : String.Empty;

                    String postImageTin = postImageEntity.Contains("gsc_tin")
                        ? postImageEntity.GetAttributeValue <String>("gsc_tin")
                        : String.Empty;

                    Guid postImageTaxId = postImageEntity.GetAttributeValue <EntityReference>("gsc_taxid") != null
                        ? postImageEntity.GetAttributeValue <EntityReference>("gsc_taxid").Id
                        : Guid.Empty;

                    Guid postImageThemeId = postImageEntity.GetAttributeValue <EntityReference>("gsc_themes") != null
                      ? postImageEntity.GetAttributeValue <EntityReference>("gsc_themes").Id
                      : Guid.Empty;

                    var postImageMobile = postImageEntity.Contains("mobilephone")
                     ? postImageEntity.GetAttributeValue <String>("mobilephone")
                     : String.Empty;

                    var postImageEmail = postImageEntity.Contains("emailaddress1")
                     ? postImageEntity.GetAttributeValue <String>("emailaddress1")
                     : String.Empty;

                    var postImageRelation = postImageEntity.Contains("gsc_contactrelation")
                     ? postImageEntity.GetAttributeValue <String>("gsc_contactrelation")
                     : String.Empty;

                    var postImageFirstName = postImageEntity.Contains("firstname") ? postImageEntity.GetAttributeValue <string>("firstname")
                        : String.Empty;

                    var postImageLastName = postImageEntity.Contains("lastname") ? postImageEntity.GetAttributeValue <string>("lastname")
                        : String.Empty;

                    var postImageBirthdate = postImageEntity.Contains("birthdate") ? postImageEntity.GetAttributeValue <DateTime?>("birthdate")
                        : (DateTime?)null;

                    var postImageCityName = postImageEntity.Contains("gsc_cityname") ? postImageEntity.GetAttributeValue <string>("gsc_cityname")
                        : String.Empty;

                    var postImageCityIdName = postImageEntity.Contains("gsc_cityid") ? postImageEntity.GetAttributeValue <EntityReference>("gsc_cityid").Name
                        : String.Empty;

                    #endregion

                    if (preImageStreet != postImageStreet || preImageCityIdName != postImageCityIdName || preImageProvinceId != postImageProvinceId || preImageCountryId != postImageCountryId ||
                        preImageZipCode != postImageZipCode || preImageMobile != postImageMobile || preImageTelephone != postImageTelephone || preImageTin != postImageTin)
                    {
                        contactHandler.UpdateCustomerInfo(postImageEntity);
                    }

                    if (preImageFirstName != postImageFirstName || preImageLastName != postImageLastName || preImageMobile != postImageMobile || preImageBirthdate != postImageBirthdate)
                    {
                        contactHandler.CheckForExistingRecords(postImageEntity);
                    }

                    if (preImageTaxId != postImageTaxId)
                    {
                        contactHandler.PopulateTaxRate(postImageEntity);
                    }

                    if (preImageThemeId != postImageThemeId)
                    {
                        contactHandler.ChangeThemeUrl(postImageEntity);
                    }

                    if (preImageMobile != postImageMobile || preImageEmail != postImageEmail || preImageRelation != postImageRelation)
                    {
                        if (postImageEntity.Contains("gsc_recordtype") && postImageEntity.GetAttributeValue <OptionSetValue>("gsc_recordtype").Value == 100000003)
                        {
                            contactHandler.UpdatePrimaryContactDetails(postImageEntity);
                        }
                    }

                    if (postImageCityName != postImageCityIdName && postImageCityName != String.Empty && preImageCityIdName == postImageCityIdName)
                    {
                        contactHandler.SetCity(postImageEntity);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("This record has been identified as a fraud account. Please ask the customer to provide further information."))
                    {
                        throw new InvalidPluginExecutionException("This record has been identified as a fraud account. Please ask the customer to provide further information.");
                    }
                    else if (ex.Message.Contains("This record already exists."))
                    {
                        throw new InvalidPluginExecutionException("This record already exists.");
                    }
                    else
                    {
                        throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace));
                    }
                }
            }
        }
 private void EditWindow_Closed(object sender, EventArgs e) => ContactListBox.ItemsSource = ContactHandler.LoadContacts();
Exemplo n.º 25
0
        // Licenses-Animal-Dog-License, Licenses-Animal-Dog-Application
        // DUB13-00000-00006, DUB13-00000-00005
        // Active-LIC_PET, Issued-LIC_PET

        static void Main(string[] args)
        {
            PaginationInfo p           = null;
            string         filter      = "module=Licenses";
            string         redirectUrl = "http://*****:*****@accela.com" });

            //// Agency
            Agency ag = a.GetAgency(token, "SOLNDEV-ENG");
            Stream sr = a.GetAgencyLogo(token, "SOLNDEV-ENG");

            using (FileStream fs = new FileStream(@"C:\Swapnali\TestPurposes\logo.png", FileMode.Create))
            {
                sr.CopyTo(fs);
            }

            // Record Contact
            //ResultDataPaged<Contact> contacts = rec.GetRecordContacts(recordId, token);
            //List<Contact> cs = new List<Contact> {
            //    new Contact { isPrimary = "N", businessName = "test",
            //        firstName = "Swapnali", lastName = "Dembla", email = "*****@*****.**",
            //        address = new ContactAddress { addressLine1 = "500 San Blvd", city = "San Ramon", state = new State { value = "CA" },
            //        postalCode = "94566" },
            //        type = new ContactType { value = "Pet Owner" } }};

            //rec.CreateRecordContact(cs, recordId, token);
            //contacts = rec.GetRecordContacts(recordId, token);
            //Contact c = ((List<Contact>)contacts.Data)[0];
            //c.type.text = null;
            //c.middleName = "test for Oscar";
            //c = rec.UpdateRecordContact(c, recordId, token);
            //contacts = rec.GetRecordContacts(recordId, token);
            ////rec.DeleteRecordContact(c.id, rId, token);
            //contacts = rec.GetRecordContacts(recordId, token);

            // Address
            //List<Country> cn = ad.GetCountries(token);
            //List<State> s = ad.GetStates(token);

            // Records
            //Record record = rec.GetRecord(recordId, token);
            //record.name = "Test Again & Again";

            //List<Dictionary<string, string>> cf = rec.GetRecordCustomFields(record.id, token);


            //record.description = "Test Again & Again";
            //record = rec.UpdateRecordDetail(record, token);
            //record = rec.GetRecord(recordId, token);
            //records = rec.SearchRecords(token, new RecordFilter { type = new RecordType { category = "Application" }, contact = new Contact { firstName = "Sam" } }, null);
            //records = rec.GetRecords(token, null);
            //Record record = new Record { type = new RecordType { id = "Licenses-Animal-Dog-Application" } };
            //List<Contact> contactList = new List<Contact> { new Contact { type = new ContactType { value = "Pet Owner" }, firstName = "Swapnali", lastName = "Dembla", email = "*****@*****.**" } };
            //Record r1 = rec.CreateRecordInitialize(new Record { type = new RecordType { id = "Licenses-Animal-Dog-Application" } }, token);
            ////Record r1 = record;
            //r1.name = "Test Renewal";
            //r1.description = "Test Renewal";
            //r1 = rec.UpdateRecordDetail(r1, token);
            //record = rec.GetRecord(r1.id, token);
            //rec.CreateRecordContact(contactList, r1.id, token);
            //ResultDataPaged<Contact> cons = rec.GetRecordContacts(r1.id, token);
            //Contact cn = ((Contact)cons.Data.First());
            //cn.lastName = "Dembla";
            //cn = rec.UpdateRecordContact(cn, r1.id, token);
            //List<Dictionary<string, string>> cf = rec.GetRecordCustomFields(r1.id, token);
            //Dictionary<string, string> temp = cf[1];
            //temp["Pet Name"] = "Goof";
            ////rec.UpdateRecordCustomFields(r1.id, cf, token);
            //cf = rec.GetRecordCustomFields(r1.id, token);
            //cons = rec.GetRecordContacts(r1.id, token);

            //FileInfo file = new FileInfo(@"C:\Swapnali\TestPurposes\Ducky.jpeg");
            //if (file != null)
            //{
            //    AttachmentInfo at = new AttachmentInfo { FileType = "image/jpeg", FileName = "Ducky.jpeg", ServiceProviderCode = "BPTMSTR", Description = "Test" };
            //    at.FileContent = new StreamContent(file.OpenRead());
            //    rec.CreateRecordDocument(at, r1.id, token, "ooo");
            //}
            //List<Document> docs = rec.GetRecordDocuments(r1.id, token);
            //record.contacts = new List<Contact> { new Contact { id = "1234", firstName = "Swapnali", lastName = "Dembla", email = "*****@*****.**", type = new ContactType { value = "Pet Owner" } } };
            //record = rec.CreateRecordFinalize(new Record { id = "BPTMSTR-14EST-00000-00257", type = new RecordType { id = "Licenses-Animal-Dog-Application" } }, token);
            //record = rec.CreateRecordFinalize(r1, token);
            //record = rec.GetRecord(record.id, token);
            //cons = rec.GetRecordContacts(record.id, token);
            //cf = rec.GetRecordCustomFields(record.id, token);
            ////docs = rec.GetRecordDocuments(record.id, token);

            // Documents
            //List<DocumentType> d = rec.GetRecordDocumentTypes(recordId, token);
            //List<Document> docs = rec.GetRecordDocuments(recordId, token);
            //Stream sr = doc.DownloadDocument("1132", token);
            //using (FileStream fs = new FileStream(@"C:\Swapnali\TestPurposes\photo.jpeg", FileMode.Create))
            //{
            //    sr.CopyTo(fs);
            //}

            //FileInfo file = new FileInfo(@"C:\Swapnali\TestPurposes\Ducky.jpeg");
            //if (file != null)
            //{
            //    AttachmentInfo at = new AttachmentInfo { FileType = "image/jpeg", FileName = "Ducky.jpeg", ServiceProviderCode = "BPTMSTR", Description = "Test" };
            //    at.FileContent = new StreamContent(file.OpenRead());
            //    rec.CreateRecordDocument(at, recordId, token, "ooo");
            //}
            //rec.DeleteRecordDocument("1012", recordId, token);
            //docs = rec.GetRecordDocuments(recordId, token);

            // Status
            //List<Status> s = rec.GetRecordStatuses("Licenses-Animal-Pig-Application", token);

            //// Workflow
            //List<WorkflowTask> w2 = rec.GetWorkflowTasks(record.id, token);
            //WorkflowTask w = rec.GetWorkflowTask(record.id, taskId, token);
            //UpdateWorkflowTaskRequest uw = new UpdateWorkflowTaskRequest { comment = "testing", status = new Status { value = "In Review" } };
            //w = rec.UpdateWorkflowTask("BPTMSTR-DUB14-00000-00059", taskId, uw, token);

            // Fees
            //List<RecordFees> fs = rec.GetRecordFees(recordId, token);

            // Custom Fields
            //cf = rec.GetRecordCustomFields(recordId, token);
            //temp = cf[0];
            //temp["Pet Name"] = "Toffy";
            ////List<Dictionary<string, string>> cfs = new List<Dictionary<string, string>>();
            ////Dictionary<string, string> val = new Dictionary<string,string>();
            ////val.Add("id", "LIC_DOG_LIC-GENERAL.cINFORMATION");
            ////val.Add("Name", "Woofy");
            ////cfs.Add(val);
            //rec.UpdateRecordCustomFields(recordId, cf, token);
            //cf = rec.GetRecordCustomFields(recordId, token);
        }
Exemplo n.º 26
0
 public void Stop()
 {
     contactHandler.Frame -= contactHandler_Frame;
     contactHandler.Dispose();
     contactHandler = null;
 }
Exemplo n.º 27
0
        // Creates a new client user
        public ActionResult CreateClient()
        {
            // Ensures logged in
            if (Session["loggedInState"] == null)
            {
                return(Redirect("/403.html"));
            }

            // Checks if logged in
            bool state = (bool)Session["loggedInState"];

            if (state == true)
            {
                // Establishes models
                ClientUserModel cModel = new ClientUserModel();

                // Establishes handlers
                AccountHandler  accHand = new AccountHandler();
                AddressHandler  addHand = new AddressHandler();
                BankHandler     banHand = new BankHandler();
                ContactHandler  conHand = new ContactHandler();
                CustomerHandler cusHand = new CustomerHandler();

                // Extract for account details
                int accountType = int.Parse(Request.Form["accountTypes"]);

                // Extract for bank details
                String sortCode      = Request.Form["sortCode"];
                int    accountNumber = int.Parse(Request.Form["accountNumber"]);

                // Extract for client details
                String username = Request.Form["username"];
                String password = Request.Form["password1"];
                String name     = Request.Form["clientName"];

                // Extract contact details
                String forename    = Request.Form["contactForename"];
                String surname     = Request.Form["contactSurname"];
                String position    = Request.Form["contactPosition"];
                String phoneNumber = Request.Form["contactPhone"];

                // Extract bank address details
                //String blineOne = Request.Form["bankL1"];
                //String blineTwo = Request.Form["bankL2"]; ;
                //String blineThree = Request.Form["bankL3"];
                //String blineFour = Request.Form["bankL4"];
                //String blineFive = Request.Form["bankL5"];
                //String bcState = Request.Form["bankState"];
                //String bcounty = Request.Form["bankCounty"];
                //String bcountry = Request.Form["bankCountry"];
                //String bpostalCode = Request.Form["bankPostalCode"];

                // Extract for customer details
                String compName = Request.Form["clientName"];

                // Extract customer address details
                String clineOne    = Request.Form["address1"];
                String clineTwo    = Request.Form["address2"];;
                String clineThree  = Request.Form["address3"];
                String clineFour   = Request.Form["address4"];
                String clineFive   = Request.Form["address5"];
                String ccState     = Request.Form["state"];
                String ccounty     = Request.Form["county"];
                String ccountry    = Request.Form["country"];
                String cpostalCode = Request.Form["postcode"];

                // Creates objects for user
                //int bankAddressID = addHand.create(blineOne, blineTwo, blineThree, blineFour, blineFive, bcState,
                //                                   bcounty, bcountry, bpostalCode);
                int custAddressID = addHand.create(clineOne, clineTwo, clineThree, clineFour, clineFive, ccState,
                                                   ccounty, ccountry, cpostalCode);
                int bankID     = banHand.create(sortCode, accountNumber);
                int contactID  = conHand.create(forename, surname, position, phoneNumber);
                int customerID = cusHand.create(compName, custAddressID);
                int accountID  = accHand.create(accountType, bankID, customerID, contactID);

                // Holds new objects
                ClientUser newClient = new ClientUser();

                // Acquires needed Account ID
                newClient.Username = username;


                // Stored details for the customer
                newClient.Name      = name;
                newClient.Username  = username;
                newClient.Password  = password;
                newClient.AccountID = accountID;

                // Creates the customer
                int clientID = cModel.CreateClientUser(newClient);

                // Return created department to view
                return(Redirect("/Index/adminIndex"));
            }
            else
            {
                // If not logged in
                return(Redirect("/login.html"));
            }
        }
Exemplo n.º 28
0
 public void Setup()
 {
     _contactRepositoryMock = new Mock <IContactRepository>();
     _contactHandler        = new ContactHandler(_contactRepositoryMock.Object);
 }
Exemplo n.º 29
0
 public ContactController()
 {
     IoC.AddModule <WebAppExampleDataDependencyModule>();
     _contactLoader  = IoC.Get <ContactLoader>();
     _contactHandler = IoC.Get <ContactHandler>();
 }
Exemplo n.º 30
0
    private void OnCollisionEnter(Collision collision)
    {
        //Debug.LogFormat("this: {0} -- Other: {1}", this.gameObject.name, collision.gameObject.name);
        ContactPoint contact = collision.contacts[0];

        if (contact.otherCollider.gameObject.CompareTag("BumperBear"))
        {
            ContactHandler handler           = collision.gameObject.GetComponent <ContactHandler>();
            float          otherPrevVelocity = handler.GetPreviousVelocity();


            if (bearsHitBy.Contains(contact.otherCollider.gameObject.name))
            {
                return;
            }

            if (contactedThisFrame)
            {
                print("I'm handling this ~~ " + gameObject.name);

                Vector3 forceDir = -contact.normal;
                Vector3 force    = forceDir * ((AddedForceMultiplier * 10) * Mathf.Abs(PreviousVelocity / 30.0f));
                Vector3 forcePos = -contact.point;

                //print("add force to " + handler.name);
                handler.GetComponent <Rigidbody>().AddForceAtPosition(force, forcePos);
                print(handler.GetComponent <Rigidbody>().velocity);
                handler.gameObject.GetComponent <Animator>().Play("Impact");
                handler.gameObject.GetComponentInChildren <SkinnedMeshRenderer>().sharedMaterial.DOComplete();
                handler.gameObject.GetComponentInChildren <SkinnedMeshRenderer>().sharedMaterial.DOColor(HitColor, TweenLength).From().SetEase(ColorEase);

                GetComponent <Rigidbody>().angularVelocity *= 0.1f;
                GetComponent <Rigidbody>().velocity        *= 0.1f;

                StartCoroutine(PreventHitBy(collision.gameObject.name, 1.0f));
                handler.StartCoroutine(handler.PreventHitBy(gameObject.name, 1.0f));


                return;
            }



            //print(gameObject.name);


            Quaternion rot = new Quaternion(0, 0, 0, 0);
            Vector3    pos = contact.point;
            GameObject obj = Instantiate(HitEffect, pos, rot, transform);

            AudioSource.pitch = Random.Range(startPitch - 0.5f, startPitch + 0.5f);
            AudioSource.PlayOneShot(HitSound);

            Vector3 v1 = collision.gameObject.GetComponent <Rigidbody>().velocity;
            Vector3 v2 = GetComponent <Rigidbody>().velocity;

            //print("v1 velocity = " + v1);
            //print("v2 velocity = " + v2);

            float side = otherPrevVelocity - PreviousVelocity;

            if (side < 0.0f)
            {
                print("I'm handling this ~~ " + gameObject.name);

                Vector3 forceDir = -contact.normal;
                Vector3 force    = forceDir * ((AddedForceMultiplier * 10) * Mathf.Abs(PreviousVelocity / 30.0f));
                Vector3 forcePos = -contact.point;

                //print("add force to " + handler.name);
                handler.GetComponent <Rigidbody>().AddForceAtPosition(force, forcePos);
                print(handler.GetComponent <Rigidbody>().velocity);
                handler.gameObject.GetComponent <Animator>().Play("Impact");
                handler.gameObject.GetComponentInChildren <SkinnedMeshRenderer>().sharedMaterial.DOComplete();
                handler.gameObject.GetComponentInChildren <SkinnedMeshRenderer>().sharedMaterial.DOColor(HitColor, TweenLength).From().SetEase(ColorEase);

                GetComponent <Rigidbody>().angularVelocity *= 0.1f;
                GetComponent <Rigidbody>().velocity        *= 0.1f;

                StartCoroutine(PreventHitBy(collision.gameObject.name, 1.0f));
                handler.StartCoroutine(handler.PreventHitBy(gameObject.name, 1.0f));
            }

            else
            {
                if (handler != null)
                {
                    handler.contactedThisFrame = true;
                }
                // Do nothing, let them handle it
            }
            ////~~~~A check incase this script is run before the other Contact Handler~~~
            ////Check if the one that got hit harder is the "Other bear"
            ////(We already ignore bears added to our contact list for this frame / delay.

            //if (side < 0.0f)
            //{
            //    Vector3 forceDir = -contact.normal;
            //    Vector3 force = forceDir * ((AddedForceMultiplier * 10) * Mathf.Abs(PreviousVelocity / 30.0f));
            //    Vector3 forcePos = -contact.point;

            //    //print("add force to " + handler.name);
            //    handler.GetComponent<Rigidbody>().AddForceAtPosition(force, forcePos);
            //    print(handler.GetComponent<Rigidbody>().velocity);
            //    handler.gameObject.GetComponent<Animator>().Play("Impact");
            //    handler.gameObject.GetComponentInChildren<SkinnedMeshRenderer>().sharedMaterial.DOComplete();
            //    handler.gameObject.GetComponentInChildren<SkinnedMeshRenderer>().sharedMaterial.DOColor(HitColor, TweenLength).From().SetEase(ColorEase);

            //    GetComponent<Rigidbody>().angularVelocity *= 0.1f;
            //    GetComponent<Rigidbody>().velocity *= 0.1f;

            //    if (handler != null)
            //    {
            //        handler.contactedThisFrame = true;
            //    }

            //    StartCoroutine(PreventHitBy(collision.gameObject.name, 1.0f));
            //    handler.StartCoroutine(handler.PreventHitBy(gameObject.name, 1.0f));
            //}

            ////// The bear this script is attached to is the one being "Hit".
            //else if (side > 0.0f)
            //{
            //    Vector3 forceDir = -contact.normal;
            //    Vector3 force = forceDir * ((AddedForceMultiplier * 10) * Mathf.Abs(PreviousVelocity / 30.0f));
            //    Vector3 forcePos = -contact.point;

            //    //print("add force to " + gameObject.name);
            //    m_rigidBody.AddForceAtPosition(force, forcePos);
            //    print(m_rigidBody.velocity);

            //    GetComponent<Animator>().Play("Impact");
            //    GetComponentInChildren<SkinnedMeshRenderer>().sharedMaterial.DOComplete();
            //    GetComponentInChildren<SkinnedMeshRenderer>().sharedMaterial.DOColor(HitColor, TweenLength).From().SetEase(ColorEase);


            //    //print("Side > 0 : Velocity nulled for " + collision.gameObject.name);
            //    handler.GetComponent<Rigidbody>().angularVelocity *= 0.1f;
            //    handler.gameObject.GetComponent<Rigidbody>().velocity *= 0.1f;

            //    contactedThisFrame = true;
            //}
        }

        else if (collision.gameObject.CompareTag("Traps"))
        {
            Quaternion rot = new Quaternion(0, 0, 0, 0);
            Vector3    pos = contact.point;
            GameObject obj = Instantiate(HitEffect, pos, rot, transform);

            AudioSource.pitch = Random.Range(startPitch - 0.5f, startPitch + 0.5f);
            AudioSource.PlayOneShot(HitSound);

            Vector3 forceDir = collision.transform.forward + (transform.up * 0.1f);
            Vector3 force    = forceDir * ((AddedForceMultiplier * 10));
            Vector3 forcePos = contact.point;


            foreach (Orb orb in collision.gameObject.GetComponentsInChildren <Orb>())
            {
                orb.Drop();
            }

            GetComponent <Rigidbody>().AddForceAtPosition(force, forcePos);
            GetComponent <Animator>().Play("Impact");
            GetComponentInChildren <SkinnedMeshRenderer>().sharedMaterial.DOComplete();
            GetComponentInChildren <SkinnedMeshRenderer>().sharedMaterial.DOColor(HitColor, TweenLength).From().SetEase(ColorEase);

            GetComponent <Rigidbody>().angularVelocity *= 0.1f;
            GetComponent <Rigidbody>().velocity        *= 0.1f;
        }
    }