Пример #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     Manufacturer manufacturer = new Manufacturer();
     manufacturer.Name = ToSQL.EmptyNull(txtName.Text);
     manufacturer.Phone = ToSQL.EmptyNull(txtPhone.Text);
     manufacturer.Website = ToSQL.EmptyNull(txtWebsite.Text);
     manufacturer.Note = ToSQL.EmptyNull(txtNote.Text);
     manufacturer.IsActive = true;
     manufacturer.Address = new Address()
     {
         Street1 = ToSQL.EmptyNull(txtStreet1.Text),
         Street2 = ToSQL.EmptyNull(txtStreet2.Text),
         City = ToSQL.EmptyNull(txtCity.Text),
         State = ToSQL.EmptyNull(txtState.Text),
         Country = ToSQL.EmptyNull(txtCountry.Text),
         ZipCode = ToSQL.EmptyNull(txtZipCode.Text)
     };
     int i = new ManufacturerRepo().CreateManufacturer(manufacturer);
     Response.Redirect("Management-Manafacturer.aspx");
 }
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lnk = (LinkButton)sender;
                int Id = ToSQL.SQLToInt(lnk.CommandArgument);
                if (Id > 0)
                {
                    int i = new ManufacturerRepo().DeleteManufacturer(Id);
                    BindItemsList();
                }
            }
            catch
            {

            }
        }
Пример #3
0
        private void LoadDropDownList()
        {
            List<ProductType> ProductTypes = new ProductTypeRepo().GetAllProductType();
            ddlProductType.DataSource = ProductTypes;
            ddlProductType.DataBind();
            ddlProductType.Items.Insert(0, new ListItem("(All)", ""));

            List<Manufacturer> Manufacturers = new ManufacturerRepo().GetAllManufacturer();
            ddlManufacturer.DataSource = Manufacturers;
            ddlManufacturer.DataBind();
            ddlManufacturer.Items.Insert(0, new ListItem("(All)", ""));
        }