Ejemplo n.º 1
0
        public frmLedgerEdit(int id)
        {
            InitializeComponent();
            City city = new City();

            cmbCity.DataSource    = city.Select().Tables[0];
            cmbCity.DisplayMember = "name";
            cmbCity.ValueMember   = "id";
            //cmbCity.SelectedValue = -1;

            ledger.Id = id;

            if (ledger.SelectById())
            {
                txtName.Text          = ledger.Name;
                txtContact.Text       = ledger.Contact;
                txtEmail.Text         = ledger.Email;
                txtPassword.Text      = ledger.Password;
                cmbGender.Text        = ledger.Gender;
                txtAddress.Text       = ledger.Address;
                cmbCity.SelectedValue = ledger.CityId;
                //dtpDateOfBirth = ledger.DateOfBirth;
                cmbType.Text  = ledger.Type;
                pbImage.Image = FileImage.ImageFromByte(ledger.Image);
            }
        }
        public frmProductImageEdit(int id)
        {
            InitializeComponent();
            Product product = new Product();

            cmbProduct.DataSource    = product.Select().Tables[0];
            cmbProduct.DisplayMember = "name";
            cmbProduct.ValueMember   = "id";
            //cmbProduct.SelectedValue = -1;

            productImage.Id = id;

            if (productImage.SelectById())
            {
                txtTitle.Text            = productImage.Title;
                pbImage.Image            = FileImage.ImageFromByte(productImage.Image);
                cmbProduct.SelectedValue = productImage.ProductId;
            }
            else
            {
                MessageBox.Show(productImage.Error);
            }
        }