public void saveChanges()
        {
            using (var db = new PlanningContext())
            {
                action_type data = null;

                if (!this._isCreateMode)
                {
                    var id = Convert.ToInt32(this.action_type_id.Text);
                    data = db.action_type.Where(d => d.action_type_id == id).FirstOrDefault();
                    if (data == null)
                    {
                        this._mainInterface.statusText = $"ERROR: ID '{this.action_type_id.Text}' does not exist.";
                        return;
                    }
                }
                else
                {
                    data = new action_type();
                }

                data.action_type_id = Convert.ToInt32(this.action_type_id.Text);
                data.description    = /**/ (this.description.Text);
                data.is_active      = (bool)this.is_active.IsChecked;
                data.comment        = /**/ (this.comment.Text);


                if (this._isCreateMode)
                {
                    db.action_type.Add(data);
                }
                db.SaveChanges();
            }
        }
 private void editAccountToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if ((advTree1.SelectedNode.Tag != null && (advTree1.SelectedNode.Tag as ic.accountC).is_sys_account))
     {
         MessageBox.Show("Cannot Edit This Account Because It Is A System Account", "System Account Error");
         return;
     }
     m_action = action_type.update;
     m_object = object_type.Account;
     showpanel(advTree1.SelectedNode);
 }
Пример #3
0
    public Action(action_type actionType, GameObject o = null)
    {
        float[] t = new float[2] {
            0f, .8f
        };

        type           = actionType;
        target         = o;
        completionTime = t [(int)type];
        completion     = 0f;
        location       = new int2();
    }
        private void buttonclose_Click(object sender, EventArgs e)
        {
            switch (m_action)
            {
            case action_type.create:
            {
                advTree1.SelectedNode.Remove();
                break;
            }

            case action_type.update:
            {
                break;
            }
            }
            panel2.Visible   = false;
            advTree1.Enabled = true;
            m_action         = action_type.none;
        }
Пример #5
0
        public void deleteItem(object item)
        {
            if (item == null)
            {
                return;
            }

            action_type data = item as action_type;

            if (data == null)
            {
                return;
            }

            using (var db = new PlanningContext())
            {
                db.action_type.Remove(db.action_type.Where(d => d.action_type_id == data.action_type_id).First());
                db.SaveChanges();
            }
        }
 private void editAccountToolStripMenuItem_Click(object sender, EventArgs e)
 {
     m_action = action_type.update;
     m_object = object_type.GroupAccount;
     showpanel(advTree1.SelectedNode);
 }
        private void buttonadd_Click(object sender, EventArgs e)
        {
            if (m_action == action_type.create)
            {
                #region Insert Region
                ic.departmentC _dept = new MTOMS.ic.departmentC();
                _dept.dept_name = textBox1.Text.Trim().ToProperCase();
                if (curr_node.Level == 1)
                {
                    _dept.parent_id = curr_node.Parent.Tag == null ? 0 : curr_node.Parent.Tag.ToInt32();
                }
                if (curr_node.Level == 2)
                {
                    _dept.parent_id = curr_node.Parent.Tag == null ? 0 : (curr_node.Parent.Tag as ic.departmentC).dept_id;
                }
                _dept.is_visible = true;
                _dept.level      = curr_node.Level;
                _dept.index      = curr_node.Index;
                string[] _cols = new string[]
                {
                    "exp_type",
                    "is_visible",
                    "lch_id",
                    "fs_time_stamp",
                    "dept_name",
                    "parent_id", "s_level", "s_index"
                };
                object[] _row = new object[]
                {
                    emm.export_type.insert.ToByte(),
                    1,
                         sdata.ChurchID,
                    0,
                         _dept.dept_name,
                         _dept.parent_id, _dept.level, _dept.index
                };
                using (var xd = new xing())
                {
                    if (datam.DuplicateDepartmentName(_dept.dept_name, xd))
                    {
                        MessageBox.Show("The Department Name You Have Entered Already Exists", "Duplicate Department Name");
                        buttonclose.PerformClick();
                        return;
                    }
                    _dept.dept_id  = xd.SingleInsertCommandTSPInt("dept_master_tb_ns", _cols, _row);
                    curr_node.Tag  = _dept;
                    curr_node.Text = _dept.dept_name;
                    curr_node.Name = string.Format("DEPT{0}", _dept.dept_id);
                    if (_dept.parent_id > 0)
                    {
                        _dept.expense_sys_account_id = accn.CreateChildGroupAccount(xd, datam.DATA_DEPARTMENT[_dept.parent_id].expense_sys_account_id, _dept.dept_name).account_id;
                        _dept.cr_sys_account_id      = datam.DATA_DEPARTMENT[_dept.parent_id].cr_sys_account_id;
                        _dept.income_sys_account_id  = datam.DATA_DEPARTMENT[_dept.parent_id].income_sys_account_id;
                    }
                    else
                    {
                        _dept.expense_sys_account_id = accn.CreateChildGroupAccount(xd, -2386, _dept.dept_name).account_id;
                        _dept.income_sys_account_id  = accn.CreateChildGroupAccount(xd, -2370, _dept.dept_name).account_id;
                        _dept.cr_sys_account_id      = accn.CreateChildGroupAccount(xd, -2369, _dept.dept_name).account_id;
                        xd.UpdateFsTimeStamp("accounts_tb");
                        xd.SingleUpdateCommand(string.Format("update accounts_tb set link_id={0},{1},fs_time_stamp={2} where account_id in ({3},{4},{5})", _dept.expense_sys_account_id,
                                                             dbm.ETS, SQLH.UnixStamp, _dept.expense_sys_account_id, _dept.income_sys_account_id, _dept.cr_sys_account_id));
                    }
                    //
                    xd.SingleUpdateCommandALL("dept_master_tb_ns", new string[]
                    {
                        "sys_account_id",
                        "inc_sys_account_id",
                        "cr_sys_account_id",
                        "dept_id"
                    }, new object[] { _dept.expense_sys_account_id, _dept.income_sys_account_id, _dept.cr_sys_account_id, _dept.dept_id }, 1);
                    //
                    ic.expense_accountC _exp = new ic.expense_accountC();
                    _exp.dept_id             = _dept.dept_id;
                    _exp.dept_parent_id      = _dept.parent_id;
                    _exp.dept_sys_account_id = _dept.expense_sys_account_id;
                    _exp.exp_acc_name        = string.Format("GE :: {0}", _dept.dept_name);
                    _exp.exp_acc_status      = em.exp_acc_statusS.valid;
                    _exp.exp_acc_type        = em.exp_acc_typeS.system_department;
                    datam.DATA_DEPARTMENT.Add(_dept.dept_id, _dept);
                    accn.CreateExpenseAccount(_exp, xd);
                    if (_dept.parent_id < 0)
                    {
                        #region
                        ic.accountC _inc_dept = new MTOMS.ic.accountC();
                        _inc_dept.account_name    = string.Format("GI :: {0}", _dept.dept_name);
                        _inc_dept.account_status  = em.account_statusS.Enabled;
                        _inc_dept.opening_balance = 0;
                        _inc_dept.start_date      = sdata.CURR_DATE;
                        _inc_dept.owner_type      = em.AccountOwnerTypeS.DEPARTMENT;
                        _inc_dept.owner_id        = _dept.dept_id;
                        _inc_dept.owner_name      = _dept.dept_name;
                        _inc_dept.PostType        = em.postTypeS.cash_accounts_payable;

                        ic.accountC parent_account = datam.DATA_ACCOUNTS[_dept.income_sys_account_id];
                        _inc_dept.account_dept_type     = parent_account.account_dept_type;
                        _inc_dept.account_dept_category = parent_account.account_dept_category;
                        _inc_dept.account_status        = em.account_statusS.Enabled;
                        _inc_dept.account_type          = em.account_typeS.ActualAccount;
                        _inc_dept.p_account_id          = parent_account.account_id;
                        _inc_dept.a_level = (parent_account.a_level + 1).ToInt16();
                        _inc_dept.a_index = ((datam.DATA_ACCOUNTS.Values.Count(l => l.p_account_id == parent_account.account_id & l.account_type == em.account_typeS.ActualAccount)) + 1).ToInt16();
                        _cols             = new string[]
                        {
                            "acc_d_cat_id",
                            "acc_d_type_id",
                            "account_name",
                            "account_type_id",
                            "account_alias",
                            "a_level",
                            "a_index",
                            "p_account_id",
                            "exp_type",
                            "fs_time_stamp",
                            "edate",
                            "pc_us_id",
                            "account_status_id",
                            "search_alias",
                            "is_sys_account",
                            "post_type_id",
                            "owner_type_id",
                            "owner_id",
                            "owner_name",
                            "start_date",
                            "end_date", "opening_balance",
                            "account_short_name", "account_code", "description", "lch_id", "ex_cg_type_ids", "accounts_ext_purpose"
                        };

                        xd.UpdateFsTimeStamp("accounts_tb");
                        _row = new object[]
                        {
                            _inc_dept.account_dept_category.ToByte(),
                                _inc_dept.account_dept_type.ToByte(),
                                _inc_dept.account_name,
                                _inc_dept.account_type.ToByte(),
                                _inc_dept.account_alias,
                                _inc_dept.a_level,
                                _inc_dept.a_index,
                                _inc_dept.p_account_id,
                                emm.export_type.insert.ToByte(),
                            0,
                                datam.CURR_DATE,
                                datam.PC_US_ID,
                                _inc_dept.account_status.ToByte(),
                                null,                          //search_alias
                            0,                                 // is_sys_account
                                _inc_dept.PostType.ToByte(),   //post_type
                                _inc_dept.owner_type.ToByte(), //owner_type
                                _inc_dept.owner_id,            //owner_id
                                _inc_dept.owner_name,          //owner name
                                _inc_dept.start_date,
                                _inc_dept.end_date,            //end_date
                                _inc_dept.opening_balance,     //opening balance
                                _inc_dept.account_short_name,  //account_short_name
                                _inc_dept.account_code,
                                _inc_dept.description,         //description
                                sdata.ChurchID, null, _inc_dept.extension_purpose.ToByte()
                        };
                        _inc_dept.account_id = xd.SingleInsertCommandTSPInt("accounts_tb", _cols, _row);
                        xd.UpdateFsTimeStamp("accounts_tb");
                        xd.SingleUpdateCommand(string.Format("update accounts_tb set link_id={0},{1},fs_time_stamp={2} where account_id in ({3},{4})", _dept.expense_sys_account_id,
                                                             dbm.ETS, SQLH.UnixStamp, _inc_dept.account_id, _exp.sys_account_id));

                        if (datam.DATA_ACCOUNTS != null)
                        {
                            try
                            {
                                datam.DATA_ACCOUNTS.Add(_inc_dept.account_id, _inc_dept);
                            }
                            catch (Exception)
                            {
                            }
                        }


                        #endregion
                    }
                    switch (curr_node.Level)
                    {
                    case 1:
                    {
                        curr_node.Style = _sb_dept_style;
                        break;
                    }

                    case 2:
                    {
                        curr_node.Style = _sb_dept_style2;
                        break;
                    }
                    }
                    curr_node.ContextMenu = contextMenuFile;
                    xd.CommitTransaction();
                }
                #endregion

                _dept    = null;
                m_action = action_type.none;
                if (!is_edited)
                {
                    is_edited = true;
                }
                sdata.ClearFormCache(em.fm.expense_account_settings.ToInt16());
                sdata.ClearFormCache(em.fm.chart_of_accounts.ToInt16());
                //
                sdata.ClearFormCache(em.fm.income_accounts_settings.ToInt16());
                sdata.ClearFormCache(em.fm.creditors.ToInt16());
                buttonclose.PerformClick();
            }
            if (m_action == action_type.update)
            {
                if (curr_node != null && curr_node.Tag != null)
                {
                    var _dept = curr_node.Tag as ic.departmentC;
                    if (_dept != null)
                    {
                        using (var xd = new xing())
                        {
                            if (datam.DuplicateDepartmentName(textBox1.Text.Trim().ToProperCase(), xd, _dept.dept_id))
                            {
                                MessageBox.Show("The Department Name You Have Entered Already Exists", "Duplicate Department Name");
                                buttonclose.PerformClick();
                                return;
                            }
                            xd.SingleUpdateCommandALL("dept_master_tb_ns", new string[] { "dept_name", "dept_id" }, new object[] { textBox1.Text.Trim().ToProperCase(), _dept.dept_id }, 1);
                            xd.SingleUpdateCommandALL("accounts_tb", new string[] { "account_name", "account_id" }, new object[] { textBox1.Text.Trim().ToProperCase(), _dept.expense_sys_account_id }, 1);
                            xd.CommitTransaction();
                        }
                        _dept.dept_name = textBox1.Text.Trim().ToProperCase();
                        curr_node.Text  = _dept.dept_name;
                        if (!is_edited)
                        {
                            is_edited = true;
                        }
                        sdata.ClearFormCache(em.fm.expense_account_settings.ToInt16());
                        sdata.ClearFormCache(em.fm.chart_of_accounts.ToInt16());
                        buttonclose.PerformClick();
                    }
                }
            }
        }
 private void toolStripMenuItem2_Click(object sender, EventArgs e)
 {
     m_action = action_type.create;
     m_object = object_type.Department;
     CreateDummyNode();
 }
        private void buttonadd_Click(object sender, EventArgs e)
        {
            if (m_action == action_type.create)
            {
                #region Insert Region
                ic.church_sub_unitC _unit = new MTOMS.ic.church_sub_unitC();
                _unit.sb_unit_name     = textBox1.Text.Trim().ToProperCase();
                _unit.sb_unit_category = (em.sb_unit_categoryS)curr_node.Parent.Tag.ToByte();
                string[] _cols = new string[]
                {
                    "sb_unit_name",
                    "sb_unit_cat_id",
                    "exp_type",
                    "fs_time_stamp",
                    "lch_id",
                };
                object[] _row = new object[]
                {
                    _unit.sb_unit_name,
                    _unit.sb_unit_category.ToByte(),
                    33,
                    0,
                    sdata.App_station_id,
                };
                using (var xd = new xing())
                {
                    //if (datam.DuplicateDepartmentName(_unit.dept_name, xd))
                    //{
                    //    MessageBox.Show("The Department Name You Have Entered Already Exists", "Duplicate Department Name");
                    //    buttonclose.PerformClick();
                    //    return;
                    //}
                    _unit.sb_unit_id = xd.SingleInsertCommandTSPInt("church_sub_unit_tb", _cols, _row);
                    curr_node.Tag    = _unit;
                    curr_node.Text   = _unit.sb_unit_name;
                    curr_node.Name   = string.Format("DEPT{0}", _unit.sb_unit_id);
                    switch (curr_node.Level)
                    {
                    case 1:
                    {
                        curr_node.Style = _sb_dept_style;
                        break;
                    }

                    case 2:
                    {
                        curr_node.Style = _sb_dept_style;
                        break;
                    }
                    }
                    curr_node.ContextMenu = contextMenuFile;
                    accn.CreateSubUnitCrExpAccount(_unit, xd);
                    xd.CommitTransaction();
                }
                #endregion
                datam.DATA_CHURCH_SUB_UNIT.Add(_unit.sb_unit_id, _unit);
                _unit    = null;
                m_action = action_type.none;
                if (!is_edited)
                {
                    is_edited = true;
                }
                buttonclose.PerformClick();
            }
            if (m_action == action_type.update)
            {
                if (curr_node != null && curr_node.Tag != null)
                {
                    var _unit = curr_node.Tag as ic.church_sub_unitC;
                    if (_unit != null)
                    {
                        using (var xd = new xing())
                        {
                            //if (datam.DuplicateDepartmentName(textBox1.Text.Trim().ToProperCase(), xd, _dept.dept_id))
                            //{
                            //    MessageBox.Show("The Department Name You Have Entered Already Exists", "Duplicate Department Name");
                            //    buttonclose.PerformClick();
                            //    return;
                            //}
                            xd.SingleUpdateCommandALL("church_sub_unit_tb", new string[] { "sb_unit_name", "sb_unit_id" }, new object[] { textBox1.Text.Trim().ToProperCase(), _unit.sb_unit_id }, 1);
                            xd.CommitTransaction();
                        }
                        _unit.sb_unit_name = textBox1.Text.Trim().ToProperCase();
                        curr_node.Text     = _unit.sb_unit_name;
                        if (!is_edited)
                        {
                            is_edited = true;
                        }
                        buttonclose.PerformClick();
                    }
                }
            }
        }
        private void buttonadd_Click(object sender, EventArgs e)
        {
            if (m_action == action_type.create)
            {
                #region Insert Region
                ic.accountC _account = new MTOMS.ic.accountC();
                _account.account_status = em.account_statusS.Enabled;
                _account.a_index        = curr_node.Index.ToInt16();
                _account.a_level        = curr_node.Level.ToInt16();
                int gp_id = 0;
                var _sect = GetRoot(curr_node);
                _account.account_dept_category = (em.account_d_categoryS)_sect.acc_d_cat_id;
                _account.account_dept_type     = (em.account_d_typeS)_sect.acc_d_type_id;
                if (curr_node.Level > 1)
                {
                    _account.p_account_id = curr_node.Parent == null ? 0 : (curr_node.Parent.Tag as ic.accountC).account_id;
                }
                using (var xd = new xing())
                {
                    switch (m_object)
                    {
                    case object_type.GroupAccount:
                    {
                        #region Add New Types
                        _account.account_type = curr_node.Level == 1 ? em.account_typeS.GroupAccount : em.account_typeS.SubGroupAccount;
                        curr_node.Text        = textBox1.Text.Trim().ToProperCase();
                        _account.account_name = curr_node.Text;
                        curr_node.Style       = _folder_style;
                        curr_node.ContextMenu = contextMenuFolder;
                        //  curr_node.Image = MUTTICO.Properties.Resources.Folder;
                        m_action = action_type.none;
                        if (_account.account_type == em.account_typeS.SubGroupAccount)
                        {
                            gp_id = (curr_node.Parent.Tag as ic.accountC).account_id;
                        }
                        break;
                        #endregion
                    }

                    case object_type.Account:
                    {
                        if (datam.DuplicateAccountName(textBox1.Text.Trim().ToProperCase(), xd))
                        {
                            MessageBox.Show("The Account Name You Have Entered Already Exists", "Duplicate Account Name");
                            buttonclose.PerformClick();
                            return;
                        }
                        #region Add New Types
                        _account.account_type = em.account_typeS.ActualAccount;
                        curr_node.Text        = textBox1.Text.Trim().ToProperCase();
                        _account.account_name = curr_node.Text;
                        curr_node.Style       = _folder_style;
                        curr_node.ContextMenu = contextMenuFile;
                        // curr_node.Image = MUTTICO.Properties.Resources.email;
                        m_action = action_type.none;
                        switch (curr_node.Level)
                        {
                        case 2:
                        case 3:
                        {
                            gp_id = (curr_node.Parent.Tag as ic.accountC).account_id;
                            break;
                        }
                        }
                        break;
                        #endregion
                    }
                    }
                    string[] _cols = new string[]
                    {
                        "account_id",
                        "acc_d_cat_id",
                        "acc_d_type_id",
                        "account_name",
                        "account_type_id",
                        "account_alias",
                        "a_level",
                        "a_index",
                        "p_account_id",
                        "exp_type",
                        "fs_time_stamp",
                        "edate",
                        "pc_us_id",
                        "account_status_id",
                        "search_alias",
                        "is_sys_account",
                        "post_type_id",
                        "owner_type_id",
                        "owner_id",
                        "owner_name",
                        "start_date",
                        "end_date", "opening_balance",
                        "account_short_name", "account_code", "description", "lch_id"
                    };
                    object[] _row = new object[]
                    {
                        _account.account_id = xd.IDCtrlGet("acc_id_xxx", 2013, -500),
                        _account.account_dept_category.ToByte(),
                        _account.account_dept_type.ToByte(),
                        _account.account_name,
                        _account.account_type.ToByte(),
                        _account.account_alias,
                        _account.a_level,
                        _account.a_index,
                        _account.p_account_id = gp_id,
                        emm.export_type.insert.ToByte(),
                        0,
                        datam.CURR_DATE,
                        datam.PC_US_ID,
                        _account.account_status.ToByte(),
                        null, //search_alias
                        0,    // is_sys_account
                        0,    //post_type
                        0,    //owner_type
                        0,    //owner_id
                        null, //owner name
                        sdata.CURR_DATE,
                        null,
                        0,    //opening balance
                        null, //account_short_name
                        null, // account_code
                        null, //description
                        sdata.App_station_id
                    };
                    xd.SingleInsertCommandInt("accounts_tb", _cols, _row);
                    xd.IDCtrlDelete("acc_id_xxx");
                    curr_node.Name = string.Format("Account{0}", _account.account_id);
                    xd.CommitTransaction();
                }
                #endregion
                curr_node.Tag = _account;
                datam.DATA_ACCOUNTS.Add(_account.account_id, _account);
                labelclient.Text = _account.account_name;
                if (_account.account_type == em.account_typeS.ActualAccount)
                {
                    curr_node.Style = _file_style;
                }
                else
                {
                    curr_node.Style = _folder_style;
                }

                _account = null;
                buttonclose.PerformClick();
            }
            if (m_action == action_type.update)
            {
                if (curr_node != null && curr_node.Tag != null)
                {
                    var _folder = curr_node.Tag as ic.accountC;
                    if (_folder != null)
                    {
                        using (var xd = new xing())
                        {
                            if (datam.DuplicateAccountName(textBox1.Text.Trim().ToProperCase(), xd, _folder.account_id))
                            {
                                MessageBox.Show("The Account Name You Have Entered Already Exists", "Duplicate Account Name");
                                buttonclose.PerformClick();
                                return;
                            }
                            xd.SingleUpdateCommandALL("accounts_tb", new string[] { "account_name", "account_id" }, new object[] { textBox1.Text.Trim().ToProperCase(), _folder.account_id }, 1);
                            xd.CommitTransaction();
                        }
                        _folder.account_name = textBox1.Text.Trim().ToProperCase();
                        curr_node.Text       = _folder.account_name;
                        buttonclose.PerformClick();
                    }
                }
            }
        }
 private void createSMSFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     m_action = action_type.create;
     m_object = object_type.Account;
     CreateDummyNode();
 }
Пример #12
0
        public void on_action(action_type action) {
            switch (action) {
            case action_type.home:
            case action_type.end:
            case action_type.pageup:
            case action_type.pagedown:
            case action_type.arrow_up:
            case action_type.arrow_down:
            case action_type.shift_arrow_down:
            case action_type.shift_arrow_up:
                break;
            default:
                Debug.Assert(false);
                return;
            }
            edit.clear_sel();

            int sel = sel_row_idx;
            int count = item_count;
            if (sel < 0 && count > 0)
                sel = 0; // assume we start from the top

            var visible_rows = visible_row_indexes();
            int rows_per_page = visible_rows.Item2 - visible_rows.Item1;
            int height = list.Height - list.HeaderControl.ClientRectangle.Height;
            switch (action) {
            case action_type.home:
                sel = 0;
                break;
            case action_type.end:
                sel = count - 1;
                break;
            case action_type.pageup:
                if (sel >= 0) {
                    int new_sel = sel - rows_per_page;
                    sel = new_sel >= 0 ? new_sel : 0;
                }
                break;
            case action_type.pagedown:
                if (sel < count - 1) {
                    int new_sel = sel + rows_per_page;
                    sel = new_sel <= count - 1 ? new_sel : count - 1;
                }
                break;
            case action_type.arrow_up:
                if ( sel > 0)
                    --sel;
                break;
            case action_type.arrow_down:
                if ( sel < count - 1)
                    ++sel;
                break;

            // default list behavior is wrong, we need to override
            case action_type.shift_arrow_up:                
                if (sel > 0) {
                    int existing = selected_indices_array().Min();
                    if (existing > 0) {
                        list.SelectedIndices.Add(existing - 1);
                        ensure_row_visible(existing);
                    }
                    return;
                }
                break;
            // default list behavior is wrong, we need to override
            case action_type.shift_arrow_down:
                if (sel < count - 1) {
                    int existing = selected_indices_array().Max();
                    if (existing < count - 1) {
                        list.SelectedIndices.Add(existing + 1);
                        ensure_row_visible(existing);                        
                    }
                    return;
                }
                break;

            }
            if (sel >= 0 && sel_row_idx != sel) {
                select_row_idx( sel, select_type.notify_parent);
                ensure_row_visible(sel);
            }
            edit.update_sel();
        }
Пример #13
0
		public async Task<JukeBoxStatut> jukeboxControl(action_type action, string index = null, string offset = null, string id = null, string gain = null)
		{
			Dictionary<string, string> parameters = new Dictionary<string, string>();

			parameters.Add("action", action.ToString());
			if (!string.IsNullOrEmpty(index))
				parameters.Add("index", index);
			if (!string.IsNullOrEmpty(id))
				parameters.Add("id", id);
			if (!string.IsNullOrEmpty(gain))
				parameters.Add("gain", gain);
			
			Stream theStream = await this.MakeGenericRequest("jukeboxControl", parameters);
			

			StreamReader sr = new StreamReader(theStream);

			string result = sr.ReadToEnd();
			result = result.Replace(responseHead, "").Replace(responseFoot, "");
			XElement Xel = XElement.Parse(result);
			JukeBoxStatut jbs = new JukeBoxStatut();
			
			jbs.CurrentIndex = (string)Xel.Attribute("currentIndex");
			jbs.Playing = (string)Xel.Attribute("playing");
			jbs.gain = (string)Xel.Attribute("gain");
			jbs.position = (string)Xel.Attribute("position");
			jbs.Entry.AddRange((from nm in Xel.Elements("entry")
								select new Song 
								{
									Id = (string)nm.Attribute("id"),
									Name = (string)nm.Attribute("title"),
									Album = (string)nm.Attribute("album"),
									Artist = (string)nm.Attribute("artist"),
									Parent = (string)nm.Attribute("parent"),
									CoverArt = (string)nm.Attribute("coverArt"),
									Created = (string)nm.Attribute("created"),
									Duration = (string)nm.Attribute("duration"),
									BitRate = (string)nm.Attribute("bitRate"),
									Track = (string)nm.Attribute("track"),
									Year = (string)nm.Attribute("year"),
									Genre = (string)nm.Attribute("genre"),
									Size = (string)nm.Attribute("size"),
									Suffix = (string)nm.Attribute("suffix"),
									ContentType = (string)nm.Attribute("contentType"),
									AlbumId = (string)nm.Attribute("albumId"),
									ArtistId = (string)nm.Attribute("artistId")
								}).ToList());

			return jbs;
		}
Пример #14
0
        private void handle_action(action_type action)
        {
            int sel = viewsTab.SelectedIndex;
            var lv = selected_view();

            switch (action) {
            case action_type.search:
                var searcher = new search_form();
                if (searcher.ShowDialog() == DialogResult.OK) {
                    search_for_text_ = searcher.search;
                    // remove focus from the Filters tab, just in case (otherwise, search prev/next would end up working on that)
                    unfocus_filter_panel();

                    if ( search_for_text_.mark_lines_with_color)
                        lv.mark_text(search_for_text_.text, search_for_text_.fg, search_for_text_.bg);
                    lv.search_for_text_first(search_for_text_.text);
                }
                break;
            case action_type.search_prev:
                search_prev();
                break;
            case action_type.search_next:
                search_next();
                break;
            case action_type.clear_search:
                if (selected_view() != null)
                    selected_view().unmark();
                search_for_text_ = null;
                break;

            case action_type.next_view: {
                int prev_idx = viewsTab.SelectedIndex;
                int next_idx = viewsTab.TabCount > 0 ? (sel + 1) % viewsTab.TabCount : -1;
                if (next_idx >= 0) {
                    viewsTab.SelectedIndex = next_idx;
                    log_view_for_tab(next_idx).on_selected();
                }
                if ( prev_idx >= 0)
                    log_view_for_tab(prev_idx).update_x_of_y();
            }
                break;
            case action_type.prev_view: {
                int prev_idx = viewsTab.SelectedIndex;
                int next_idx = viewsTab.TabCount > 0 ? (sel + viewsTab.TabCount - 1) % viewsTab.TabCount : -1;
                if (next_idx >= 0) {
                    viewsTab.SelectedIndex = next_idx;
                    log_view_for_tab(next_idx).on_selected();
                }
                if ( prev_idx >= 0)
                    log_view_for_tab(prev_idx).update_x_of_y();
            }
                break;

            case action_type.home:
            case action_type.end:
            case action_type.pageup:
            case action_type.pagedown:
            case action_type.arrow_up:
            case action_type.arrow_down:
                if ( lv != null)
                    lv.on_action(action);
                break;

            case action_type.toggle_filters:
                toggleFilters_Click(null,null);
                break;
            case action_type.toggle_fulllog:
                toggleFullLog_Click(null,null);
                break;
            case action_type.toggle_source:
                toggleSource_Click(null,null);
                break;

            case action_type.copy_to_clipboard:
                if (lv != null)
                    lv.copy_to_clipboard();
                break;
            case action_type.copy_full_line_to_clipboard:
                if (lv != null)
                    lv.copy_full_line_to_clipboard();
                break;

            case action_type.toggle_bookmark:
                int line_idx = lv != null ? lv.sel_line_idx : -1;
                if (line_idx >= 0) {
                    if (bookmarks_.Contains(line_idx))
                        bookmarks_.Remove(line_idx);
                    else
                        bookmarks_.Add(line_idx);
                    save_bookmarks();
                    notify_views_of_bookmarks();
                }
                break;
            case action_type.clear_bookmarks:
                bookmarks_.Clear();
                save_bookmarks();
                notify_views_of_bookmarks();
                break;
            case action_type.next_bookmark:
                if (lv != null)
                    lv.next_bookmark();
                break;
            case action_type.prev_bookmark:
                if (lv != null)
                    lv.prev_bookmark();
                break;

            case action_type.pane_next:
                switch_pane(true);
                break;
            case action_type.pane_prev:
                switch_pane(false);
                break;

            case action_type.toggle_history_dropdown:
                if (logHistory.DroppedDown)
                    logHistory.DroppedDown = false;
                else {
                    var panes = this.panes();
                    if (panes.Contains(focused_ctrl()))
                        pane_to_focus_ = focused_ctrl();
                    logHistory.Focus();
                    logHistory.DroppedDown = true;
                }
                break;
            case action_type.new_log_wizard:
                newView_Click(null,null);
                break;
            case action_type.show_preferences:
                settingsCtrl_Click(null,null);
                break;

            case action_type.increase_font:
                foreach (log_view view in all_log_views_and_full_log())
                    view.increase_font(1);
                break;
            case action_type.decrease_font:
                foreach (log_view view in all_log_views_and_full_log())
                    view.increase_font(-1);
                break;

            case action_type.toggle_show_msg_only:
                if (lv != null)
                    lv.toggle_show_msg_only();
                break;
            case action_type.scroll_up:
                if (lv != null)
                    lv.scroll_up();
                break;
            case action_type.scroll_down:
                if (lv != null)
                    lv.scroll_down();
                break;

            case action_type.go_to_line:
                if (lv != null) {
                    var dlg = new go_to_line_time_form();
                    if (dlg.ShowDialog() == DialogResult.OK) {
                        if (dlg.is_number()) {
                            if ( dlg.has_offset != '\0')
                                lv.offset_closest_line(dlg.number, dlg.has_offset == '+');
                            else
                                lv.go_to_closest_line(dlg.number - 1, log_view.select_type.notify_parent);
                        } else if (dlg.has_offset != '\0')
                            lv.offset_closest_time(dlg.time_milliseconds, dlg.has_offset == '+');
                        else
                            lv.go_to_closest_time(dlg.normalized_time);
                    }
                }
                break;
            case action_type.refresh:
                refreshFilter_Click(null,null);
                break;
            case action_type.toggle_title:
                toggle_title();
                break;
            case action_type.toggle_view_tabs:
                break;

            case action_type.none:
                break;
            default:
                Debug.Assert(false);
                break;
            }
        }
 private void createSubDepartmentToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     m_action = action_type.create;
     m_object = object_type.SubDepartment;
     CreateDummyNode();
 }
Пример #16
0
        private void handle_action(action_type action) {
            int sel = viewsTab.SelectedIndex;
            var lv = selected_view();
            Debug.Assert(lv != null);

            switch (action) {
            case action_type.search:
                if (lv.item_count < 1) {
                    set_status("Can't search - nothing to search", status_ctrl.status_type.err);
                    break;
                }
                var searcher = new search_form(this, lv, lv.smart_edit_sel_text);
                if (searcher.ShowDialog() == DialogResult.OK) {
                    // remove focus from the Filters tab, just in case (otherwise, search prev/next would end up working on that)
                    unfocus_filter_panel();

                    lv.search_for_text(searcher.search);
                    lv.search_for_text_first();
                }
                break;

            case action_type.default_search:
                // remove focus from the Filters tab, just in case (otherwise, search prev/next would end up working on that)
                unfocus_filter_panel();
                var search = search_form.default_search;
                var sel_text = lv.smart_edit_sel_text;
                if (sel_text != "") {
                    search.text = sel_text;
                    search.type = 1; // text 
                }
                lv.search_for_text(search);
                lv.search_next();
                break;

            case action_type.search_prev:
                lv.search_prev();
                break;
            case action_type.search_next:
                lv.search_next();
                break;
            case action_type.escape:
                if (logHistory.DroppedDown)
                    close_history_dropdown();
                else
                    lv.escape();
                break;

            case action_type.right_click_via_key:
                lv.do_right_click_via_key();
                break;

            case action_type.next_view: {
                int prev_idx = viewsTab.SelectedIndex;
                int next_idx = viewsTab.TabCount > 0 ? (sel + 1) % viewsTab.TabCount : -1;
                if (next_idx >= 0) {
                    viewsTab.SelectedIndex = next_idx;
                    log_view_for_tab(next_idx).on_selected();
                }
                if (prev_idx >= 0)
                    log_view_for_tab(prev_idx).update_x_of_y();
            }
                break;
            case action_type.prev_view: {
                int prev_idx = viewsTab.SelectedIndex;
                int next_idx = viewsTab.TabCount > 0 ? (sel + viewsTab.TabCount - 1) % viewsTab.TabCount : -1;
                if (next_idx >= 0) {
                    viewsTab.SelectedIndex = next_idx;
                    log_view_for_tab(next_idx).on_selected();
                }
                if (prev_idx >= 0)
                    log_view_for_tab(prev_idx).update_x_of_y();
            }
                break;

            case action_type.home:
            case action_type.end:
            case action_type.pageup:
            case action_type.pagedown:
            case action_type.arrow_up:
            case action_type.arrow_down:
            case action_type.shift_arrow_down:
            case action_type.shift_arrow_up:
                lv.on_action(action);
                break;

            case action_type.toggle_filters:
                toggle_filters();
                break;
            case action_type.toggle_notes:
                toggle_notes();
                break;
            case action_type.toggle_fulllog:
                toggle_full_log();
                break;
            case action_type.toggle_source:
                toggle_source();
                break;

            case action_type.copy_to_clipboard:
                lv.copy_to_clipboard();
                set_status("Lines copied to Clipboard, as text and html");
                break;
            case action_type.copy_full_line_to_clipboard:
                lv.copy_full_line_to_clipboard();
                set_status("Full Lines copied to Clipboard, as text and html");
                break;

            case action_type.toggle_bookmark:
                int line_idx = lv.sel_line_idx;
                if (line_idx >= 0) {
                    if (bookmarks_.Contains(line_idx))
                        bookmarks_.Remove(line_idx);
                    else
                        bookmarks_.Add(line_idx);
                    save_bookmarks();
                    notify_views_of_bookmarks();
                }
                break;
            case action_type.clear_bookmarks:
                bookmarks_.Clear();
                save_bookmarks();
                notify_views_of_bookmarks();
                break;
            case action_type.next_bookmark:
                lv.next_bookmark();
                break;
            case action_type.prev_bookmark:
                lv.prev_bookmark();
                break;

            case action_type.pane_next:
                switch_pane(true);
                break;
            case action_type.pane_prev:
                switch_pane(false);
                break;

            case action_type.toggle_history_dropdown:
                if (logHistory.DroppedDown)
                    close_history_dropdown();
                else {
                    logHistory.Visible = true;
                    logHistory.Focus();
                    logHistory.DroppedDown = true;
                }
                break;
            case action_type.new_log_wizard:
                new log_wizard( ).Show();
                break;
            case action_type.show_preferences:
                whatsupPreferences_Click(null, null);
                break;

            case action_type.increase_font:
                foreach (log_view view in all_log_views_and_full_log())
                    view.increase_font(1);
                break;
            case action_type.decrease_font:
                foreach (log_view view in all_log_views_and_full_log())
                    view.increase_font(-1);
                break;

            case action_type.scroll_up:
                lv.scroll_up();
                break;
            case action_type.scroll_down:
                lv.scroll_down();
                break;

            case action_type.go_to_line:
                var dlg = new go_to_line_time_form(this);
                if (dlg.ShowDialog() == DialogResult.OK) {
                    if (dlg.is_number()) {
                        if (dlg.has_offset != '\0')
                            lv.offset_closest_line(dlg.number, dlg.has_offset == '+');
                        else
                            lv.go_to_closest_line(dlg.number - 1, log_view.select_type.notify_parent);
                    } else if (dlg.has_offset != '\0')
                        lv.offset_closest_time(dlg.time_milliseconds, dlg.has_offset == '+');
                    else
                        lv.go_to_closest_time(dlg.normalized_time);
                }
                break;
            case action_type.refresh:
                refreshToolStripMenuItem_Click(null, null);
                break;
            case action_type.toggle_title:
                toggle_title();
                break;
            case action_type.toggle_status:
                toggle_status();
                break;

            case action_type.toggle_view_tabs:
                toggle_view_tabs();
                break;
            case action_type.toggle_view_header:
                toggle_view_header();
                break;
            case action_type.toggle_details:
                toggle_details();
                break;

            case action_type.open_in_explorer:
                if (text_ != null)
                    util.open_in_explorer(text_.name);
                break;

            case action_type.none:
                break;

            case action_type.goto_position_1:
                toggle_custom_ui(0);
                break;
            case action_type.goto_position_2:
                toggle_custom_ui(1);
                break;
            case action_type.goto_position_3:
                toggle_custom_ui(2);
                break;
            case action_type.goto_position_4:
                toggle_custom_ui(3);
                break;
            case action_type.goto_position_5:
                toggle_custom_ui(4);
                break;

            case action_type.goto_position_6:
                toggle_custom_ui(5);
                break;
            case action_type.goto_position_7:
                toggle_custom_ui(6);
                break;
            case action_type.goto_position_8:
                toggle_custom_ui(7);
                break;
            case action_type.goto_position_9:
                toggle_custom_ui(8);
                break;
            case action_type.goto_position_10:
                toggle_custom_ui(9);
                break;




            case action_type.toggle_enabled_dimmed:
                filtCtrl.toggle_enabled_dimmed();
                break;

            case action_type.export_notes:
                export_notes_to_logwizard_file();
                break;

            case action_type.undo:
                if (global_ui.show_filter)
                    filtCtrl.undo();
                else if (global_ui.show_notes)
                    notes.undo();
                break;

            case action_type.toggle_filter_view:
                lv.set_filter( !lv.filter_view, lv.show_full_log);
                break;
            case action_type.toggle_show_full_log: {
                lv.set_filter(lv.filter_view, !lv.show_full_log);
                var old = global_ui.view(lv.name);
                global_ui.view(lv.name, new ui_info.view_info(old.column_positions, !old.show_full_log) );
            }
                break;

            case action_type.open_log:
                whatsupOpen_Click(null, null);
                break;

            default:
                Debug.Assert(false);
                break;
            }
        }
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     m_action = action_type.create;
     m_object = object_type.GroupAccount;
     CreateDummyNode();
 }