public static List <MCMICategory> GetMCMICategory() { var dbUtil = new DatabaseManager(); //var customers = new List<Payee>(); var MCMICategories = new List <MCMICategory>(); using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB"))) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "spMasGetCalcMICategory"; cmd.CommandTimeout = 180; cmd.Parameters.Clear(); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var MCMICategory = new MCMICategory { MCMICategoryID = ReferenceEquals(reader["intIDCalcMICategory"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intIDCalcMICategory"]), MCMICategoryName = ReferenceEquals(reader["strMCMICategory"], DBNull.Value) ? String.Empty : Convert.ToString(reader["strMCMICategory"]) }; MCMICategories.Add(MCMICategory); } return(MCMICategories); } } } }
public static string ManageMCMICategory(NameValueCollection querystring) { int integerParse; UserProfile userProfile = WebCommon.GetUserProfile(); var MCMICategory = new MCMICategory { MCMICategoryID = int.TryParse(querystring.Get("MCMICategoryID"), out integerParse) ? integerParse : 0, MCMICategoryName = querystring.Get("MCMICategoryName") // UserID = userProfile.UserId }; string isInsert = querystring.Get("TransType"); string param = WebCommon.ToXML(MCMICategory); return(MCMICategoryDAL.ManageMCMICategory(param, isInsert)); }