Exemple #1
0
        public CustomertypesViewModel()
        {
            CustomertypeModel ct = new CustomertypeModel();
            DataTable         CustomerTypesTable = ct.All();

            this.FillAllCustomerTypes(CustomerTypesTable);
        }
        public EditCustomerViewModel(CustomerModel cm)
        {
            Customer = cm;
            CustomertypeModel ctm = new CustomertypeModel();
            DataTable         cts = ctm.All();

            CustomerTypes = ctm.GetCollection(cts);
            Name          = cm.Name;
            Phone         = cm.Phone;
            Email         = cm.Email;
            CustomerType  = ctm.Get(cm.Type);
            for (int i = 0; i < cts.Rows.Count; i++)
            {
                string RowID      = cts.Rows[i][0].ToString();
                string CustomerId = CustomerType.Id.ToString();
                if (RowID == CustomerId)
                {
                    SelectedIndex = i;
                    break;
                }
            }
        }
        public CreateCustomerViewModel()
        {
            CustomertypeModel ctm = new CustomertypeModel();

            CustomerTypes = ctm.GetCollection(ctm.All());
        }