Exemplo n.º 1
0
        public void SaveNewEntry(ConversionTrackerViewModel tvm)
        {
            ConversionTrackerEntity cte = new ConversionTrackerEntity
            {
                EntryName       = tvm.EntryName,
                FromAmount      = tvm.AmountFrom,
                ToAmount        = tvm.AmountTo,
                SessionID       = this.SessionID,
                UpdateRate      = this.DefaultAutoUpdate,
                CurrencyFrom    = tvm.CurrencyFrom,
                CurrencyTo      = tvm.CurrencyTo,
                RateToUse       = tvm.RateUsed,
                LastUpdatedDate = tvm.LastUpdated
            };
            var ctRes = DIResolver.Data.NinjectConfig.GetKernal().Get <CuMaster.Data.RepositoryInterfaces.IConversionTrackerRepository>();

            ctRes.Save(cte);
        }
        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);
            }
        }
 public void Delete(ConversionTrackerEntity item)
 {
     this.Delete(item.EntryID);
 }