コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IList<ClientTable> _cliebt_data;
            IList<CityTable> _city_data;
            IList<CountryTable> _country_data;

            using (Clcontext context = new Clcontext())
            {
                var _query = from client in context.ClientTables select client;
                _cliebt_data = _query.ToList();

                var _queryCity = from city in context.CityTables select city;
                _city_data = _queryCity.ToList();

                var _quertCountry = from country in context.CountryTables select country;
                _country_data = _quertCountry.ToList();
            }

            _client_repeater.DataSource = _cliebt_data;
            _city_repeater.DataSource = _city_data;
            _country_repeater.DataSource = _country_data;

            _client_repeater.DataBind();
            _city_repeater.DataBind();
            _country_repeater.DataBind();
        }
コード例 #2
0
        protected void deleteClientButton_Click(object sender, EventArgs e)
        {
            using (Clcontext conetxt = new Clcontext())
            {
                ClientTable client = conetxt.ClientTables.Find(Int32.Parse(TextBox1.Text));
                if(client != null)
                {
                    conetxt.ClientTables.Remove(client);
                    conetxt.SaveChanges();
                }

            }
        }
コード例 #3
0
        protected void searchpageButton_Click(object sender, EventArgs e)
        {
            if(TextBox1.Text == null || TextBox1.Text.Equals(""))
            {
                return;
            }

            using (Clcontext context = new Clcontext())
            {
                Engine.SearchEngine search = new Engine.SearchEngine(context);
                Clients = search.ClientWithName(TextBox1.Text).ToList();
            }

            _client_repeater.DataSource = Clients;
            _client_repeater.DataBind();
        }
コード例 #4
0
        protected void addButton_Click(object sender, EventArgs e)
        {
            if(IsNotEmpty())
            {
                using (Clcontext context = new Clcontext())
                {
                    ClientTable client = new ClientTable();
                    client.FORENAME = _Forename_Textbox.Text;
                    client.SURNAME = _Surname_textbox.Text;
                    client.AGE = Int32.Parse(_age_textbox.Text);
                    client.ADDRESS = _address_textbox.Text;
                    client.CITY_ID = Int32.Parse(_cityid_textbox.Text);

                    context.ClientTables.Add(client);
                    context.SaveChanges();
                }
            }
        }