/// <summary> /// To update clans details to database /// </summary> /// <param name="ClansBOObj"></param> /// <returns></returns> public int EDITClans(ClansBO ClansBOObj) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); cnn.Open(); OracleCommand dcmd = new OracleCommand("USP_MST_EDITCLANS", cnn); dcmd.CommandType = CommandType.StoredProcedure; int count = Convert.ToInt32(dcmd.CommandType); try { dcmd.Parameters.Add("ClansID", ClansBOObj.CLANID); dcmd.Parameters.Add("ClName", ClansBOObj.CLANNAME); dcmd.Parameters.Add("UpBy", ClansBOObj.UpdatedBy); return(dcmd.ExecuteNonQuery()); } catch { throw; } finally { dcmd.Dispose(); cnn.Close(); cnn.Dispose(); } }
/// <summary> /// To Insert Into Clans Master details /// </summary> /// <param name="ClansBOObj"></param> /// <returns></returns> public int InsertIntoClansMaster(ClansBO ClansBOObj) { OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString); con.Open(); OracleCommand cmd = new OracleCommand("USP_MST_INSERTINTOCLANSMASTER", con); cmd.CommandType = CommandType.StoredProcedure; int count = Convert.ToInt32(cmd.CommandType); try { cmd.Parameters.Add("TRbID", ClansBOObj.TRIBEID); cmd.Parameters.Add("ClansName", ClansBOObj.CLANNAME); cmd.Parameters.Add("CretBy", ClansBOObj.CreatedBy); return(cmd.ExecuteNonQuery()); } catch (Exception ex) { throw ex; } finally { cmd.Dispose(); con.Close(); con.Dispose(); } }
/// <summary> /// To Get Clans By Id from database /// </summary> /// <param name="ClansID"></param> /// <returns></returns> public ClansBO GetClansById(int ClansID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GetClansByID"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("ClansID", ClansID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ClansBO ClansBOObj = null; ClansList ClansListObj = new ClansList(); ClansBOObj = new ClansBO(); while (dr.Read()) { if (ColumnExists(dr, "CLANNAME") && !dr.IsDBNull(dr.GetOrdinal("CLANNAME"))) { ClansBOObj.CLANNAME = Convert.ToString(dr.GetValue(dr.GetOrdinal("CLANNAME"))); } } dr.Close(); return(ClansBOObj); }
/// <summary> /// Used to update details to the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditClansDetails() { ClansBLL ClansBLLObj = new ClansBLL(); string message = ""; try { ClansBO ClansBOObj = new ClansBO(); if (ViewState["CLANID"] != null) { ClansBOObj.CLANID = Convert.ToInt32(ViewState["CLANID"].ToString()); } string uID = string.Empty; uID = Session["USER_ID"].ToString(); ClansBOObj.CLANNAME = txtClans.Text.ToString().Trim(); int TrbID = 0; TrbID = Convert.ToInt32(Request.QueryString["TribeID"]); ClansBOObj.TRIBEID = TrbID; ClansBOObj.UpdatedBy = Convert.ToInt32(uID); int count = ClansBLLObj.EDITClans(ClansBOObj); txtClans.Text = string.Empty; SetUpdateMode(false); if (count == -1) { message = "Data updated successfully"; BindGrid(); } else { message = "Unable to update data"; } } catch (Exception ex) { throw ex; } finally { ClansBLLObj = null; } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } }
/// <summary> /// used to fetch details /// </summary> /// <param name="addRow"></param> /// <param name="deleteRow"></param> private void GetClansDetails() { ClansBLL ClansBLLObj = new ClansBLL(); int ClanID = 0; if (ViewState["CLANID"] != null) { ClanID = Convert.ToInt32(ViewState["CLANID"]); } ClansBO ClansBOObj = new ClansBO(); ClansBOObj = ClansBLLObj.GetClansById(ClanID); txtClans.Text = ClansBOObj.CLANNAME; }
/// <summary> /// Used to save details to the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveClansDetails() { ClansBOObj = new ClansBO(); string message = ""; int count = 0; string Clans = string.Empty; string uID = string.Empty; uID = Session["USER_ID"].ToString(); ClansBLLObj = new ClansBLL(); try { ClansBOObj.CLANNAME = txtClans.Text.ToString().Trim(); ClansBOObj.TRIBEID = Convert.ToInt32(ViewState["TRIBE_ID"]); ClansBOObj.CreatedBy = Convert.ToInt32(uID); count = ClansBLLObj.InsertIntoClansMaster(ClansBOObj); txtClans.Text = string.Empty; if (count == -1) { message = "Data saved successfully"; BindGrid(); } else { message = "Unable to save data"; } } catch (Exception ee) { throw ee; } finally { ClansBLLObj = null; } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } }
/// <summary> /// To update clans details to database /// </summary> /// <param name="ClansBOObj"></param> /// <returns></returns> public int EDITClans(ClansBO ClansBOObj) { ClansDAL ClansDALObj = new ClansDAL(); try { return(ClansDALObj.EDITClans(ClansBOObj)); } catch { throw; } finally { ClansDALObj = null; } }
/// <summary> /// To Insert Into Clans Master details /// </summary> /// <param name="ClansBOObj"></param> /// <returns></returns> public int InsertIntoClansMaster(ClansBO ClansBOObj) { ClansDAL ClansDALObj = new ClansDAL(); try { return(ClansDALObj.InsertIntoClansMaster(ClansBOObj)); } catch (Exception ex) { throw ex; } finally { ClansDALObj = null; } }
/// <summary> /// To Fetch ALL Clans List from database /// </summary> /// <param name="tribeID"></param> /// <returns></returns> public ClansList FetchALLClansList(int tribeID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GETALLCLANSDETAILS"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("TRIBEID_", tribeID); cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); ClansBO ClansBOObj = null; ClansList ClansListObj = new ClansList(); try { while (dr.Read()) { ClansBOObj = new ClansBO(); ClansBOObj.CLANID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CLANID"))); ClansBOObj.TRIBEID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("TRIBEID"))); ClansBOObj.CLANNAME = dr.GetString(dr.GetOrdinal("CLANNAME")); ClansBOObj.IsDeleted = dr.GetString(dr.GetOrdinal("IsDeleted")); ClansListObj.Add(ClansBOObj); } dr.Close(); } catch (Exception ex) { throw ex; } return(ClansListObj); }