public static void OnBeforeInsertStep(ITicketProduct ticketproduct, ISession session)
        {
            // TODO: Complete business rule implementation

            /*if(ticketproduct.Quantity <= 0)
             * {
             *       throw new ApplicationException("Enter Quantity of selected product...");
             * }
             *
             *
             *
             *
             * Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>();
             * System.Data.OleDb.OleDbConnection conObj1 = new System.Data.OleDb.OleDbConnection(service.GetConnectionString());
             * conObj1.Open();
             * string query1 = "Select MAX(isnull(CP.QUANTITY,0)) - SUM(isnull(TP.Quantity,0)) Qty From TICKETPRODUCT TP "+
             *                              "LEFT JOIN CONTRACTPRODUCTITEM CP ON TP.ContractProductItemID = CP.ContractProductItemID " +
             *                              "where TP.ContractProductItemID	= '"+ ticketproduct.ContractProductItemID + "' group by TP.PRODUCTID";
             *
             * System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand(query1, conObj1);
             * System.Data.OleDb.OleDbDataReader dr;
             *
             * dr = cmd.ExecuteReader();
             * if (dr.HasRows == true)
             * {
             *      if(Convert.ToInt32(dr.row[0][0]) < 0)
             *      {
             *   throw new ApplicationException("Quantity is exeeded the limit with " + Convert.ToInt32(dr.row[0][0]));
             *      }
             * }*/
        }
        public static void OnBeforeInsertStep( ITicketProduct ticketproduct,  ISession session)
        {
            // TODO: Complete business rule implementation
            /*if(ticketproduct.Quantity <= 0)
            {
                 throw new ApplicationException("Enter Quantity of selected product...");
            }

            Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>();
            System.Data.OleDb.OleDbConnection conObj1 = new System.Data.OleDb.OleDbConnection(service.GetConnectionString());
            conObj1.Open();
            string query1 = "Select MAX(isnull(CP.QUANTITY,0)) - SUM(isnull(TP.Quantity,0)) Qty From TICKETPRODUCT TP "+
                            "LEFT JOIN CONTRACTPRODUCTITEM CP ON TP.ContractProductItemID = CP.ContractProductItemID " +
                            "where TP.ContractProductItemID	= '"+ ticketproduct.ContractProductItemID + "' group by TP.PRODUCTID";

            System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand(query1, conObj1);
            System.Data.OleDb.OleDbDataReader dr;

            dr = cmd.ExecuteReader();
            if (dr.HasRows == true)
            {
                if(Convert.ToInt32(dr.row[0][0]) < 0)
                {
                 throw new ApplicationException("Quantity is exeeded the limit with " + Convert.ToInt32(dr.row[0][0]));
                }
            }*/
        }