/// <summary>
        /// Sends a copy of this grid to a new <see cref="GridForm"/> instance.
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="parentForm"></param>
        public static void CopyToGridForm(this DataGridView grid, ExtendedForm parentForm, DoubleClickAction type = DoubleClickAction.ViewOnly)
        {
            GridForm NewGridForm = new GridForm(parentForm, grid.Name + " Copy");

            NewGridForm.AddGrid(grid.Name, grid.Name, type, ((DataTable)grid.DataSource).Copy());
            NewGridForm.Show();
        }
Exemple #2
0
        private void RedirectToGridForm(Grid selectedGrid)
        {
            GridForm gridForm = new GridForm(selectedGrid, this.ParentForm, false, this.client);

            gridForm.Show();
            this.ParentForm.Hide();
        }
Exemple #3
0
        private void RedirectToModifyGridForm(Grid selectedGrid)
        {
            GridForm gridForm = new GridForm(selectedGrid, this.ParentForm, true, this._user);

            gridForm.Show();
            this.ParentForm.Hide();
        }
        private void Redirect(Grid grid)
        {
            GridForm gridForm = new GridForm(grid, this.ParentForm, true, this.user);

            gridForm.Show();
            ClearFields();
            this.ParentForm.Hide();
        }
 private void gridWindowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //Gridform or the main timeline should not be closed.
     if (!GridForm.IsDisposed)
     {
         if (GridForm.IsHidden || GridForm.DockState == DockState.Unknown)
         {
             GridForm.Show(dockPanel, DockState.Document);
         }
     }
 }
Exemple #6
0
 public void ShowGrid()
 {
     SetBusy();
     if (gridForm != null)
     {
         if ((IsSelectGrid) || (CRUDControllerManager.Instance.GetCRUDSecurityManager().HavePermissions(businessLogic.GetModule() as Modules, CRUDAction.Retrieve)))
         {
             gridForm.Show();
             gridForm.BringToFront();
         }
     }
     ClearBusy();
 }
        public static async void NewOrgObjView(string org, string obj, string fy, ExtendedForm parentForm)
        {
            try
            {
                parentForm.Waiting();
                GridForm newGridForm = new GridForm(parentForm, "Org/Obj Info");
                string   glColumns   = " glma_org, glma_obj, glma_desc, glma_seg5, glma_bud_yr, glma_orig_bud_cy, glma_rev_bud_cy, glma_encumb_cy, glma_memo_bal_cy, glma_rev_bud_cy-glma_encumb_cy-glma_memo_bal_cy AS 'Funds Available' ";
                string   glMasterQry = "Select TOP " + intMaxResults + " " + glColumns + "FROM glmaster";

                QueryParamCollection glParams = new QueryParamCollection();
                glParams.Add("glma_org", org, true);

                if (!string.IsNullOrEmpty(obj)) //Show Rollup info for Object
                {
                    glParams.Add("glma_obj", obj, true);

                    string rollUpCode = await munisComms.ReturnSqlValueAsync("gl_budget_rollup", "a_org", org, "a_rollup_code");

                    string rollUpByCodeQry = "SELECT TOP " + intMaxResults + " * FROM gl_budget_rollup WHERE a_rollup_code = '" + rollUpCode + "'";
                    string budgetQry       = "SELECT TOP " + intMaxResults + " a_projection_no,a_org,a_object,db_line,db_bud_desc_line1,db_bud_reason_desc,db_bud_req_qty5,db_bud_unit_cost,db_bud_req_amt5,a_account_id FROM gl_budget_detail_2"; // WHERE a_projection_no='" & FY & "' AND a_org='" & Org & "' AND a_object='" & Obj & "'"

                    QueryParamCollection budgetParams = new QueryParamCollection();
                    budgetParams.Add("a_projection_no", fy, true);
                    budgetParams.Add("a_org", org, true);
                    budgetParams.Add("a_object", obj, true);

                    newGridForm.AddGrid("OrgGrid", "GL Info:", await munisComms.ReturnSqlTableFromCmdAsync(munisComms.GetSqlCommandFromParams(glMasterQry, glParams.Parameters)));
                    newGridForm.AddGrid("RollupGrid", "Rollup Info:", await munisComms.ReturnSqlTableAsync(rollUpByCodeQry));
                    newGridForm.AddGrid("BudgetGrid", "Budget Info:", await munisComms.ReturnSqlTableFromCmdAsync(munisComms.GetSqlCommandFromParams(budgetQry, budgetParams.Parameters)));
                }
                else // Show Rollup info for all Objects in Org
                {
                    string rollUpAllQry = "SELECT TOP " + intMaxResults + " * FROM gl_budget_rollup";

                    QueryParamCollection rollUpParams = new QueryParamCollection();
                    rollUpParams.Add("a_org", org, true);

                    newGridForm.AddGrid("OrgGrid", "GL Info:", await munisComms.ReturnSqlTableFromCmdAsync(munisComms.GetSqlCommandFromParams(glMasterQry, glParams.Parameters)));             //MunisComms.Return_MSSQLTableAsync(Qry))
                    newGridForm.AddGrid("RollupGrid", "Rollup Info:", await munisComms.ReturnSqlTableFromCmdAsync(munisComms.GetSqlCommandFromParams(rollUpAllQry, rollUpParams.Parameters))); //MunisComms.Return_MSSQLTableAsync("SELECT TOP " & intMaxResults & " * FROM gl_budget_rollup WHERE a_org = '" & Org & "'"))
                }
                newGridForm.Show();
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }
Exemple #8
0
        /// <summary>
        /// Collect and display a table containing all the devices associated with the current employee tree.
        /// </summary>
        private async void ShowAllDevices()
        {
            Waiting();

            var deviceTable = await Task.Run(() => { return(GetDevicesTable(currentTree)); });

            DoneWaiting();

            if (deviceTable.Rows.Count > 0)
            {
                var newGridView = new GridForm(ParentForm);
                newGridView.Text = "Supervisor Devices";
                newGridView.AddGrid("devices", "Supervisor Devices - " + currentSupervisor.Name, DoubleClickAction.ViewDevice, deviceTable);
                newGridView.Show();
            }
        }
Exemple #9
0
        /// <summary>
        /// Display a table containing the devices associated with the specified employee.
        /// </summary>
        /// <param name="employee"></param>
        private void ShowDevicesByEmployee(Employee employee)
        {
            Waiting();

            var results = DBFactory.GetMySqlDatabase().DataTableFromQueryString(Queries.SelectDevicesByEmpNum(employee.Number));

            DoneWaiting();

            if (results.Rows.Count > 0)
            {
                var newGridView = new GridForm(ParentForm);
                newGridView.Text = "Devices For " + employee.Name;
                newGridView.AddGrid("devices", employee.Name + "'s Devices", DoubleClickAction.ViewDevice, results);
                newGridView.Show();
            }
        }
        public static void ShowPingHistory(ExtendedForm parentForm, Device device)
        {
            string query = "SELECT timestamp, hostname, ip FROM device_ping_history WHERE device_guid = '" + device.Guid + "' ORDER BY timestamp DESC";

            using (var results = DBFactory.GetDatabase().DataTableFromQueryString(query))
            {
                if (results.Rows.Count > 0)
                {
                    results.Columns.Add("location");

                    foreach (DataRow row in results.Rows)
                    {
                        row["location"] = NetworkInfo.LocationOfIP(row["ip"].ToString());
                    }

                    var newGrid = new GridForm(parentForm, "Ping History - " + device.HostName);
                    newGrid.AddGrid("pingGrid", "Ping History", results);
                    newGrid.Show();
                }
            }
        }
        public static async void NewMunisPOSearch(string po, ExtendedForm parentForm)
        {
            try
            {
                parentForm.Waiting();

                if (po == "")
                {
                    return;
                }
                string query = "SELECT TOP " + intMaxResults + @" pohd_pur_no, pohd_fsc_yr, pohd_req_no, pohd_gen_cm, pohd_buy_id, pohd_pre_dt, pohd_exp_dt, pohd_sta_cd, pohd_vnd_cd, pohd_dep_cd, pohd_shp_cd, pohd_tot_amt, pohd_serial
FROM poheader";

                QueryParamCollection searchParams = new QueryParamCollection();
                searchParams.Add("pohd_pur_no", po, true);

                GridForm newGridForm = new GridForm(parentForm, "MUNIS PO Info");
                using (var cmd = munisComms.GetSqlCommandFromParams(query, searchParams.Parameters))
                {
                    using (var results = await munisComms.ReturnSqlTableFromCmdAsync(cmd))
                    {
                        if (HasResults(results, parentForm))
                        {
                            newGridForm.AddGrid("POGrid", "PO Info:", results);
                            newGridForm.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }
Exemple #12
0
        private async void StartSearch()
        {
            try
            {
                ParentForm.Waiting();

                var searchString   = SearchStringTextBox.Text.Trim();
                var selectedTables = GetSelectedTables();

                if (string.IsNullOrEmpty(searchString) || selectedTables.Count < 1)
                {
                    return;
                }

                advancedSearch = new AdvancedSearch(searchString, selectedTables);

                List <DataTable> tables = await Task.Run(() =>
                {
                    return(advancedSearch.GetResults());
                });

                var displayGrid = new GridForm(ParentForm, "Advanced Search Results");
                foreach (var table in tables)
                {
                    displayGrid.AddGrid(table.TableName, table.TableName, table);
                }
                displayGrid.Show();
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                ParentForm.DoneWaiting();
            }
        }
        public static async Task <string> NewMunisReqSearch(string reqNumber, string fy, ExtendedForm parentForm, bool selectMode = false)
        {
            if (reqNumber == "" || fy == "")
            {
                return(string.Empty);
            }
            GridForm newGridForm = new GridForm(parentForm, "MUNIS Requisition Info");

            using (var ReqLineItemsTable = await GetReqLineItemsFromReqNum(reqNumber, fy))
            {
                if (HasResults(ReqLineItemsTable, parentForm))
                {
                    if (!selectMode)
                    {
                        using (var ReqHeaderTable = await GetReqHeaderFromReqNum(reqNumber, fy))
                        {
                            newGridForm.AddGrid("ReqHeaderGrid", "Requisition Header:", ReqHeaderTable);
                        }

                        newGridForm.AddGrid("ReqLineGrid", "Requisition Line Items:", ReqLineItemsTable);
                        newGridForm.Show();
                        return(string.Empty);
                    }
                    else
                    {
                        newGridForm.AddGrid("ReqLineGrid", "Requisition Line Items:", DoubleClickAction.SelectValue, ReqLineItemsTable);
                        newGridForm.ShowDialog(parentForm);
                        if (newGridForm.DialogResult == DialogResult.OK)
                        {
                            return(newGridForm.SelectedRow.Cells["rqdt_uni_pr"].Value.ToString().Trim());
                        }
                    }
                }
            }

            return(string.Empty);
        }
        private static async void NewMunisEmployeeSearch(string name, ExtendedForm parentForm)
        {
            try
            {
                parentForm.Waiting();

                string columns = "e.a_employee_number,e.a_name_last,e.a_name_first,e.a_org_primary,e.a_object_primary,e.a_location_primary,e.a_location_p_desc,e.a_location_p_short,e.e_work_location,m.a_employee_number as sup_employee_number,m.a_name_first as sup_name_first,m.a_name_last as sup_name_last";
                string query   = "SELECT TOP " + intMaxResults + " " + columns + @"
FROM pr_employee_master e
INNER JOIN pr_employee_master m on e.e_supervisor = m.a_employee_number";

                QueryParamCollection searchParams = new QueryParamCollection();
                searchParams.Add("e.a_name_last", name.ToUpper(), "OR");
                searchParams.Add("e.a_name_first", name.ToUpper(), "OR");

                using (var cmd = munisComms.GetSqlCommandFromParams(query, searchParams.Parameters))
                    using (var results = await munisComms.ReturnSqlTableFromCmdAsync(cmd))
                    {
                        if (HasResults(results, parentForm))
                        {
                            parentForm.DoneWaiting();

                            GridForm newGridForm = new GridForm(parentForm, "MUNIS Employee Info");
                            newGridForm.AddGrid("EmpGrid", "MUNIS Info:", results);
                            newGridForm.Show();
                        }
                    }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }
        public static async void LoadMunisInfoByDevice(Device device, ExtendedForm parentForm)
        {
            try
            {
                parentForm.Waiting();

                DataTable reqLinesTable  = new DataTable();
                DataTable reqHeaderTable = new DataTable();
                DataTable inventoryTable = new DataTable();

                if (device.PO == "" || device.PO == null)
                {
                    device.PO = await GetPOFromDevice(device);
                }

                if (device.PO != string.Empty)
                {
                    inventoryTable = await LoadMunisInventoryGrid(device);

                    reqLinesTable = await GetReqLineItemsFromReqNum(await GetReqNumberFromPOAsync(device.PO), GetFYFromPO(device.PO));

                    reqHeaderTable = await GetReqHeaderFromReqNum(await GetReqNumberFromPOAsync(device.PO), GetFYFromPO(device.PO));
                }
                else
                {
                    inventoryTable = await LoadMunisInventoryGrid(device);

                    reqLinesTable  = null;
                    reqHeaderTable = null;
                }
                if (inventoryTable != null || reqLinesTable != null)
                {
                    GridForm newGridForm = new GridForm(parentForm, "MUNIS Info");
                    if (inventoryTable == null)
                    {
                        OtherFunctions.Message("Munis Fixed Asset info. not found.", MessageBoxButtons.OK, MessageBoxIcon.Information, "No FA Record");
                    }
                    else
                    {
                        newGridForm.AddGrid("InvGrid", "FA Info:", inventoryTable);
                    }
                    if (reqLinesTable == null)
                    {
                        OtherFunctions.Message("Could not resolve PO from Asset Tag or Serial. Please add a valid PO if possible.", MessageBoxButtons.OK, MessageBoxIcon.Information, "No Req. Record");
                    }
                    else
                    {
                        newGridForm.AddGrid("ReqHeadGrid", "Requisition Header:", reqHeaderTable);
                        newGridForm.AddGrid("ReqLineGrid", "Requisition Line Items:", reqLinesTable);
                    }

                    if (newGridForm.GridCount > 0)
                    {
                        newGridForm.Show();
                    }
                    else
                    {
                        newGridForm.Dispose();
                    }
                }
                else if (inventoryTable == null && reqLinesTable == null)
                {
                    OtherFunctions.Message("Could not resolve any purchase or Fixed Asset info.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Nothing Found");
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }