Exemplo n.º 1
0
        void Category_Update()
        {
            try
            {
                c_row_select = dgrCategory.SelectedIndex;
                Category_Info _Category_Info = (Category_Info)dgrCategory.SelectedItem;

                if (_Category_Info == null)
                {
                    return;
                }
                frmCreate_Category _frmCreate_Category = new frmCreate_Category();
                _frmCreate_Category.c_type          = Convert.ToInt16(Form_Type.Update);
                _frmCreate_Category.c_Category_Info = _Category_Info;
                _frmCreate_Category.Owner           = Window.GetWindow(this);
                _frmCreate_Category.ShowDialog();

                if (_frmCreate_Category.c_id_insert != 0)
                {
                    LoadData();
                }

                DataGridHelper.NVSFocus(dgrCategory, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemplo n.º 2
0
        void Insert_Category()
        {
            try
            {
                frmCreate_Category _frmCreate_Category = new frmCreate_Category();
                _frmCreate_Category.c_type = Convert.ToInt16(Form_Type.Insert);
                _frmCreate_Category.Owner  = Window.GetWindow(this);
                _frmCreate_Category.ShowDialog();

                if (_frmCreate_Category.c_id_insert != 0)
                {
                    LoadData();

                    for (int i = 0; i < c_lst.Count; i++)
                    {
                        Category_Info ui = (Category_Info)c_lst[i];
                        if (ui.Category_Id == _frmCreate_Category.c_id_insert)
                        {
                            c_row_select = i;
                            _frmCreate_Category.c_id_insert = 0;
                            break;
                        }
                    }
                }

                DataGridHelper.NVSFocus(dgrCategory, c_row_select, 0);
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }