public static List <LTOCVEntryPerCA> GetLTOCVEntryPerCA(int cvID) { var dbUtil = new DatabaseManager(); var caEntry = new List <LTOCVEntryPerCA>(); using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB"))) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "spGetLTOCVEntryPerCA"; cmd.Parameters.AddWithValue("@cvID", cvID); cmd.CommandTimeout = 180; using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var ca = new LTOCVEntryPerCA { COACode = ReferenceEquals(reader["COACode"], DBNull.Value) ? string.Empty : Convert.ToString(reader["COACode"]), COAName = ReferenceEquals(reader["COAName"], DBNull.Value) ? string.Empty : Convert.ToString(reader["COAName"]), Subsidiary = ReferenceEquals(reader["Subsidiary"], DBNull.Value) ? string.Empty : Convert.ToString(reader["Subsidiary"]), Supplementary = ReferenceEquals(reader["Supplementary"], DBNull.Value) ? string.Empty : Convert.ToString(reader["Supplementary"]), IndividualSubsidiary = ReferenceEquals(reader["IndividualSubsidiary"], DBNull.Value) ? string.Empty : Convert.ToString(reader["IndividualSubsidiary"]), Debit = ReferenceEquals(reader["Debit"], DBNull.Value) ? 0 : Convert.ToDecimal(reader["Debit"]), Credit = ReferenceEquals(reader["Credit"], DBNull.Value) ? 0 : Convert.ToDecimal(reader["Credit"]), intIDAccTranDetail = ReferenceEquals(reader["intIDAccTranDetail"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDAccTranDetail"]), intIDMasCOA = int.Parse(reader["intIDMasCOA"].ToString()), intIDMasCOASub = int.Parse(reader["intIDMasCOASub"].ToString()), indIDMasCOASupp = int.Parse(reader["indIDMasCOASupp"].ToString()) }; caEntry.Add(ca); } } } } return(caEntry); }
public static List <LTOCVEntryPerCA> GetLTOSkygoJVEntryDetail(int intIDAccTran, string strCompany) { var dbUtil = new DatabaseManager(); var mst = new List <LTOCVEntryPerCA>(); using (SqlConnection conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB"))) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "spLTORep_GetSkygoJVEntryDetail"; cmd.CommandTimeout = 180; cmd.Parameters.AddWithValue("@intIDAccTran", intIDAccTran); cmd.Parameters.AddWithValue("@strCompany", strCompany); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var ca = new LTOCVEntryPerCA { COAName = reader["COAName"].ToString(), Subsidiary = reader["Subsidiary"].ToString(), Supplementary = reader["Supplementary"].ToString(), IndividualSubsidiary = reader["IndividualSubsidiary"].ToString(), IndividualSupplementary = reader["IndividualSupplementary"].ToString(), Debit = decimal.Parse(reader["Debit"].ToString()), Credit = decimal.Parse(reader["Credit"].ToString()), intIDAccTranDetail = int.Parse(reader["intIDAccTranDetail"].ToString()) }; mst.Add(ca); } } } } return(mst); }