示例#1
0
        private void _miAddDrop_Click(object sender, RoutedEventArgs e)
        {
            Table <int, ReadableTuple <int> > btable = _itemGroupsTable;

            try {
                DropEdit dialog = new DropEdit("", "1", ServerDbs.Items, _tab.GenericDatabase);
                dialog.Owner = WpfUtilities.TopWindow;

                if (dialog.ShowDialog() == true)
                {
                    string sid    = dialog.Id;
                    string svalue = dialog.DropChance;
                    int    value;
                    int    id;

                    Int32.TryParse(sid, out id);
                    Int32.TryParse(svalue, out value);

                    if (id <= 0)
                    {
                        return;
                    }

                    _setSelectedItem(id, value, DicoModifs.Add);
                }
            }
            catch (Exception err) {
                ErrorHandler.HandleException(err);
            }

            btable.Commands.EndEdit();
        }
示例#2
0
        // Filling fields
        private void BindDropDown()
        {
            // make sure m_UserBinds have something
            if (m_UserBinds == null)
            {
                if (Session["UserBinds"] != null)
                {
                    m_UserBinds = Session["UerBinds"] as string[];
                }
                else
                {
                    m_UserBinds = Global.getUserBinds();
                }
            }

            string     strQuery = "SELECT [id_tipo] ,[nombre_tipo] FROM [dbo].[View_MarcasTipos] WHERE id_marca = " + m_UserBinds[0];
            SqlCommand cmd      = new SqlCommand(strQuery);
            DataTable  d_types  = GetData(cmd);

            typeDrop.DataSource     = d_types;
            typeDrop.DataTextField  = "nombre_tipo";
            typeDrop.DataValueField = "id_tipo";
            typeDrop.DataBind();

            DropEdit.DataSource     = d_types;
            DropEdit.DataTextField  = "nombre_tipo";
            DropEdit.DataValueField = "id_tipo";
            DropEdit.DataBind();
        }
        private void BindEditDropDown()
        {
            string     strQuery = "SELECT [id] ,[nombre] FROM [dbo].[Promociones]";
            SqlCommand cmd      = new SqlCommand(strQuery);

            DropEdit.DataSource     = GetData(cmd);
            DropEdit.DataTextField  = "nombre";
            DropEdit.DataValueField = "id";
            DropEdit.DataBind();
        }
        private void BindEditDropDown()
        {
            string     strQuery = "SELECT [id_medio] ,[nombre_medio] FROM [dbo].[MediosContacto]";
            SqlCommand cmd      = new SqlCommand(strQuery);

            DropEdit.DataSource     = GetData(cmd);
            DropEdit.DataTextField  = "nombre_medio";
            DropEdit.DataValueField = "id_medio";
            DropEdit.DataBind();
        }
示例#5
0
        private void _miEditDrop_Click(object sender, RoutedEventArgs e)
        {
            if (_lv.SelectedItems.Count <= 0)
            {
                return;
            }

            Table <int, ReadableTuple <int> > btable = _tab.GenericDatabase.GetMetaTable <int>(ServerDbs.Mobs);

            try {
                var      selectedItem = (MobDropView)_lv.SelectedItem;
                DropEdit dialog       = new DropEdit(selectedItem.ID.ToString(CultureInfo.InvariantCulture), selectedItem.DropOriginal.ToString(CultureInfo.InvariantCulture), ServerDbs.Items, _tab.GenericDatabase);
                dialog.Owner = WpfUtilities.TopWindow;

                if (dialog.ShowDialog() == true)
                {
                    string sid    = dialog.Id;
                    string svalue = dialog.DropChance;
                    int    value;
                    int    id;

                    Int32.TryParse(sid, out id);

                    if (!Extensions.GetIntFromFloatValue(svalue, out value))
                    {
                        ErrorHandler.HandleException("Invalid format (integer or float value only)");
                        return;
                    }

                    if (id <= 0)
                    {
                        return;
                    }

                    try {
                        btable.Commands.BeginEdit(new GroupCommand <TKey, TValue>());

                        btable.Commands.Set(selectedItem.Tuple, selectedItem.AttributeIndex, id);
                        btable.Commands.Set(selectedItem.Tuple, selectedItem.AttributeIndex + 1, value);
                    }
                    finally {
                        btable.Commands.EndEdit();
                    }

                    selectedItem.Update();
                }
            }
            catch (Exception err) {
                ErrorHandler.HandleException(err);
            }

            btable.Commands.EndEdit();
        }
示例#6
0
        private void _miEditDrop_Click(object sender, RoutedEventArgs e)
        {
            if (_lv.SelectedItems.Count <= 0)
            {
                return;
            }

            Table <int, ReadableTuple <int> > btable = _tab.GenericDatabase.GetTable <int>(ServerDbs.ItemGroups);

            try {
                var      selectedItem = (ItemView)_lv.SelectedItem;
                DropEdit dialog       = new DropEdit(selectedItem.ID.ToString(CultureInfo.InvariantCulture), selectedItem.Rate.ToString(CultureInfo.InvariantCulture), ServerDbs.Items, _tab.GenericDatabase)
                {
                    Element2 = "Frequency"
                };
                dialog.Owner = WpfUtilities.TopWindow;

                if (dialog.ShowDialog() == true)
                {
                    string sid    = dialog.Id;
                    string svalue = dialog.DropChance;
                    int    value;
                    int    id;

                    Int32.TryParse(sid, out id);
                    Int32.TryParse(svalue, out value);

                    if (id <= 0)
                    {
                        return;
                    }

                    _setSelectedItem(id, value, DicoModifs.Edit);
                }
            }
            catch (Exception err) {
                ErrorHandler.HandleException(err);
            }

            btable.Commands.EndEdit();
        }
        private void _miAddDrop_Click(object sender, RoutedEventArgs e)
        {
            if (_lv.Items.Count >= 3)
            {
                ErrorHandler.HandleException("You cannot add more than 3 MVP drops. Delete an item and then add a new one.");
                return;
            }

            Table <int, ReadableTuple <int> > btable = _tab.GenericDatabase.GetMetaTable <int>(ServerDbs.Mobs);

            try {
                DropEdit dialog = new DropEdit("", "", ServerDbs.Items, _tab.GenericDatabase);
                dialog.Owner = WpfUtilities.TopWindow;

                if (dialog.ShowDialog() == true)
                {
                    string sid    = dialog.Id;
                    string svalue = dialog.DropChance;
                    int    value;
                    int    id;

                    Int32.TryParse(sid, out id);

                    if (id <= 0)
                    {
                        return;
                    }

                    if (!Extensions.GetIntFromFloatValue(svalue, out value))
                    {
                        ErrorHandler.HandleException("Invalid format (integer or float value only)");
                        return;
                    }

                    TValue item = (TValue)_tab.List.SelectedItem;

                    try {
                        btable.Commands.BeginEdit(new GroupCommand <TKey, TValue>());

                        int startIndex = ServerMobAttributes.Mvp1ID.Index;

                        for (int i = 0; i < 6; i += 2)
                        {
                            if (item.GetValue <int>(startIndex + i) == 0)
                            {
                                btable.Commands.Set((ReadableTuple <int>)(object) item, startIndex + i, id);
                                btable.Commands.Set((ReadableTuple <int>)(object) item, startIndex + i + 1, value);
                                break;
                            }
                        }
                    }
                    finally {
                        btable.Commands.EndEdit();
                    }

                    _lv.ItemsSource = null;
                    _updateAction(item);
                }
            }
            catch (Exception err) {
                ErrorHandler.HandleException(err);
            }
        }
示例#8
0
        private void _miAddCardDrop_Click(object sender, RoutedEventArgs e)
        {
            TValue item = (TValue)_tab.List.SelectedItem;

            if (item.GetValue <int>(ServerMobAttributes.DropCardid) != 0)
            {
                _lv.SelectedItem = _lv.Items.OfType <MobDropView>().FirstOrDefault(p => p.IsCard);
                _miEditDrop_Click(sender, e);
                return;
            }

            Table <int, ReadableTuple <int> > btable = _tab.GenericDatabase.GetMetaTable <int>(ServerDbs.Mobs);

            try {
                DropEdit dialog = new DropEdit("", "", ServerDbs.Items, _tab.GenericDatabase);
                dialog.Owner = WpfUtilities.TopWindow;

                if (dialog.ShowDialog() == true)
                {
                    string sid    = dialog.Id;
                    string svalue = dialog.DropChance;
                    int    value;
                    int    id;

                    Int32.TryParse(sid, out id);

                    if (id <= 0)
                    {
                        return;
                    }

                    if (!Extensions.GetIntFromFloatValue(svalue, out value))
                    {
                        ErrorHandler.HandleException("Invalid format (integer or float value only)");
                        return;
                    }

                    try {
                        btable.Commands.BeginEdit(new GroupCommand <TKey, TValue>());

                        int startIndex = ServerMobAttributes.DropCardid.Index;

                        for (int i = 0; i < 2; i += 2)
                        {
                            if (item.GetValue <int>(startIndex + i) == 0)
                            {
                                btable.Commands.Set((ReadableTuple <int>)(object) item, startIndex + i, id);
                                btable.Commands.Set((ReadableTuple <int>)(object) item, startIndex + i + 1, value);
                                break;
                            }
                        }
                    }
                    finally {
                        btable.Commands.EndEdit();
                    }

                    //_lv.Items.OfType<MobDropView>().ToList().ForEach(p => p.RemoveEvents());
                    _lv.ItemsSource = null;
                    _updateAction(item);
                }
            }
            catch (Exception err) {
                ErrorHandler.HandleException(err);
            }
        }