public void LoadGrid() { DetailsBizDB insDetails = new DetailsBizDB(connectionString()); //bind data to grid view this.Grid_GetDetails.DataSource = insDetails.Getallobjects(); this.Grid_GetDetails.DataBind(); }
public void DropDownBind_Stat() { DetailsBizDB detailsBizDb = new DetailsBizDB(connectionString()); this.ddlStatus.DataSource = detailsBizDb.GetAllStatusPropsProps(); this.ddlStatus.DataBind(); this.ddlStatus.Items.Insert(0, "Select.."); }
protected void btnSubmit_Click(object sender, EventArgs e) { DetailsBizDB detailsBizDb = new DetailsBizDB(connectionString()); DetailsProp detailsProp = new DetailsProp(); TextBox6.Text = ddlCategory.SelectedItem.Text; try { // propDe.Id = Convert.ToInt32(TextBox9.Text); detailsProp.Name = TextBox2.Text.ToString(); detailsProp.Address = TextBox3.Text.ToString(); detailsProp.Tele = Convert.ToInt32(TextBox4.Text); detailsProp.Description = TextBox5.Text; detailsProp.Category = Convert.ToString(ddlCategory.SelectedItem.Text); detailsProp.Timestamp = TextBox7.Text; detailsProp.Status = Convert.ToString(ddlStatus.SelectedItem.Text); //Console.WriteLine(detailsProp.Status); ddlCategory.Items.Clear(); ddlStatus.Items.Clear(); detailsBizDb.insertDataMeth(detailsProp); } catch (Exception exception) { MessageBox.Show("Enter correct details!"); //Console.WriteLine(exception); //throw; } finally { LoadGrid(); DropDownBind_Cat(); DropDownBind_Stat(); EmptyVals(); } }
public void EditRecord() { DetailsBizDB detailsBizDb = new DetailsBizDB(connectionString()); DetailsProp detailsProp = new DetailsProp(); try { detailsProp.Id = Convert.ToInt32(this.hidId.Value); detailsProp.Name = this.TextBox2.Text.ToString(); detailsProp.Address = this.TextBox3.Text.ToString(); detailsProp.Tele = Convert.ToInt32(TextBox4.Text.ToString()); detailsProp.Description = TextBox5.Text.ToString(); detailsProp.Category = TextBox6.Text.ToString(); detailsProp.Timestamp = TextBox7.Text.ToString(); detailsProp.Status = TextBox8.Text.ToString(); detailsBizDb.EditRecords(detailsProp); } catch (Exception e) { Console.WriteLine(e); throw; } finally { LoadGrid(); btnSubmit.Enabled = true; btnEdit.Enabled = false; this.TextBox2.Text = ""; this.TextBox3.Text = ""; this.TextBox4.Text = ""; this.TextBox5.Text = ""; this.TextBox6.Text = ""; this.TextBox7.Text = ""; this.TextBox8.Text = ""; this.TextBox9.Text = ""; } }
public void DeleteRecord() { DetailsBizDB detailsBizDb = new DetailsBizDB(connectionString()); detailsBizDb.DeleteRecord(Convert.ToInt32(hidId.Value)); }