Example #1
0
        private void LoadManufacturer()
        {
            int Id = ToSQL.SQLToInt(Request.QueryString["Id"]);

            if (Id > 0)
            {
                Manufacturer manufacturer = manufacturerRepo.GetById(Id);
                if (manufacturer != null)
                {
                    txtName.Text      = ToSQL.EmptyNull(manufacturer.Name);
                    txtPhone.Text     = ToSQL.EmptyNull(manufacturer.Phone);
                    txtWebsite.Text   = ToSQL.EmptyNull(manufacturer.Website);
                    txtNote.Text      = ToSQL.EmptyNull(manufacturer.Note);
                    chkActive.Checked = ToSQL.SQLToBool(manufacturer.IsActive);
                    if (manufacturer.Address != null)
                    {
                        txtStreet1.Text = ToSQL.EmptyNull(manufacturer.Address.Street1);
                        txtStreet2.Text = ToSQL.EmptyNull(manufacturer.Address.Street2);
                        txtCity.Text    = ToSQL.EmptyNull(manufacturer.Address.City);
                        txtState.Text   = ToSQL.EmptyNull(manufacturer.Address.State);
                        txtCountry.Text = ToSQL.EmptyNull(manufacturer.Address.Country);
                        txtZipCode.Text = ToSQL.EmptyNull(manufacturer.Address.ZipCode);
                    }
                }
                else
                {
                    Response.Redirect("Management-Manafacturer.aspx");
                }
            }
            else
            {
                Response.Redirect("Management-Manafacturer.aspx");
            }
        }