Пример #1
0
        private string CreateQuickViewTag()
        {
            StringBuilder      sb  = new StringBuilder();
            List <int>         lst = new List <int>();
            FlowPathwayDiagram d   = this.GetFlowDiagram();
            DataSheet          ds  = this.DataFeed.Project.GetDataSheet(Constants.DATASHEET_STOCK_TYPE_NAME);

            foreach (StockTypeShape s in d.SelectedShapes)
            {
                lst.Add(s.StockTypeId);
            }

            lst.Sort();

            foreach (int i in lst)
            {
                foreach (StockTypeShape s in d.SelectedShapes)
                {
                    if (s.StockTypeId == i)
                    {
                        object v            = DataTableUtilities.GetTableValue(ds.GetData(), ds.ValueMember, s.StockTypeId, ds.DisplayMember);
                        string DisplayValue = Convert.ToString(v, CultureInfo.InvariantCulture);
                        sb.AppendFormat(CultureInfo.InvariantCulture, "{0}-{1}:", s.StockTypeId, DisplayValue);
                    }
                }
            }

            string k1 = sb.ToString().Trim(':');

            return(string.Format(CultureInfo.InvariantCulture, "{0}:{1}", this.Project.Library.Connection.ConnectionString, k1));
        }
Пример #2
0
        public override void Validate(DataTable proposedData, DataTransferMethod transferMethod)
        {
            base.Validate(proposedData, transferMethod);

            DataSheet StockTypeSheet          = this.Project.GetDataSheet(Constants.DATASHEET_STOCK_TYPE_NAME);
            DataSheet DiagramSheet            = this.GetDataSheet(Constants.DATASHEET_FLOW_PATHWAY_DIAGRAM_NAME);
            Dictionary <int, bool> StockTypes = LookupKeyUtilities.CreateRecordLookup(DiagramSheet, Constants.STOCK_TYPE_ID_COLUMN_NAME);

            foreach (DataRow dr in proposedData.Rows)
            {
                if (dr[Constants.FROM_STOCK_TYPE_ID_COLUMN_NAME] != DBNull.Value)
                {
                    int FromStockTypeId = Convert.ToInt32(dr[Constants.FROM_STOCK_TYPE_ID_COLUMN_NAME], CultureInfo.InvariantCulture);

                    if (!StockTypes.ContainsKey(FromStockTypeId))
                    {
                        string StockTypeName = Convert.ToString(DataTableUtilities.GetTableValue(StockTypeSheet.GetData(), StockTypeSheet.ValueMember, FromStockTypeId, StockTypeSheet.DisplayMember), CultureInfo.InvariantCulture);
                        throw new DataException(string.Format(CultureInfo.InvariantCulture, "Cannot import flow pathways because the 'From Stock' does not exist in this scenario: {0}", StockTypeName));
                    }
                }

                if (dr[Constants.TO_STOCK_TYPE_ID_COLUMN_NAME] != DBNull.Value)
                {
                    int ToStockTypeId = Convert.ToInt32(dr[Constants.TO_STOCK_TYPE_ID_COLUMN_NAME], CultureInfo.InvariantCulture);

                    if (!StockTypes.ContainsKey(ToStockTypeId))
                    {
                        string StockTypeName = Convert.ToString(DataTableUtilities.GetTableValue(StockTypeSheet.GetData(), StockTypeSheet.ValueMember, ToStockTypeId, StockTypeSheet.DisplayMember), CultureInfo.InvariantCulture);
                        throw new DataException(string.Format(CultureInfo.InvariantCulture, "Cannot import flow pathways because the 'To Stock' does not exist in this scenario: {0}", StockTypeName));
                    }
                }
            }
        }
Пример #3
0
        private string CreateQuickViewTitle()
        {
            StringBuilder      sb = new StringBuilder();
            FlowPathwayDiagram d  = this.GetFlowDiagram();
            DataSheet          ds = this.DataFeed.Project.GetDataSheet(Constants.DATASHEET_STOCK_TYPE_NAME);

            sb.AppendFormat(CultureInfo.InvariantCulture, "{0} - ", this.DataFeed.Scenario.DisplayName);

            foreach (StockTypeShape s in d.SelectedShapes)
            {
                object v = DataTableUtilities.GetTableValue(ds.GetData(), ds.ValueMember, s.StockTypeId, ds.DisplayMember);
                sb.AppendFormat(CultureInfo.InvariantCulture, "{0},", Convert.ToString(v, CultureInfo.InvariantCulture));
            }

            return(sb.ToString().Trim(','));
        }