Exemplo n.º 1
0
 public GiftCardUsageTransaction(int GiftCardUsageID, string GiftCardUsageGUID, int GiftCardID, int UsageTypeID, int UsedByCustomerID, int OrderNumber, decimal Amount, string ExtensionData, DateTime CreatedOn)
 {
     m_Giftcardusageid   = GiftCardUsageID;
     m_Giftcardusageguid = GiftCardUsageGUID;
     m_Giftcardid        = GiftCardID;
     m_UsageType         = (GiftCardUsageReasons)Enum.Parse(typeof(GiftCardUsageReasons), UsageTypeID.ToString());
     m_Usedbycustomerid  = UsedByCustomerID;
     m_Ordernumber       = OrderNumber;
     m_Amount            = Amount;
     m_Extensiondata     = ExtensionData;
     m_Createdon         = CreatedOn;
 }
Exemplo n.º 2
0
        public static GiftCardUsageTransaction CreateTransaction(int GiftCardID, GiftCardUsageReasons UsageReason, int UsedByCustomerID, int OrderNumber, decimal Amount, string ExtensionData)
        {
            var GiftCardUsageID = 0;

            using (var cn = new SqlConnection(DB.GetDBConn()))
            {
                cn.Open();
                using (var cmd = new SqlCommand())
                {
                    cmd.Connection  = cn;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "dbo.aspdnsf_insGiftCardUsage";

                    cmd.Parameters.Add(new SqlParameter("@GiftCardID", SqlDbType.Int, 4));
                    cmd.Parameters.Add(new SqlParameter("@UsageTypeID", SqlDbType.Int, 4));
                    cmd.Parameters.Add(new SqlParameter("@UsedByCustomerID", SqlDbType.Int, 4));
                    cmd.Parameters.Add(new SqlParameter("@OrderNumber", SqlDbType.Int, 4));
                    cmd.Parameters.Add(new SqlParameter("@Amount", SqlDbType.Decimal, 8));
                    cmd.Parameters.Add(new SqlParameter("@ExtensionData", SqlDbType.NText));
                    cmd.Parameters.Add(new SqlParameter("@GiftCardUsageID", SqlDbType.Int, 4)).Direction = ParameterDirection.Output;

                    cmd.Parameters["@GiftCardID"].Value       = GiftCardID;
                    cmd.Parameters["@UsageTypeID"].Value      = (int)UsageReason;
                    cmd.Parameters["@UsedByCustomerID"].Value = UsedByCustomerID;
                    cmd.Parameters["@OrderNumber"].Value      = OrderNumber;
                    cmd.Parameters["@Amount"].Value           = Amount;
                    cmd.Parameters["@ExtensionData"].Value    = ExtensionData;

                    try
                    {
                        cmd.ExecuteNonQuery();
                        GiftCardUsageID = Int32.Parse(cmd.Parameters["@GiftCardUsageID"].Value.ToString());
                    }
                    catch (Exception ex)
                    {
                        SysLog.LogException(ex, MessageTypeEnum.DatabaseException, MessageSeverityEnum.Error);
                    }
                }
            }

            if (GiftCardID > 0)
            {
                return(new GiftCardUsageTransaction(GiftCardUsageID));
            }

            return(null);
        }
Exemplo n.º 3
0
 GiftCardUsageTransaction(int GiftCardTransactionID)
 {
     using (var dbconn = DB.dbConn())
     {
         dbconn.Open();
         using (var dr = DB.GetRS("aspdnsf_getGiftCardUsage " + GiftCardTransactionID.ToString(), dbconn))
         {
             if (dr.Read())
             {
                 m_Giftcardusageid   = DB.RSFieldInt(dr, "GiftCardUsageID");
                 m_Giftcardusageguid = DB.RSFieldGUID(dr, "GiftCardUsageGUID");
                 m_Giftcardid        = DB.RSFieldInt(dr, "GiftCardID");
                 m_UsageType         = (GiftCardUsageReasons)Enum.Parse(typeof(GiftCardUsageReasons), DB.RSFieldInt(dr, "UsageTypeID").ToString());
                 m_Usedbycustomerid  = DB.RSFieldInt(dr, "UsedByCustomerID");
                 m_Ordernumber       = DB.RSFieldInt(dr, "OrderNumber");
                 m_Amount            = DB.RSFieldDecimal(dr, "Amount");
                 m_Extensiondata     = DB.RSField(dr, "ExtensionData");
                 m_Createdon         = DB.RSFieldDateTime(dr, "CreatedOn");
             }
         }
     }
 }