Exemplo n.º 1
0
        private void LoadManufacturer()
        {
            var m = HccApp.ContactServices.Manufacturers.Find(BvinField.Value);

            if (m != null)
            {
                if (m.Bvin != string.Empty)
                {
                    DisplayNameField.Text = m.DisplayName;
                    EmailField.Text       = m.EmailAddress;
                    AddressEditor1.LoadFromAddress(m.Address);
                    EmailTemplateDropDownList.SelectedValue = m.DropShipEmailTemplateId;
                }
            }
        }
Exemplo n.º 2
0
        private bool Save()
        {
            var result = false;

            var m = HccApp.ContactServices.Manufacturers.Find(BvinField.Value);

            if (m == null)
            {
                m = new VendorManufacturer();
            }

            m.DisplayName             = DisplayNameField.Text.Trim();
            m.EmailAddress            = EmailField.Text.Trim();
            m.Address                 = AddressEditor1.GetAsAddress();
            m.DropShipEmailTemplateId = EmailTemplateDropDownList.SelectedValue;

            if (BvinField.Value == string.Empty)
            {
                result = HccApp.ContactServices.Manufacturers.Create(m);
            }
            else
            {
                result = HccApp.ContactServices.Manufacturers.Update(m);
            }

            if (result == false)
            {
                MessageBox1.ShowError(Localization.GetString("SaveFailure"));
            }
            else
            {
                // Update bvin field so that next save will call updated instead of create
                BvinField.Value = m.Bvin;
            }

            return(result);
        }