/// <summary> /// To get All Category details from database /// </summary> /// <returns></returns> public BudgetEstimationList getAllCategory() { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_SELECTALLCATEGORY"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); BudgetEstimationBO objBudgetEstimation = null; BudgetEstimationList BudgetEstimationList = new BudgetEstimationList(); while (dr.Read()) { objBudgetEstimation = new BudgetEstimationBO(); objBudgetEstimation.CategoryID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("BGT_CATEGORYID"))); objBudgetEstimation.CategoryName = dr.GetString(dr.GetOrdinal("BGT_CATEGORYNAME")); BudgetEstimationList.Add(objBudgetEstimation); } dr.Close(); return(BudgetEstimationList); }
/// <summary> /// To Get Budget Estimation details by ID /// </summary> /// <param name="pID"></param> /// <param name="categoryID"></param> /// <returns></returns> public BudgetEstimationBO GetBudgetEstimationByID(int BudgetEstimationID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GET_BGT_EST_BYID"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("BudgetEstimationID_", BudgetEstimationID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); BudgetEstimationBO BudgetEstimationBOObj = null; BudgetEstimationList BudgetEstimationList = new BudgetEstimationList(); BudgetEstimationBOObj = new BudgetEstimationBO(); while (dr.Read()) { if (ColumnExists(dr, "BGT_ESTIMATIONID") && !dr.IsDBNull(dr.GetOrdinal("BGT_ESTIMATIONID"))) { BudgetEstimationBOObj.BudgetEstimationID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("BGT_ESTIMATIONID"))); } if (ColumnExists(dr, "BGT_SUBCATEGORYID") && !dr.IsDBNull(dr.GetOrdinal("BGT_SUBCATEGORYID"))) { BudgetEstimationBOObj.SubCategoryID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("BGT_SUBCATEGORYID"))); } if (ColumnExists(dr, "BGT_CATEGORYID") && !dr.IsDBNull(dr.GetOrdinal("BGT_CATEGORYID"))) { BudgetEstimationBOObj.CategoryID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("BGT_CATEGORYID"))); } if (ColumnExists(dr, "EST_VALUE") && !dr.IsDBNull(dr.GetOrdinal("EST_VALUE"))) { BudgetEstimationBOObj.ValueAmount = Convert.ToString(dr.GetValue(dr.GetOrdinal("EST_VALUE"))); } if (ColumnExists(dr, "EST_PERCENTAGE") && !dr.IsDBNull(dr.GetOrdinal("EST_PERCENTAGE"))) { BudgetEstimationBOObj.ValueAmountper = Convert.ToString(dr.GetValue(dr.GetOrdinal("EST_PERCENTAGE"))); } if (!dr.IsDBNull(dr.GetOrdinal("accountcode"))) { BudgetEstimationBOObj.AccountNo = Convert.ToString(dr.GetValue(dr.GetOrdinal("accountcode"))); } } dr.Close(); return(BudgetEstimationBOObj); }
/// <summary> /// To get SubCategory ByCategoryID /// </summary> /// <param name="CategoryID"></param> /// <returns></returns> public BudgetEstimationList getSubCatByCatID(int CategoryID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GET_SUBCATBYID"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("CategoryID_", CategoryID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); BudgetEstimationBO BudgetEstimationObj = null; BudgetEstimationList BudgetEstimationList = new BudgetEstimationList(); while (dr.Read()) { BudgetEstimationObj = new BudgetEstimationBO(); if (ColumnExists(dr, "BGT_SUBCATEGORYNAME") && !dr.IsDBNull(dr.GetOrdinal("BGT_SUBCATEGORYNAME"))) { BudgetEstimationObj.SubCategoryName = dr.GetString(dr.GetOrdinal("BGT_SUBCATEGORYNAME")); } if (ColumnExists(dr, "BGT_SUBCATEGORYID") && !dr.IsDBNull(dr.GetOrdinal("BGT_SUBCATEGORYID"))) { BudgetEstimationObj.SubCategoryID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("BGT_SUBCATEGORYID"))); } if (ColumnExists(dr, "BGT_CATEGORYID") && !dr.IsDBNull(dr.GetOrdinal("BGT_CATEGORYID"))) { BudgetEstimationObj.CategoryID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("BGT_CATEGORYID"))); } BudgetEstimationList.Add(BudgetEstimationObj); } dr.Close(); return(BudgetEstimationList); }
/// <summary> /// To get Currency From Project details /// </summary> /// <param name="projectID"></param> /// <returns></returns> public BudgetEstimationBO getCurrenceFromProject(string projectID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_SELECTCURRBUDEST"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("projectID_", projectID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); BudgetEstimationBO BudgetEstimationBOObj = null; BudgetEstimationList BudgetEstimationList = new BudgetEstimationList(); BudgetEstimationBOObj = new BudgetEstimationBO(); while (dr.Read()) { if (ColumnExists(dr, "CURRENCYID") && !dr.IsDBNull(dr.GetOrdinal("CURRENCYID"))) { BudgetEstimationBOObj.CurrencyID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CURRENCYID"))); } if (ColumnExists(dr, "CURRENCYCODE") && !dr.IsDBNull(dr.GetOrdinal("CURRENCYCODE"))) { BudgetEstimationBOObj.CurrencyCode = dr.GetString(dr.GetOrdinal(("CURRENCYCODE"))); } if (ColumnExists(dr, "PROJECTID") && !dr.IsDBNull(dr.GetOrdinal("PROJECTID"))) { BudgetEstimationBOObj.ProjectID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("PROJECTID"))); } } dr.Close(); return(BudgetEstimationBOObj); }