void contact_PropertyChanged(object sender, Xrm.ComponentModel.PropertyChangedEventArgs e)
        {
            Contact update = (Contact)sender;

            //Utility.AlertDialog(String.Format("Actualizar nombre {0}, apellido {1},limite de credito is {2}{3}{4}", update.firstname, update.LastName, update.CreditLimit,update.ContactId,update.LogicalName), delegate() { });

            if (String.IsNullOrEmpty(update.LastName))
            {
                ErrorMessage.SetValue(string.Format("{0} {1}", ResourceStrings.LastName, ResourceStrings.RequiredMessage));
            }
            else
            {
                OrganizationServiceProxy.BeginUpdate(update, delegate(object state)
                {
                    try
                    {
                        OrganizationServiceProxy.Update(update);
                        ErrorMessage.SetValue(null);
                    }
                    catch (Exception ex)
                    {
                        ErrorMessage.SetValue(ex.Message);
                    }
                    finally
                    {
                    }
                });
            }
        }
Example #2
0
 void QuoteProduct_PropertyChanged(object sender, Xrm.ComponentModel.PropertyChangedEventArgs e)
 {
     if (Quantity != null && PricePerUnit != null)
     {
         this.ExtendedAmount = new Money(Quantity.Value * PricePerUnit.Value);
     }
     this.IsProductOverridden = !String.IsNullOrEmpty(ProductDescription);
 }
Example #3
0
        private void connection_PropertyChanged(object sender, Xrm.ComponentModel.PropertyChangedEventArgs e)
        {
            Connection connectionToUpdate = new Connection();
            Connection updated            = (Connection)sender;

            connectionToUpdate.ConnectionID = new Guid(updated.Id);
            bool updateRequired = false;

            switch (e.PropertyName)
            {
            case "record2roleid":
                // Check if the record1id is loaded - if not load it now so we can work out the opposite role
                if (updated.Record1Id == null)
                {
                    Connection connection = (Connection)OrganizationServiceProxy.Retrieve(Connection.LogicalName, updated.ConnectionID.Value, new string[] { "record1id" });
                    updated.Record1Id = connection.Record1Id;
                }
                connectionToUpdate.Record2RoleId = updated.Record2RoleId;
                connectionToUpdate.Record1RoleId = ObservableConnection.GetOppositeRole(updated.Record2RoleId, updated.Record1Id);

                updateRequired = true;
                break;

            case "description":
                connectionToUpdate.Description = updated.Description;
                updateRequired = true;
                break;

            case "effectivestart":
                connectionToUpdate.EffectiveStart = updated.EffectiveStart;
                updateRequired = true;
                break;

            case "effectiveend":
                connectionToUpdate.EffectiveEnd = updated.EffectiveEnd;
                updateRequired = true;
                break;
            }


            // Auto save
            if (updateRequired)
            {
                OrganizationServiceProxy.BeginUpdate(connectionToUpdate, delegate(object state)
                {
                    try
                    {
                        OrganizationServiceProxy.EndUpdate(state);
                        ErrorMessage.SetValue(null);
                    }
                    catch (Exception ex)
                    {
                        ErrorMessage.SetValue(ex.Message);
                    }
                });
            }
        }
Example #4
0
 private void OnSessionPropertyChanged(object sender, Xrm.ComponentModel.PropertyChangedEventArgs e)
 {
     if ((e.PropertyName == "dev1_starttime") || (e.PropertyName == "dev1_endtime"))
     {
         OnStartEndDateChanged(sender);
     }
     else if (e.PropertyName == "dev1_duration")
     {
         OnDurationChanged(sender);
     }
     // TODO: This should really provide the row that is changing
     Refresh();
 }
Example #5
0
        private void connection_PropertyChanged(object sender, Xrm.ComponentModel.PropertyChangedEventArgs e)
        {
            Connection connectionToUpdate = new Connection();
            Connection updated            = (Connection)sender;

            connectionToUpdate.ConnectionID = new Guid(updated.Id);
            bool updateRequired = false;

            switch (e.PropertyName)
            {
            case "record2roleid":
                connectionToUpdate.Record2RoleId = updated.Record2RoleId;
                updateRequired = true;
                break;

            case "description":
                connectionToUpdate.Description = updated.Description;
                updateRequired = true;
                break;

            case "effectivestart":
                connectionToUpdate.EffectiveStart = updated.EffectiveStart;
                updateRequired = true;
                break;

            case "effectiveend":
                connectionToUpdate.EffectiveEnd = updated.EffectiveEnd;
                updateRequired = true;
                break;
            }


            // Auto save
            if (updateRequired)
            {
                OrganizationServiceProxy.BeginUpdate(connectionToUpdate, delegate(object state)
                {
                    try
                    {
                        OrganizationServiceProxy.EndUpdate(state);
                        ErrorMessage.SetValue(null);
                    }
                    catch (Exception ex)
                    {
                        ErrorMessage.SetValue(ex.Message);
                    }
                });
            }
        }
Example #6
0
        private void Contact_PropertyChanged(object sender, Xrm.ComponentModel.PropertyChangedEventArgs e)
        {
            Contact updated         = (Contact)sender;
            Contact contactToUpdate = new Contact();

            contactToUpdate.ContactId = new Guid(updated.Id);
            bool updateRequired = false;

            switch (e.PropertyName)
            {
            case "firstname":
                contactToUpdate.FirstName = updated.FirstName;
                updateRequired            = true;
                break;

            case "lastname":
                contactToUpdate.LastName = updated.LastName;
                updateRequired           = true;
                break;

            case "preferredcontactmethodcode":
                contactToUpdate.PreferredContactMethodCode = updated.PreferredContactMethodCode;
                updateRequired = true;
                break;

            case "creditlimit":
                contactToUpdate.CreditLimit = updated.CreditLimit;
                updateRequired = true;
                break;
            }
            if (updateRequired)
            {
                OrganizationServiceProxy.BeginUpdate(contactToUpdate, delegate(object state)
                {
                    try
                    {
                        OrganizationServiceProxy.EndUpdate(state);
                        ErrorMessage.SetValue(null);
                    }
                    catch (Exception ex)
                    {
                        ErrorMessage.SetValue(ex.Message);
                    }
                });
            }
        }
 private void connection_PropertyChanged(object sender, Xrm.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "record2roleid")
     {
         // Auto Save
         Connection updated            = (Connection)sender;
         Connection connectionToUpdate = new Connection();
         connectionToUpdate.ConnectionID  = new Guid(updated.Id);
         connectionToUpdate.Record2RoleId = updated.Record2RoleId;
         OrganizationServiceProxy.BeginUpdate(connectionToUpdate, delegate(object state)
         {
             try
             {
                 OrganizationServiceProxy.EndUpdate(state);
             }
             catch (Exception ex)
             {
                 ErrorMessage.SetValue(ex.Message);
             }
         });
     }
 }
Example #8
0
 void quote_PropertyChanged(object sender, Xrm.ComponentModel.PropertyChangedEventArgs e)
 {
     Window.SetTimeout(delegate() { Lines.Refresh(); }, 0);
 }