Ejemplo n.º 1
0
        private void OnExecuteDeleteCommand(Command cmd)
        {
            if (FormsUtilities.ApplicationMessageBox(
                    "Are you sure you want to delete the selected stock types and associated flows?",
                    MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }

            using (HourGlass h = new HourGlass())
            {
                this.GetFlowDiagram().DeleteSelectedStockTypeShapes();
            }
        }
Ejemplo n.º 2
0
        private void ButtonOK_Click(object sender, EventArgs e)
        {
            Debug.Assert(this.m_StockTypeId == 0);
            int id = ((BaseValueDisplayListItem)this.ComboBoxStocks.SelectedItem).Value;

            if (this.m_Diagram.GetStockTypeShape(id) != null)
            {
                FormsUtilities.InformationMessageBox("The specified stock type has already been added to the diagram.");
                return;
            }

            this.m_StockTypeId = id;
            this.DialogResult  = System.Windows.Forms.DialogResult.OK;

            this.Close();
        }
Ejemplo n.º 3
0
        internal void InternalExport(string location, ExportType exportType, bool showMessage)
        {
            ExportColumnCollection columns = this.CreateColumnCollection();

            if (exportType == ExportType.ExcelFile)
            {
                this.ExcelExport(location, columns, this.CreateReportQuery(false), "Flows");
            }
            else
            {
                columns.Remove("ScenarioName");
                this.CSVExport(location, columns, this.CreateReportQuery(true));

                if (showMessage)
                {
                    FormsUtilities.InformationMessageBox("Data saved to '{0}'.", location);
                }
            }
        }
Ejemplo n.º 4
0
        private void OnExecuteAddStockCommand(Command cmd)
        {
            DataSheet ds = this.Project.GetDataSheet(Constants.DATASHEET_STOCK_TYPE_NAME);
            DataView  dv = new DataView(ds.GetData(), null, ds.DisplayMember, DataViewRowState.CurrentRows);

            if (dv.Count == 0)
            {
                FormsUtilities.InformationMessageBox("No stock types have been defined.");
                return;
            }

            FlowPathwayDiagram  d = GetFlowDiagram();
            ChooseStockTypeForm f = new ChooseStockTypeForm();

            f.Initialize(d, this.Project);

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                using (HourGlass h = new HourGlass())
                {
                    d.AddStockTypeShape(f.StockTypeId);
                }
            }
        }
Ejemplo n.º 5
0
        public void AddStockTypeShape(int stockTypeId)
        {
            Debug.Assert(this.GetStockTypeShape(stockTypeId) == null);

            string Location = this.GetNextLocation();

            if (Location == null)
            {
                FormsUtilities.ErrorMessageBox("There are no more available locations on the diagram.");
                return;
            }

            this.m_FlowDiagramSheet.BeginAddRows();
            DataRow NewRow = this.m_FlowDiagramData.NewRow();

            NewRow[Constants.STOCK_TYPE_ID_COLUMN_NAME] = stockTypeId;
            NewRow[Constants.LOCATION_COLUMN_NAME]      = Location;

            this.m_FlowDiagramData.Rows.Add(NewRow);
            this.m_FlowDiagramSheet.EndAddRows();

            this.RefreshDiagram();
            this.SelectStockTypeShape(stockTypeId);
        }