private void FillCityCode(int StateCode) { try { tbl_CityMasterProp Objtbl_CityMasterProp = new tbl_CityMasterProp(); Objtbl_CityMasterProp.StateCode = StateCode; tbl_CityMasterBAL Objtbl_CityMasterBAL = new tbl_CityMasterBAL(); DataSet dsData = Objtbl_CityMasterBAL.SelectCombo_Data(Objtbl_CityMasterProp); DataRow dr = dsData.Tables[0].NewRow(); dr["CityName"] = "--- Select Any ---"; dr["CityCode"] = 0; dsData.Tables[0].Rows.InsertAt(dr, 0); ddlCityCode.DataSource = dsData.Tables[0]; ddlCityCode.DataTextField = "CityName"; ddlCityCode.DataValueField = "CityCode"; ddlCityCode.DataBind(); } catch (Exception ex) { throw ex; } }
public int Delete_Data(tbl_CityMasterProp Objtbl_CityMasterProp) { try { tbl_CityMasterDAL Objtbl_CityMasterDAL = new tbl_CityMasterDAL(); return(Objtbl_CityMasterDAL.Delete_Data(Objtbl_CityMasterProp)); } catch (Exception ex) { throw ex; } }
public DataSet SelectCombo_Data(tbl_CityMasterProp Objtbl_CityMasterProp) { try { tbl_CityMasterDAL Objtbl_CityMasterDAL = new tbl_CityMasterDAL(); return(Objtbl_CityMasterDAL.SelectCombo_Data(Objtbl_CityMasterProp)); } catch (Exception ex) { throw ex; } }
public DataSet SelectCombo_Data(tbl_CityMasterProp Objtbl_CityMasterProp) { try { Database DB = DatabaseFactory.CreateDatabase("AppConNagar"); DbCommand DBCmd = DB.GetStoredProcCommand("SelectCombo_tbl_CityMaster"); DB.AddInParameter(DBCmd, "@StateCode", DbType.String, Objtbl_CityMasterProp.StateCode); return(DB.ExecuteDataSet(DBCmd)); } catch (Exception ex) { throw ex; } }
public int Delete_Data(tbl_CityMasterProp Objtbl_CityMasterProp) { try { Database DB = DatabaseFactory.CreateDatabase("AppConNagar"); DbCommand DBCmd = DB.GetStoredProcCommand("Delete_tbl_CityMaster"); DB.AddInParameter(DBCmd, "@CityCode", DbType.Int32, Objtbl_CityMasterProp.CityCode); return(DB.ExecuteNonQuery(DBCmd)); } catch (Exception ex) { throw ex; } }
private void DeleteData(int CityCode) { try { tbl_CityMasterProp Objtbl_CityMasterProp = new tbl_CityMasterProp(); Objtbl_CityMasterProp.CityCode = CityCode; tbl_CityMasterBAL Objtbl_CityMasterBAL = new tbl_CityMasterBAL(); Objtbl_CityMasterBAL.Delete_Data(Objtbl_CityMasterProp); FillData(); } catch (Exception ex) { throw ex; } }
public int InsertUpdate_Data(tbl_CityMasterProp Objtbl_CityMasterProp) { try { Database DB = DatabaseFactory.CreateDatabase("AppConNagar"); DbCommand DBCmd = DB.GetStoredProcCommand("InsertUpdate_tbl_CityMaster"); DB.AddInParameter(DBCmd, "@CityCode", DbType.Int32, Objtbl_CityMasterProp.CityCode); DB.AddInParameter(DBCmd, "@CityName", DbType.String, Objtbl_CityMasterProp.CityName); DB.AddInParameter(DBCmd, "@StateCode", DbType.Int32, Objtbl_CityMasterProp.StateCode); DB.AddOutParameter(DBCmd, "@RetVal", DbType.Int32, 18); DB.ExecuteNonQuery(DBCmd); return(Convert.ToInt32(DBCmd.Parameters["@RetVal"].Value)); } catch (Exception ex) { throw ex; } }
public DataSet Select_Data(tbl_CityMasterProp Objtbl_CityMasterProp, ref int TotalCount) { try { Database DB = DatabaseFactory.CreateDatabase("AppConNagar"); DbCommand DBCmd = DB.GetStoredProcCommand("Select_tbl_CityMaster"); DB.AddInParameter(DBCmd, "@CityCode", DbType.Int32, Objtbl_CityMasterProp.CityCode); DB.AddInParameter(DBCmd, "@PageNo", DbType.Int32, Objtbl_CityMasterProp.PageNo); DB.AddInParameter(DBCmd, "@RecordCount", DbType.Int32, Objtbl_CityMasterProp.RecordCount); DB.AddOutParameter(DBCmd, "@TotalCount", DbType.Int32, 18); DataSet dsData = DB.ExecuteDataSet(DBCmd); TotalCount = Convert.ToInt32(DBCmd.Parameters["@TotalCount"].Value); return(dsData); } catch (Exception ex) { throw ex; } }
private void EditData(int CityCode) { try { tbl_CityMasterProp Objtbl_CityMasterProp = new tbl_CityMasterProp(); Objtbl_CityMasterProp.CityCode = CityCode; int PageCount = 0; tbl_CityMasterBAL Objtbl_CityMasterBAL = new tbl_CityMasterBAL(); DataSet dsData = Objtbl_CityMasterBAL.Select_Data(Objtbl_CityMasterProp, ref PageCount); txtCityName.Text = Convert.ToString(dsData.Tables[0].Rows[0]["CityName"]); ddlStateCode.SelectedValue = Convert.ToString(dsData.Tables[0].Rows[0]["StateCode"]); ViewState["EditCode"] = CityCode; } catch (Exception ex) { throw ex; } }
protected void imgbtnSave_Click(object sender, ImageClickEventArgs e) { try { tbl_CityMasterProp Objtbl_CityMasterProp = new tbl_CityMasterProp(); Objtbl_CityMasterProp.CityCode = Convert.ToInt32(ViewState["EditCode"]); Objtbl_CityMasterProp.CityName = txtCityName.Text; Objtbl_CityMasterProp.StateCode = Convert.ToInt32(ddlStateCode.SelectedValue); tbl_CityMasterBAL Objtbl_CityMasterBAL = new tbl_CityMasterBAL(); Objtbl_CityMasterBAL.InsertUpdate_Data(Objtbl_CityMasterProp); ShowGuidMessage(1, null); mdlPopupNewEntry.Hide(); FillData(); } catch (Exception ex) { ShowGuidMessage(0, ex); //MessageBox.Show(ex.Message); } }
private void FillData() { try { int PageCount = 0; tbl_CityMasterProp Objtbl_CityMasterProp = new tbl_CityMasterProp(); Objtbl_CityMasterProp.CityCode = 0; Objtbl_CityMasterProp.PageNo = Convert.ToInt32(txtCurPage.Text); Objtbl_CityMasterProp.RecordCount = Convert.ToInt32(20); tbl_CityMasterBAL Objtbl_CityMasterBAL = new tbl_CityMasterBAL(); DataSet dsData = Objtbl_CityMasterBAL.Select_Data(Objtbl_CityMasterProp, ref PageCount); lblTotalPage.Text = Convert.ToString(PageCount); grdData.DataSource = dsData.Tables[0]; grdData.DataBind(); } catch (Exception ex) { throw ex; } }
public DataSet Select_Data(tbl_CityMasterProp Objtbl_CityMasterProp, ref int PageCount) { try { if (Objtbl_CityMasterProp.CityCode != 0) { Objtbl_CityMasterProp.PageNo = 1; Objtbl_CityMasterProp.RecordCount = 1; } int RecordCount = 0; tbl_CityMasterDAL Objtbl_CityMasterDAL = new tbl_CityMasterDAL(); DataSet dsData = Objtbl_CityMasterDAL.Select_Data(Objtbl_CityMasterProp, ref RecordCount); double Page = Convert.ToDouble(RecordCount) / Convert.ToDouble(Objtbl_CityMasterProp.RecordCount); if (dsData.Tables[0].Rows.Count > 0) { string[] PageDecimal = Page.ToString().Split('.'); if (PageDecimal.Length > 1 && Convert.ToInt32(PageDecimal[1]) > 0) { PageCount = Convert.ToInt32(Page.ToString().Split('.')[0]) + 1; } else { PageCount = Convert.ToInt32(Page); } } else { PageCount = 0; } return(dsData); } catch (Exception ex) { throw ex; } }