Exemplo n.º 1
0
 private void setParameter(iSqlParameter[] parms, CartitemInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = info.CartID;
         parms[++i].Value = info.ProductID;
         parms[++i].Value = info.Quantity;
         parms[++i].Value = info.Amount;
         parms[++i].Value = info.TemporaryID;
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
        private CartitemInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                CartitemInfo info = new CartitemInfo();
                info.CartID = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.ProductID = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Productname = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Quantity = dar.IsDBNull(++i) ? -1 : dar.GetInt32(i);
                info.Amount = dar.IsDBNull(++i) ? 0 : Math.Round(dar.GetFloat(i));
                info.TemporaryID = dar.IsDBNull(++i) ? 0 : long.Parse(dar.GetValue(i).ToString());
                info.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
 private bool Saveitem(iSqlTransaction trans, CartitemInfo 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;
     }
 }
Exemplo n.º 4
0
        private CartitemInfo AssigntoCartItem(int ProductID)
        {
            ProductInfo info = (new CProduct(LANG)).Getinfo(ProductID);
            CartitemInfo cartitem = new CartitemInfo();
            cartitem.TemporaryID = DateTime.Now.Ticks;
            cartitem.Quantity = 1;
            cartitem.ProductID = ProductID;
            cartitem.Productname = info.Name;
            cartitem.Amount = info.Price;
            cartitem.iProduct = info;

            return cartitem;
        }