protected void btnSave_Click(object sender, EventArgs e) { int er = 0; lblEName.Text = ""; lblMessage.Text = ""; if (txtName.Text == "") { er++; lblEName.Text = "Required"; } if (er > 0) { return; } DAL.Country cnt = new DAL.Country(); cnt.Name = txtName.Text; if (cnt.Insert()) { lblMessage.Text = "Country Inserted"; lblMessage.ForeColor = System.Drawing.Color.Green; txtName.Text = ""; txtName.Focus(); } else { lblMessage.Text = cnt.Error; lblMessage.ForeColor = System.Drawing.Color.Red; } }
private void frmCityNew_Load(object sender, EventArgs e) { DAL.Country country = new DAL.Country(); cmbCountry.Source(country.Select()); this.MinimumSize = Size; this.MaximumSize = Size; }
protected void btnSave_Click(object sender, EventArgs e) { int er = 0; if (txtName.Text == "") { er++; lblEMessage.Text = "Required"; } if (er > 0) { return; } DAL.Country country = new DAL.Country(); country.Name = txtName.Text; if (country.Insert()) { btnReset_Click(null, null); lblMessage.Text = "Saved"; lblMessage.ForeColor = System.Drawing.Color.Green; txtName.Focus(); } else { lblMessage.Text = country.Error; lblMessage.ForeColor = System.Drawing.Color.Red; } }
protected void btnSave_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(5000); int er = 0; if (txtName.Text == "") { er++; lblEName.Text = "Required"; } if (er > 0) { return; } DAL.Country c = new DAL.Country(); c.Name = txtName.Text; if (c.Insert()) { btnReset_Click(null, null); lblMessage.Text = "Data Saved"; lblMessage.ForeColor = System.Drawing.Color.Green; } else { lblMessage.Text = c.Error; lblMessage.ForeColor = System.Drawing.Color.Red; } }
private void button1_Click(object sender, EventArgs e) { string s = ""; if (chkWindows.Checked) { s = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", txtServer.Text, "master"); } else { s = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3}", txtServer.Text, "master", txtUserID.Text, txtPassword.Text); } Advising.Properties.Settings.Default.MyCon = s; Advising.Properties.Settings.Default.Save(); DAL.Country c = new DAL.Country(); if (c.Database(txtDatabase.Text)) { if (chkWindows.Checked) { s = string.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", txtServer.Text, txtDatabase.Text); } else { s = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3}", txtServer.Text, txtDatabase.Text, txtUserID.Text, txtPassword.Text); } Advising.Properties.Settings.Default.MyCon = s; Advising.Properties.Settings.Default.Save(); List <DAL.IDatabase> tables = new List <DAL.IDatabase>(); tables.Add(new DAL.Country()); tables.Add(new DAL.City()); tables.Add(new DAL.Department()); tables.Add(new DAL.Program()); tables.Add(new DAL.course()); foreach (DAL.IDatabase table in tables) { if (table.Table()) { listBox1.Items.Add(table.ToString() + " created"); } else { listBox1.Items.Add("Error : " + table.ToString() + " -> " + table.Error); } } } else { MessageBox.Show(c.Error); } }
private void frmStudentNew_Load(object sender, EventArgs e) { DAL.Country country = new DAL.Country(); cmbCountry.DataSource = country.Select("Where id in (Select countryId from city)").Tables[0]; cmbCountry.DisplayMember = "name"; cmbCountry.ValueMember = "Id"; cmbCountry.SelectedValue = -1; DAL.Department department = new DAL.Department(); cmbDepartment.DataSource = department.Select("Where id in (Select departmentId from program)").Tables[0]; cmbDepartment.DisplayMember = "name"; cmbDepartment.ValueMember = "Id"; cmbDepartment.SelectedValue = -1; }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { return; } DAL.Country cnt = new DAL.Country(); DropDownList ddl = (DropDownList)DetailsView1.FindControl("ddlCountry"); ddl.AppendDataBoundItems = true; ddl.Items.Add(new ListItem("Select", "0")); ddl.DataSource = cnt.Select().Tables[0]; ddl.DataTextField = "name"; ddl.DataValueField = "id"; ddl.DataBind(); }
private void frmCityNew_Load(object sender, EventArgs e) { DAL.Country country = new DAL.Country(); cmbCountry.Source(country.Select()); }