Esempio n. 1
0
        public CRUDController(BusinessLogic businessLogic, string gridTitle, string crudFormTitle, Type crudFormType, CRUDSelController parentController, bool repeatCreate) : base(businessLogic, crudFormTitle)
        {
            childControllers      = new ArrayList();
            selControllers        = new ArrayList();
            this.parentController = parentController;
            isSelectGrid          = true;

            gridForm = new GridForm();
            InitializeGridForm(gridForm);
            gridForm.CreateObject   += new NonObjectEvent(CreateObject);
            gridForm.RetrieveObject += new ObjectEvent(RetrieveObject);
            gridForm.UpdateObject   += new ObjectEvent(UpdateObject);
            gridForm.DeleteObject   += new ObjectEvent(DeleteObject);
            gridForm.SelectObject   += new ObjectEvent(SelectObject);
            gridForm.Reload         += new NonObjectEvent(ReloadGrid);
            gridForm.Exit           += new ExitEvent(gridForm_Exit);
            gridForm.Title           = gridTitle;
            gridForm.MdiParent       = CRUDFormParent;

            this.crudFormType = crudFormType;
            this.repeatCreate = repeatCreate;
            gridForm.SetDataSource(businessLogic.GetDataSource(), true);
            gridForm.SetLayout(businessLogic.PersistentType);
            //gridForm.SetFilter("Inscripto");

            //
        }
        /// <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();
        }
Esempio n. 3
0
        private void RedirectToGridForm(Grid selectedGrid)
        {
            GridForm gridForm = new GridForm(selectedGrid, this.ParentForm, false, this.client);

            gridForm.Show();
            this.ParentForm.Hide();
        }
Esempio n. 4
0
        private void GridForm_Save(GridForm m, SaveLayoutEventArgs e)
        {
            ReportCentral           rc         = (ReportCentral)View.CurrentObject;
            ReportCentralLayoutData layoutData = this.ObjectSpace.CreateObject <ReportCentralLayoutData>();
            bool IsOkay = false;

            if (rc.ReportCentralLayoutData.Count > 0)
            {
                foreach (ReportCentralLayoutData layout in rc.ReportCentralLayoutData)
                {
                    if (layout.Owner.Oid.ToString() == SecuritySystem.CurrentUserId.ToString())
                    {
                        IsOkay            = true;
                        layout.GridLayout = e.LayoutXML;
                    }
                }
            }
            if (!IsOkay)
            {
                layoutData.Owner      = ObjectSpace.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);
                layoutData.GridLayout = e.LayoutXML;
                rc.ReportCentralLayoutData.Add(layoutData);
            }
            ObjectSpace.CommitChanges();
        }
Esempio n. 5
0
        private void RedirectToModifyGridForm(Grid selectedGrid)
        {
            GridForm gridForm = new GridForm(selectedGrid, this.ParentForm, true, this._user);

            gridForm.Show();
            this.ParentForm.Hide();
        }
Esempio n. 6
0
        public CRUDController(BusinessLogic businessLogic, string crudFormTitle, Type crudFormType, bool repeatCreate) : base(businessLogic, crudFormTitle)
        {
            childControllers = new ArrayList();

            gridForm          = null;
            this.crudFormType = crudFormType;
            this.repeatCreate = repeatCreate;
        }
Esempio n. 7
0
        private void Redirect(Grid grid)
        {
            GridForm gridForm = new GridForm(grid, this.ParentForm, true, this.user);

            gridForm.Show();
            ClearFields();
            this.ParentForm.Hide();
        }
Esempio n. 8
0
        private void GridForm_SaveDefaultLayout(GridForm m, SaveLayoutEventArgs e)
        {
            ReportCentral           rc         = (ReportCentral)View.CurrentObject;
            ReportCentralLayoutData layoutData = this.ObjectSpace.CreateObject <ReportCentralLayoutData>();

            rc.Save();
            ObjectSpace.CommitChanges();
        }
Esempio n. 9
0
 public override void Dispose()
 {
     if (gridForm != null)
     {
         gridForm.Hide();
         gridForm = null;
     }
     //TODO: ver si hay que sobrecargarlo
 }
 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);
         }
     }
 }
Esempio n. 11
0
        private void DemoForm_Load(object sender, EventArgs e)
        {
            string      json    = Encoding.Default.GetString(Properties.Resources.GridFormTest);
            FormOptions options = FormOptions.FromJson(json);

            options.Width = panel1.ClientSize.Width;
            gform         = new GridForm(options);
            panel1.Controls.Add(gform);
            gform.Dock              = DockStyle.Fill;
            gform.ItemValueChanged += Gform_ItemValueChanged;
        }
Esempio n. 12
0
        private void SourceFlyout_MouseMove(object sender, MouseEventArgs e)
        {
            if ((_gridFormSource == null) || (_gridFormSource.IsDisposed))
            {
                _gridFormSource = new GridForm();
            }

            _gridFormSource.PositionToMouse();
            _gridFormSource.Text            = "Source Objects";
            _gridFormSource.Grid.DataSource = grid.DataSource;
            _gridFormSource.Execute(true);
        }
Esempio n. 13
0
        private void BindToGrid_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            ReportCentral rc       = (ReportCentral)View.CurrentObject;
            GridForm      gridForm = new GridForm();

            gridForm.LayoutData        = rc.GridViewXML;
            gridForm.DefaultLayoutData = rc.GridViewXML;
            if (rc.ReportCentralLayoutData.Count > 0)
            {
                foreach (ReportCentralLayoutData layout in rc.ReportCentralLayoutData)
                {
                    if (layout.Owner.Oid.ToString() == SecuritySystem.CurrentUserId.ToString())
                    {
                        gridForm.LayoutData = layout.GridLayout;
                    }
                }
            }
            gridForm.ConnectionString = rc.Connection.ConnectionString;
            gridForm.QueryString      = rc.QueryString;
            gridForm.ReportName       = rc.Name;
            if (rc.CreatedBy.Oid.ToString() == SecuritySystem.CurrentUserId.ToString())
            {
                gridForm.IsOwner = true;
            }
            List <ParameterDefinition> list = new List <ParameterDefinition>();

            rc.Parameters.Sorting.Add(new SortProperty("ParameterIndex", DevExpress.Xpo.DB.SortingDirection.Ascending));
            if (rc.Parameters.Count > 0)
            {
                foreach (ReportParameter param in rc.Parameters)
                {
                    ParameterDefinition definition = new ParameterDefinition()
                    {
                        ParameterCaption      = param.Caption,
                        ParameterName         = param.Name,
                        ParameterPropertyType = param.ParameterType.Type,
                        ParameterDefaultValue = param.DefaultValue,
                        ParameterIndex        = param.ParameterIndex
                    };

                    if (param.ParameterType.Type == BusinessObjects.ParameterPropertyType.DataSource)
                    {
                        definition.ParameterConnection  = param.ParameterType.Connection.ConnectionString;
                        definition.ParameterQueryString = param.ParameterType.QueryString;
                    }
                    list.Add(definition);
                }
                gridForm.ParameterDefinition = list;
            }
            gridForm.Save += GridForm_Save;
            gridForm.SaveDefaultLayout += GridForm_SaveDefaultLayout;
            gridForm.ShowGridForm();
        }
Esempio n. 14
0
        private void DestinationFlyout_MouseMove(object sender, MouseEventArgs e)
        {
            if ((_gridFormDestination == null) || (_gridFormDestination.IsDisposed))
            {
                _gridFormDestination = new GridForm();
            }

            _gridFormDestination.PositionToMouse();
            _gridFormDestination.Text            = "Destination Objects";
            _gridFormDestination.Grid.DataSource = _securableObjects.ToList();
            _gridFormDestination.Execute(true);
        }
Esempio n. 15
0
        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();
            }
        }
Esempio n. 16
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();
            }
        }
Esempio n. 17
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();
            }
        }
        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();
                }
            }
        }
Esempio n. 19
0
        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();
            }
        }
Esempio n. 20
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();
            }
        }
Esempio n. 21
0
        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);
        }
Esempio n. 22
0
        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();
            }
        }
Esempio n. 23
0
        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();
            }
        }