Пример #1
0
        /// <summary>
        /// Update the price of a pack
        /// </summary>
        /// <param name="session_item">session item to set price on</param>
        /// <param name="exception_set_name">name of price exception set to update the price of (Default is default prices)</param>
        /// <param name="prize_level">set the price of a specific prize level (value added prize like validation)</param>
        /// <param name="price">the price to set.</param>
        public void WritePrice(DataRow session_item, String exception_set_name, DataRow prize_level, object price)
        {
            DataTable price_excepts = DataSet.Tables[PriceExceptionSet.TableName];

            DataRow[] exception_set = price_excepts.Select(PriceExceptionSet.NameColumn
                                                           + "='"
                                                           + DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable, DsnConnection.ConnectionFlavor.Unknown, exception_set_name)
                                                           + "'");
            if (exception_set.Length > 0)
            {
                DataTable session_price_excepts   = DataSet.Tables[SessionPriceExceptionSet.TableName];
                DataRow[] __session_exception_set = session_price_excepts.Select(SessionTable.PrimaryKey + "='" + session_item[SessionTable.PrimaryKey] + "' and " + PriceExceptionSet.PrimaryKey + "='" + exception_set[0][PriceExceptionSet.PrimaryKey] + "'");
                if (__session_exception_set.Length > 0)
                {
                    WritePrice(session_item, __session_exception_set[0], prize_level, price);
                }
                else
                {
                    int a = 3;
                }
            }
            else
            {
                int a = 3;
            }
        }
Пример #2
0
        public DataRow NewPriceException(String name)
        {
            String name_column = XDataTable.Name(this);

            if (name_column != null)
            {
                String safe_name = DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable, DsnConnection.ConnectionFlavor.Unknown, name);
                if (Columns[name_column].Unique)
                {
                    DataRow[] rows = Select(name_column + "='" + safe_name + "'");
                    if (rows.Length > 1)
                    {
                        throw new ConstraintException("unique name column has already been violated, while attempting to add [" + name + "]");
                    }
                    if (rows.Length == 1)
                    {
                        return(rows[0]);
                    }
                }
                DataRow newnamerow = NewRow();
                newnamerow[name_column] = safe_name;
                //newnamerow[SessionTable.PrimaryKey] = session[SessionTable.PrimaryKey];
                Rows.Add(newnamerow);
                return(newnamerow);
            }
            return(null);
        }
Пример #3
0
 public DataRow NewPack(String name, int rows, int cols)
 {
     {
         DataRow   new_row  = NewRow();
         DataRow[] old_rows = Select(NameColumn + "='" + DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable, DsnConnection.ConnectionFlavor.Unknown, name) + "'");
         if (old_rows.Length > 0)
         {
             MessageBox.Show("Pack '" + name + "' already exists.\nPack names are required to be unique.");
             return(null);
         }
         new_row[NameColumn]    = name;
         new_row["width"]       = cols;
         new_row["height"]      = rows;
         new_row["onsize"]      = cols * rows;
         new_row["face_width"]  = 5;
         new_row["face_height"] = 5;
         new_row["pages"]       = 1;
         try
         {
             Rows.Add(new_row);
             return(new_row);
         }
         catch
         {
             // probably a constraint error -name already exists.
         }
         return(null);
     }
 }
Пример #4
0
            public DataRow CreateLedger(String s)
            {
                s = DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable, DsnConnection.ConnectionFlavor.Unknown, s);
                this.Fill(NameColumn + "='" + s + "'");
                DataRow[] rows = Select(NameColumn + "='" + s + "'");
                if (rows != null && rows.Length > 0)
                {
                    Local.jackpot_transaction_table.Fill(PrimaryKey + "='" + rows[0][PrimaryKey] + "'");
                    return(rows[0]);
                }
                DataRow row = NewRow();

                row[NameColumn]          = s;
                row["last_zero_balance"] = DBNull.Value;
                row["current_balance"]   = 0.00M;
                row["thefed"]            = (Rows.Count == 0)?true:false;
                //row[PrimaryKey] = Guid.NewGuid();
                Rows.Add(row);
                DataRow first_transaction = Local.jackpot_transaction_table.NewRow(
                    (Guid)row[JackpotLedgerTable.PrimaryKey]
                    , (Guid)row[JackpotLedgerTable.PrimaryKey]
                    , null
                    , 0.00M);

                row["last_zero_balance"]
                    = first_transaction[JackpotLedger.JackpotLedgerTable.JackpotLedgerTransactionTable.PrimaryKey];

                return(row);
            }
Пример #5
0
 void ButtonCreateItem_Click(object sender, ReflectorButtonEventArgs e)
 {
     if (ItemManagmentState.current_inventory_type != null)
     {
         String newname = QueryNewName.Show("Enter new " + ItemManagmentState.current_inventory_type["inv_type"] + " item name");
         if (newname != null && newname != "")
         {
             String condition = "inv_type='"
                                + DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable,
                                                       DsnConnection.ConnectionFlavor.Unknown, ItemManagmentState.current_inventory_type["inv_type"].ToString()) + "'"
                                + " and item_name='"
                                + DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable,
                                                       DsnConnection.ConnectionFlavor.Unknown, newname) + "'";
             DataRow[] existing = ItemManagmentState.item_dataset.item_descriptions.Select(condition);
             if (existing.Length < 1)
             {
                 DataRow newrow = ItemManagmentState.item_dataset.item_descriptions.CreateItem(newname);
                 newrow["inv_type"] = ItemManagmentState.current_inventory_type["inv_type"];
                 ItemManagmentState.current_item = newrow;
                 DsnSQLUtil.CommitChanges(ItemManagmentState.item_dataset_dsn, ItemManagmentState.item_dataset);
             }
             else
             {
                 MessageBox.Show("Inventory item of specified type already exists");
             }
         }
     }
     else
     {
         Banner.Show("Must Select Inventory Type");
     }
 }
Пример #6
0
 public DataRow hide_GetGame(String name)
 {
     DataRow[] prior = Select(NameColumn + "='" + DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable, DsnConnection.ConnectionFlavor.Unknown, name) + "'");
     if (prior.Length > 0)
     {
         return(prior[0]);
     }
     return(hide_NewGame(name));
 }
Пример #7
0
 public DataRow GetPattern(String name)
 {
     DataRow[] pattern = Select(NameColumn + "='" + DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable, DsnConnection.ConnectionFlavor.Unknown, name) + "'");
     if (pattern.Length > 0)
     {
         if (pattern.Length > 1)
         {
             throw new Exception("Multiple patterns with same name");
         }
         return(pattern[0]);
     }
     return(null);
 }
Пример #8
0
        public DataRow GetPackGroup(String name)
        {
            String name_column = XDataTable.Name(this);

            if (name_column != null)
            {
                String safe_name = DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable, DsnConnection.ConnectionFlavor.Unknown, name);
                if (Columns[name_column].Unique)
                {
                    DataRow[] rows = Select(name_column + "='" + safe_name + "'");
                    if (rows.Length > 1)
                    {
                        throw new ConstraintException("unique name column has already been violated, while attempting to add [" + name + "]");
                    }
                    if (rows.Length == 1)
                    {
                        return(rows[0]);
                    }
                }
            }
            return(null);
        }
Пример #9
0
        void ButtonCreateItem_Click(object sender, ReflectorButtonEventArgs e)
        {
            String newname = QueryNewName.Show("Enter new inventory type");

            if (newname != null && newname != "")
            {
                DataRow[] existing = ItemManagmentState.inventory_types.Select("inv_type='"
                                                                               + DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable, DsnConnection.ConnectionFlavor.Unknown, newname)
                                                                               + "'");
                if (existing.Length < 1)
                {
                    DataRow row = ItemManagmentState.inventory_types.NewRow();
                    row["inv_type"] = newname;
                    ItemManagmentState.inventory_types.Rows.Add(row);
                    ItemManagmentState.current_inventory_type = row;
                }
                else
                {
                    MessageBox.Show("Inventory type already exists.");
                }
            }
        }
Пример #10
0
        void ButtonAssignPaperToItem_Click(object sender, ReflectorButtonEventArgs e)
        {
            DataRow[] previous_row = ItemManagmentState.item_dataset.floor_item_map.Select(
                XDataTable.ID(ItemManagmentState.current_item.Table)
                + "='"
                + ItemManagmentState.current_item[XDataTable.ID(ItemManagmentState.current_item.Table)] + "'");
            if (previous_row.Length == 0)
            {
                previous_row = ItemManagmentState.item_dataset.floor_item_map.Select(
                    "paper_item_name"
                    + "='"
                    + DsnConnection.Escape(DsnConnection.ConnectionMode.NativeDataTable
                                           , DsnConnection.ConnectionFlavor.Unknown
                                           , ItemManagmentState.current_item[XDataTable.Name(ItemManagmentState.current_item.Table)].ToString()) + "'");
            }
            if (previous_row.Length > 0)
            {
                previous_row[0]["floor_paper_name_id"] = ItemManagmentState.current_paper["floor_paper_name_id"];
                previous_row[0]["paper_item_name"]     = ItemManagmentState.current_item["item_name"];
                previous_row[0]["floor_name"]          = ItemManagmentState.current_paper.ToString();
                previous_row[0]["paper_item"]          = true;
                //ItemManagmentState.current_floor_paper_paper_items.
            }
            else
            {
                DataRow result = MySQLRelationTable.AddGroupMember(ItemManagmentState.item_dataset.floor_item_map
                                                                   , ItemManagmentState.current_paper
                                                                   , ItemManagmentState.current_item
                                                                   , false
                                                                   , true);

                result["paper_item_name"] = ItemManagmentState.current_item["item_name"];
                result["floor_name"]      = ItemManagmentState.current_paper.ToString();
                result["paper_item"]      = true;
            }
        }