Пример #1
0
        public static GatewayType Save(GatewayType gatewayType)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString, "dbo.ctx_SAVE_GATEWAY_TYPE");
            int result;

            //cmd.AddInputOutputParam("", DbType.Guid, gatewayType.ID);


            cmd.AddInputOutputParam("pGatewayTypeID", DbType.Guid, gatewayType.ID);
            cmd.AddInputOutputParam("pName", DbType.String, gatewayType.Name);
            cmd.AddInputOutputParam("pLiveUrl", DbType.String, gatewayType.LiveURL);
            cmd.AddInputOutputParam("pTestUrl", DbType.String, gatewayType.TestURL);
            cmd.AddInputOutputParam("pTestLoginId", DbType.String, gatewayType.TestLoginID);
            cmd.AddInputOutputParam("pTestTransactionKey", DbType.String, gatewayType.TestTransactionKey);
            cmd.AddOutputParam("oCreationDate", DbType.DateTime);
            cmd.AddOutputParam("oLastEditDate", DbType.DateTime);

            result = int.Parse(SqlHelpers.ExecuteNonQuery(cmd).ToString());
            if (result > 0)
            {
                gatewayType.ID = cmd.ExtractGuid("pGatewayTypeID");
                gatewayType.Name = cmd.ExtractString("pName");
                gatewayType.LiveURL = cmd.ExtractString("pLiveUrl");
                gatewayType.TestURL = cmd.ExtractString("pTestUrl");
                gatewayType.TestLoginID = cmd.ExtractString("pTestLoginId");
                gatewayType.TestTransactionKey = cmd.ExtractString("pTestTransactionKey");
                gatewayType.CreationDate = cmd.ExtractDateTime("oCreationDate");
                gatewayType.LastEditDate = cmd.ExtractDateTime("oLastEditDate");
            }

            return gatewayType;
        }
Пример #2
0
        public static GatewayType GetByID(Guid id)
        {
            DbCommand cmd = SqlHelpers.CreateCommand
                (DataHelpers.ConnectionString, "dbo.ctx_GET_GATEWAY_TYPE");

            cmd.AddInputParam("pGatewayTypeID", DbType.Guid, id);
            DataTable dt = cmd.ExecuteSelectTable();
            GatewayType gt = new GatewayType();
            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    gt = dt.Rows[0].ToGatewayType();
                }
            }
            return gt;
        }