public providerList GetProviderList() { provider objProvider = null; providerList objProviderList = null; myDataSet = ExecuteDataSet("SELECT * FROM tbl_Providers", null, CommandType.Text); if (myDataSet.Tables.Count > 0 && myDataSet.Tables[0].Rows.Count > 0) { objProviderList = new providerList(); foreach (DataRow myDataRow in myDataSet.Tables[0].Rows) { objProvider = new provider( Int32.Parse(myDataRow["Provider_ID"].ToString()) , myDataRow["Provider_Name"].ToString() , Int16.Parse(myDataRow["Provider_Order"].ToString()) , (Status)int.Parse(myDataRow["Provider_Status"].ToString())); objProviderList.Add(objProvider); } } return objProviderList; }
public Boolean SaveProvider(out String Message, providerList providerlist, provider objProvider) { Message = String.Empty; //Check if duplicate records exists in the category list if (providerlist.Select(element => element.providerName = objProvider.providerName).Count() > 1) { Message = CustomMessages.DUPLICATE("Provider", "Name"); return false; } else { par = new Object[,] { { "@ID", objProvider.providerId } , { "@Name", objProvider.providerName } , { "@Order", objProvider.providerOrder } , { "@Status", objProvider.providerStatus } , { "@CreatedBy", HttpContext.Current.Session["UserID"] } , { "@ModifiedBy", HttpContext.Current.Session["UserID"] } , { "@TxnType", (objProvider.providerId>0 ? TransactionType.UPDATE: TransactionType.INSERT) } }; return Save(par, SP_Insert_Update_Delete, out Message); } }