Exemple #1
1
        private MeCreditcardHistoryInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                MeCreditcardHistoryInfo info = new MeCreditcardHistoryInfo();
                info.Memberid = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Creditcardid = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Balance = dar.IsDBNull(++i) ? 0 : dar.GetFloat(i);
                info.Amount = dar.IsDBNull(++i) ? 0 : dar.GetFloat(i);
                info.Addorsub = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Note = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Status = dar.IsDBNull(++i) ? (int)CConstants.State.Status.Waitactive : dar.GetInt32(i);
                info.Timeupdate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(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;
            }
        }
Exemple #2
0
 private void setParameter(iSqlParameter[] parms, MeCreditcardHistoryInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = info.Memberid;
         parms[++i].Value = info.Creditcardid;
         parms[++i].Value = info.Balance;
         parms[++i].Value = info.Amount;
         parms[++i].Value = info.Addorsub;
         parms[++i].Value = CFunctions.SetDBString(info.Note);
         parms[++i].Value = info.Status;
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timeupdate);
         parms[++i].Value = CFunctions.install_keyword(info.iMember.Username) + " " + CFunctions.install_keyword(info.iMember.Fullname);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 private bool Saveitem(iSqlTransaction trans, MeCreditcardHistoryInfo 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;
     }
 }
Exemple #4
0
        public bool Save(MeCreditcardHistoryInfo 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;
            }
        }