private void FillStateCode(int CountryCode) { try { tbl_StateMasterProp Objtbl_StateMasterProp = new tbl_StateMasterProp(); Objtbl_StateMasterProp.CountryCode = CountryCode; tbl_StateMasterBAL Objtbl_StateMasterBAL = new tbl_StateMasterBAL(); DataSet dsData = Objtbl_StateMasterBAL.SelectCombo_Data(Objtbl_StateMasterProp); DataRow dr = dsData.Tables[0].NewRow(); dr["StateName"] = "--- Select Any ---"; dr["StateCode"] = 0; dsData.Tables[0].Rows.InsertAt(dr, 0); ddlStateCode.DataSource = dsData.Tables[0]; ddlStateCode.DataTextField = "StateName"; ddlStateCode.DataValueField = "StateCode"; ddlStateCode.DataBind(); } catch (Exception ex) { throw ex; } }
private void DeleteData(int StateCode) { try { tbl_StateMasterProp Objtbl_StateMasterProp = new tbl_StateMasterProp(); Objtbl_StateMasterProp.StateCode = StateCode; tbl_StateMasterBAL Objtbl_StateMasterBAL = new tbl_StateMasterBAL(); Objtbl_StateMasterBAL.Delete_Data(Objtbl_StateMasterProp); FillData(); } catch (Exception ex) { throw ex; } }
private void EditData(int StateCode) { try { tbl_StateMasterProp Objtbl_StateMasterProp = new tbl_StateMasterProp(); Objtbl_StateMasterProp.StateCode = StateCode; int PageCount = 0; tbl_StateMasterBAL Objtbl_StateMasterBAL = new tbl_StateMasterBAL(); DataSet dsData = Objtbl_StateMasterBAL.Select_Data(Objtbl_StateMasterProp, ref PageCount); txtStateName.Text = Convert.ToString(dsData.Tables[0].Rows[0]["StateName"]); ddlCountryCode.SelectedValue = Convert.ToString(dsData.Tables[0].Rows[0]["CountryCode"]); ViewState["EditCode"] = StateCode; } catch (Exception ex) { throw ex; } }
protected void imgbtnSave_Click(object sender, ImageClickEventArgs e) { try { tbl_StateMasterProp Objtbl_StateMasterProp = new tbl_StateMasterProp(); Objtbl_StateMasterProp.StateCode = Convert.ToInt32(ViewState["EditCode"]); Objtbl_StateMasterProp.StateName = txtStateName.Text; Objtbl_StateMasterProp.CountryCode = Convert.ToInt32(ddlCountryCode.SelectedValue); tbl_StateMasterBAL Objtbl_StateMasterBAL = new tbl_StateMasterBAL(); Objtbl_StateMasterBAL.InsertUpdate_Data(Objtbl_StateMasterProp); ShowGuidMessage(1, null); mdlPopupNewEntry.Hide(); FillData(); } catch (Exception ex) { ShowGuidMessage(0, ex); //MessageBox.Show(ex.Message); } }
private void FillData() { try { int PageCount = 0; tbl_StateMasterProp Objtbl_StateMasterProp = new tbl_StateMasterProp(); Objtbl_StateMasterProp.StateCode = 0; Objtbl_StateMasterProp.PageNo = Convert.ToInt32(txtCurPage.Text); Objtbl_StateMasterProp.RecordCount = Convert.ToInt32(20); tbl_StateMasterBAL Objtbl_StateMasterBAL = new tbl_StateMasterBAL(); DataSet dsData = Objtbl_StateMasterBAL.Select_Data(Objtbl_StateMasterProp, ref PageCount); lblTotalPage.Text = Convert.ToString(PageCount); grdData.DataSource = dsData.Tables[0]; grdData.DataBind(); } catch (Exception ex) { throw ex; } }