Example #1
0
 private void setParameter(iSqlParameter[] parms, MeCreditcardInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = CFunctions.SetDBString(info.Firstname);
         parms[++i].Value = CFunctions.SetDBString(info.Lastname);
         parms[++i].Value = CFunctions.SetDBString(info.Cardnumber);
         parms[++i].Value = CFunctions.SetDBString(info.Cardtype);
         parms[++i].Value = info.Expirationmonth;
         parms[++i].Value = info.Expirationyear;
         parms[++i].Value = CFunctions.SetDBString(info.Address);
         parms[++i].Value = CFunctions.SetDBString(info.City);
         parms[++i].Value = CFunctions.SetDBString(info.State);
         parms[++i].Value = CFunctions.SetDBString(info.Zipcode);
         parms[++i].Value = info.Memberid;
         parms[++i].Value = info.Balance;
         parms[++i].Value = info.Status;
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
        private MeCreditcardInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                MeCreditcardInfo info = new MeCreditcardInfo();
                info.Firstname = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Lastname = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Cardnumber = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Cardtype = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Expirationmonth = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Expirationyear = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Address = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.City = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.State = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Zipcode = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Memberid = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Balance = dar.IsDBNull(++i) ? 0 : dar.GetFloat(i);
                info.Status = dar.IsDBNull(++i) ? (int)CConstants.State.Status.Waitactive : dar.GetInt32(i);
                info.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Rownumber = dar.IsDBNull(++i) ? 0 : dar.GetInt64(i);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
 private bool Saveitem(iSqlTransaction trans, MeCreditcardInfo info)
 {
     try
     {
         if (trans == null || info == null) return false;
         string SQL = string.Empty;
         if (info.Id == 0)
         {
             SQL = SQL_INSERT;
             info.Id = (int)HELPER.getNewID(trans, TABLENAME);
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         else if (HELPER.isExist(trans, TABLENAME, info.Id))
         {
             SQL = SQL_UPDATE;
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         else
         {
             SQL = SQL_INSERT;
             info.Id = (int)HELPER.getNewID(trans, TABLENAME);
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         return true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
        public bool Save(MeCreditcardInfo info)
        {
            try
            {
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    using (iSqlTransaction trans = iConn.BeginTransaction())
                    {
                        try
                        {
                            this.Saveitem(trans, info);

                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            throw ex;
                        }
                    }
                    iConn.Close();
                }
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }