/// <summary> /// To Update Village /// </summary> /// <param name="objVillageBO"></param> /// <returns></returns> public string UpdateVillage(VillageBO objVillageBO) { string result = ""; using (cnn = new OracleConnection(connStr)) { using (cmd = new OracleCommand("USP_MST_UPD_VILLAGE", cnn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); cmd.Parameters.Add("VILLAGEID_", objVillageBO.VillageID); cmd.Parameters.Add("SUBCOUNTYID_", objVillageBO.SubCountyID); cmd.Parameters.Add("VILLAGENAME_", objVillageBO.VillageName); cmd.Parameters.Add("UPDATEDBY_", objVillageBO.CreatedBy); cmd.Parameters.Add("ERRORMESSAGE_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); if (cmd.Parameters["ERRORMESSAGE_"].Value != null) { result = cmd.Parameters["ERRORMESSAGE_"].Value.ToString(); } cmd.Connection.Close(); } } return(result); }
public VillageList LoadVillageData(string pSubcountyId) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GET_VILLAGE"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@SubcountyIDIN", pSubcountyId); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); VillageBO obMaster = null; VillageList Master = new VillageList(); while (dr.Read()) { obMaster = new VillageBO(); obMaster.VillageID = dr.GetInt32(dr.GetOrdinal("VILLAGEID")); obMaster.VillageName = dr.GetString(dr.GetOrdinal("VILLAGENAME")); Master.Add(obMaster); } dr.Close(); return(Master); }
/// <summary> /// To Get Village /// </summary> /// <param name="subcountyID"></param> /// <returns></returns> public VillageList GetVillage(string subcountyID) { OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GET_VILLAGE"; cmd = new OracleCommand(proc, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@SubcountyIDIN", subcountyID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); VillageBO objvBO = null; VillageList objvlist = new VillageList(); while (dr.Read()) { objvBO = new VillageBO(); objvBO.VillageID = (Convert.ToInt32(dr.GetValue(dr.GetOrdinal("VILLAGEID")))); objvBO.VillageName = dr.GetValue(dr.GetOrdinal("VILLAGENAME")).ToString(); objvlist.Add(objvBO); } dr.Close(); return(objvlist); }
/// <summary> /// To Get All Village /// </summary> /// <param name="SUBCOUNTYID"></param> /// <returns></returns> public VillageList GetAllVillage(int SUBCOUNTYID) { VillageList objVillageList = null; using (cnn = new OracleConnection(connStr)) { using (cmd = new OracleCommand("USP_MST_GET_VILLAGE_ALL", cnn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("SubcountyIDIN", SUBCOUNTYID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); VillageBO objVillageBO = null; objVillageList = new VillageList(); while (dr.Read()) { objVillageBO = new VillageBO(); if (!dr.IsDBNull(dr.GetOrdinal("VILLAGEID"))) { objVillageBO.VillageID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("VILLAGEID"))); } if (!dr.IsDBNull(dr.GetOrdinal("VILLAGENAME"))) { objVillageBO.VillageName = dr.GetValue(dr.GetOrdinal("VILLAGENAME")).ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED"))) { objVillageBO.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED")); } if (!dr.IsDBNull(dr.GetOrdinal("SUBCOUNTYNAME"))) { objVillageBO.SubCountyName = dr.GetValue(dr.GetOrdinal("SUBCOUNTYNAME")).ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("COUNTYNAME"))) { objVillageBO.CountyName = dr.GetValue(dr.GetOrdinal("COUNTYNAME")).ToString(); } if (!dr.IsDBNull(dr.GetOrdinal("DISTRICTNAME"))) { objVillageBO.DistrictName = dr.GetValue(dr.GetOrdinal("DISTRICTNAME")).ToString(); } objVillageList.Add(objVillageBO); } dr.Close(); } } return(objVillageList); }
/// <summary> /// To Get Village By Id /// </summary> /// <param name="VILLAGEID"></param> /// <returns></returns> public VillageBO GetVillageById(int VILLAGEID) { proc = "USP_MST_GET_VILLAGEBYID"; cnn = new OracleConnection(connStr); VillageBO VillageBOobj = null; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("VILLAGEID_", VILLAGEID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; try { cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { VillageBOobj = new VillageBO(); if (!dr.IsDBNull(dr.GetOrdinal("VILLAGEID"))) { VillageBOobj.VillageID = dr.GetInt32(dr.GetOrdinal("VILLAGEID")); } if (!dr.IsDBNull(dr.GetOrdinal("VILLAGENAME"))) { VillageBOobj.VillageName = dr.GetString(dr.GetOrdinal("VILLAGENAME")); } if (!dr.IsDBNull(dr.GetOrdinal("COUNTYNAME"))) { VillageBOobj.CountyName = dr.GetString(dr.GetOrdinal("COUNTYNAME")); } if (!dr.IsDBNull(dr.GetOrdinal("DISTRICTNAME"))) { VillageBOobj.DistrictName = dr.GetString(dr.GetOrdinal("DISTRICTNAME")); } // if (!dr.IsDBNull(dr.GetOrdinal("SUBCOUNTYID"))) VillageBOobj.SubCountyID = dr.GetInt32(dr.GetOrdinal("SUBCOUNTYID")); if (!dr.IsDBNull(dr.GetOrdinal("SUBCOUNTYNAME"))) { VillageBOobj.SubCountyName = dr.GetString(dr.GetOrdinal("SUBCOUNTYNAME")); } //if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED"))) VillageBOobj.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED")); // if (!dr.IsDBNull(dr.GetOrdinal("districtname"))) VillageBOobj.DistrictName = dr.GetString(dr.GetOrdinal("districtname")); } dr.Close(); } catch (Exception ex) { throw ex; } return(VillageBOobj); }
/// <summary> /// To update details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UpdateBudgetItem() { VillageBLL VillageBLLobj = new VillageBLL(); VillageBO objVillageBO = new VillageBO(); string message = ""; string uID = string.Empty; uID = Session["USER_ID"].ToString(); objVillageBO.VillageID = Convert.ToInt32(ViewState["VILLAGEID"].ToString()); objVillageBO.DistrictID = Convert.ToInt32(ddlDistrict.SelectedItem.Value); objVillageBO.CountyID = Convert.ToInt32(ddlCounty.SelectedItem.Value); objVillageBO.SubCountyID = Convert.ToInt32(ddlSubcounty.SelectedItem.Value); objVillageBO.VillageName = txtVillage.Text.Trim(); objVillageBO.CreatedBy = Convert.ToInt32(uID); try { message = VillageBLLobj.UpdateVillage(objVillageBO); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } ClearData(); SetUpdateMode(false); BindGrid(); if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } finally { VillageBLLobj = null; } }
/// <summary> ///To fetch village details based on ID and assign to textbox /// </summary> private void GetVillageById() { VillageBLL VillageBLLobj = new VillageBLL(); VillageBO objVillageBO = VillageBLLobj.GetVillageById(Convert.ToInt32(ViewState["VILLAGEID"])); if (objVillageBO != null) { txtVillage.Text = objVillageBO.VillageName; } ddlDistrict.ClearSelection(); ddlCounty.ClearSelection(); if (ddlDistrict.Items.FindByText(objVillageBO.DistrictName.ToString()) != null) { ddlDistrict.Items.FindByText(objVillageBO.DistrictName.ToString()).Selected = true; } BindCounties(ddlDistrict.SelectedItem.Value); if (ddlCounty.Items.FindByText(objVillageBO.CountyName.ToString()) != null) { ddlCounty.Items.FindByText(objVillageBO.CountyName.ToString()).Selected = true; } //string countyID = objVillageBO.CountyID.ToString(); BindSubCounties(ddlCounty.SelectedItem.Value); if (ddlSubcounty.Items.FindByText(objVillageBO.SubCountyName.ToString()) != null) { ddlSubcounty.Items.FindByText(objVillageBO.SubCountyName.ToString()).Selected = true; } objVillageBO = null; VillageBLLobj = null; }
/// <summary> /// To Update Village /// </summary> /// <param name="objVillageBO"></param> /// <returns></returns> public string UpdateVillage(VillageBO objVillageBO) { return((new VillageDAL()).UpdateVillage(objVillageBO)); }
/// <summary> /// To Add Village /// </summary> /// <param name="objVillageBO"></param> /// <returns></returns> public string AddVillage(VillageBO objVillageBO) { return((new VillageDAL()).AddVillage(objVillageBO)); }