public void Save(EmailAlertEntity item) { string threshold; if (item.Threshold == 0) { threshold = null; } else { threshold = item.Threshold.ToString(); } using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[6]; sparams[0] = new SqlParameter("Email", item.Email); sparams[1] = new SqlParameter("CurrencyFrom", item.CurrencyFrom); sparams[2] = new SqlParameter("CurrencyTo", item.CurrencyTo); if (item.TimeToSend.Value.TotalMinutes == 0) { sparams[3] = new SqlParameter("Threshold", threshold); } else { sparams[3] = new SqlParameter("TimetoSend", item.TimeToSend); } sparams[4] = new SqlParameter("SessionID", item.SessionID); sparams[5] = new SqlParameter("AlertID", item.AlertID); context.ExecuteNonResultSproc("usp_SaveEmailAlert", sparams); } }
public void Delete(int id) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[1]; sparams[0] = new SqlParameter("AlertID", id); context.ExecuteNonResultSproc("usp_DeleteEmailAlert", sparams); } }
public void UpdateProfile(UserEntity userPref) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[3]; sparams[0] = new SqlParameter("UserName", userPref.UserName); sparams[1] = new SqlParameter("Email", userPref.Email); sparams[2] = new SqlParameter("DisplayName", userPref.DisplayName); context.ExecuteNonResultSproc("usp_SaveUserProfile", sparams); } }
public void UpdateUserCookie(string username, string cookieID, DateTime dateExpires) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[3]; sparams[0] = new SqlParameter("UserID", username); sparams[1] = new SqlParameter("SessionID", cookieID); sparams[2] = new SqlParameter("DateExpires", (dateExpires.Year == 1) ? DateTime.Now.AddDays(1) : dateExpires); context.ExecuteNonResultSproc("usp_UpdateUserCookie", sparams); } }
public void DeleteAllForUser(string userName) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[1]; sparams[0] = new SqlParameter("UserName", SqlDbType.VarChar); sparams[0].Direction = System.Data.ParameterDirection.Input; sparams[0].Value = userName; context.ExecuteNonResultSproc("usp_DeleteAllAlertsByUser", sparams); } }
public void DeleteAll(string sessionID) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[1]; sparams[0] = new SqlParameter("SessionID", SqlDbType.VarChar); sparams[0].Direction = System.Data.ParameterDirection.Input; sparams[0].Value = sessionID; context.ExecuteNonResultSproc("usp_DeleteAllTrackerEntries", sparams); } }
public void Delete(int id) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[1]; sparams[0] = new SqlParameter("EntryID", SqlDbType.Int); sparams[0].Direction = System.Data.ParameterDirection.Input; sparams[0].Value = id; context.ExecuteNonResultSproc("usp_DeleteTrackerEntry", sparams); } }
public void SaveExisting(int entryID) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[1]; sparams[0] = new SqlParameter("EntryID", SqlDbType.Int); sparams[0].Direction = System.Data.ParameterDirection.Input; sparams[0].Value = entryID; context.ExecuteNonResultSproc("usp_SaveEntryAutoUpdateChange", sparams); } }
public void UpdateDefaults(UserEntity userPref) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[5]; sparams[0] = new SqlParameter("UserName", userPref.UserName); sparams[1] = new SqlParameter("CurrencyFrom", (userPref.DefaultCurrencyFrom) ?? ""); sparams[2] = new SqlParameter("CurrencyTo", (userPref.DefaultCurrencyTo) ?? ""); sparams[3] = new SqlParameter("Country", (userPref.DefaultCountry) ?? ""); sparams[4] = new SqlParameter("AutoUpdateEntries", userPref.AutoUpdateEntries); context.ExecuteNonResultSproc("usp_SaveUserDefaults", sparams); } }
public void CreateAccount(string username, string password, string email, string displayName, string sessionID, DateTime dateExpires) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[6]; sparams[0] = new SqlParameter("UserName", username); sparams[1] = new SqlParameter("Password", password); sparams[2] = new SqlParameter("Email", email); sparams[3] = new SqlParameter("DisplayName", displayName); sparams[4] = new SqlParameter("SessionID", sessionID); sparams[5] = new SqlParameter("DateExpires", dateExpires); context.ExecuteNonResultSproc("usp_SaveNewUser", sparams); } }
public void Save(ConversionTrackerEntity item) { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[10]; sparams[0] = new SqlParameter("EntryName", item.EntryName); sparams[1] = new SqlParameter("CurrencyFrom", item.CurrencyFrom); sparams[2] = new SqlParameter("CurrencyTo", item.CurrencyTo); sparams[3] = new SqlParameter("FromAmount", item.FromAmount); sparams[4] = new SqlParameter("ToAmount", item.ToAmount); sparams[5] = new SqlParameter("RateToUse", item.RateToUse); sparams[6] = new SqlParameter("UpdateRate", item.UpdateRate); sparams[7] = new SqlParameter("LastUpdatedDate", item.LastUpdatedDate.ToUniversalTime()); sparams[8] = new SqlParameter("SessionID", item.SessionID); sparams[9] = new SqlParameter("DateCookieExpires", null); //get this from cookie object using session id when built. For now it'll work context.ExecuteNonResultSproc("usp_SaveNewTrackerEntry", sparams); } }
private static void SaveRates(CurrencyRatesTableTypeCollection ttParam) { try { using (var context = new DataAccessFramework.DBConnection.DBConnectionContext(DatabaseName.CuMaster)) { SqlParameter[] sparams = new SqlParameter[1]; sparams[0] = new SqlParameter("CurrencyRateList", SqlDbType.Structured); sparams[0].Direction = System.Data.ParameterDirection.Input; sparams[0].Value = ttParam; //Debug.WriteLine("About to save rates"); context.Database.CommandTimeout = 900000000; context.ExecuteNonResultSproc("usp_SaveCurrencyRates", sparams); } } catch (Exception ex) { string errorLogPath = @"C:\UpdateRateBatch\ErrorLog.txt"; File.AppendAllText(errorLogPath, Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace); } }