Exemple #1
0
        public CreateBlockViewModel GetMapByID(int mapID)
        {
            MapPreviewService previewService = new MapPreviewService();

            using (var ctx = new ApplicationDbContext())
            {
                var entity     = ctx.Maps.Single(e => e.ID == mapID);
                var userEntity = ctx.Users.FirstOrDefault(e => e.Id == entity.OwnerID.ToString());

                string preview =
                    previewService.PrintCurrentRoomForCanvas
                    (
                        previewService.GenerateInputRoomFromMap(entity)
                    );

                var mapModel = new MapDetail
                {
                    MapID       = entity.ID,
                    OwnerName   = userEntity.UserName,
                    Name        = entity.Name,
                    Description = entity.Description,
                    SizeX       = entity.SizeX,
                    SizeY       = entity.SizeY,
                    BlockIDs    = BlockIDsByMapID(mapID),
                    MapPreview  = preview
                };

                return(new CreateBlockViewModel
                {
                    MapModel = mapModel
                });
            }
        }
Exemple #2
0
 public ActionResult Delete(int id, MapDetail model)
 {
     _bSvc.Value.DetachOrDeleteBlocksByMap(id, model.DeleteBlocks);
     _mSvc.Value.DeleteMap(id);
     TempData["SaveResult"] = "Map was succesfully deleted.";
     return(RedirectToAction("MyMaps"));
 }
        public void AddMapDetailData()
        {
            var dotNetGroup = new MapDetail {
                DetailsCoordinates = new GeoPoint(7.47348, 46.95404), Id = 1, Name = ".NET User Group Bern", Details = "http://www.dnug-bern.ch/", DetailsType = "Work"
            };
            var dieci = new MapDetail {
                DetailsCoordinates = new GeoPoint(7.41148, 46.94450), Id = 2, Name = "Dieci Pizzakurier Bern", Details = "http://www.dieci.ch", DetailsType = "Pizza"
            };
            var babylonKoeniz = new MapDetail {
                DetailsCoordinates = new GeoPoint(7.41635, 46.92737), Id = 3, Name = "PIZZERIA BABYLON Köniz", Details = "http://www.pizza-babylon.ch/home-k.html", DetailsType = "Pizza"
            };
            var babylonOstermundigen = new MapDetail {
                DetailsCoordinates = new GeoPoint(7.48256, 46.95578), Id = 4, Name = "PIZZERIA BABYLON Ostermundigen", Details = "http://www.pizza-babylon.ch/home-o.html", DetailsType = "Pizza"
            };

            using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                context.AddUpdateDocument(dotNetGroup, dotNetGroup.Id);
                context.AddUpdateDocument(dieci, dieci.Id);
                context.AddUpdateDocument(babylonKoeniz, babylonKoeniz.Id);
                context.AddUpdateDocument(babylonOstermundigen, babylonOstermundigen.Id);
                context.SaveChanges();
            }
        }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        Debug.Log(DataObj.MapName);
        downBtn.interactable = false;

        List <string> allRoomnames = new List <string>();

        foreach (MapDetail itemMap in mapList)
        {
            foreach (MapPiece mapPiece in itemMap.allMapPieces)
            {
                foreach (RoomPiece ro in mapPiece.rooms)
                {
                    if (!allRoomnames.Contains(ro.roomname))
                    {
                        Debug.Log(ro.roomname + "+" + mapPiece.mapSpiltName);
                        allRoomnames.Add(ro.roomname);
                    }
                }
            }

            if (itemMap.mapName.Equals(DataObj.MapName))
            {
                displayMap = itemMap;
                CreateMap();
                break;
            }
        }

        foreach (string item in allRoomnames)
        {
            Debug.Log(item);
        }
    }
 internal override void SetMapDetail()
 {
     MapDetail.FromLine = 1;
     MapDetail.BreakDetailLineCondition.Add(new Condition("Cash Account:", 1, 1, 13));
     MapDetail.AddField("InvoiceDate", 1, 10);
     MapDetail.AddField("Description", 82, 35);
     MapDetail.AddField("InvoiceNumber", 40, 12);
     MapDetail.AddField("PONumber", 53, 11);
     MapDetail.AddField("NetAmount", 65, 14); //get positive value
 }
        internal static void ShowLocationMarker()
        {
            if (detail == null)
            {
                GameObject gameObject = new GameObject();
                detail              = gameObject.AddComponent <MapDetail>();
                detail.m_LocID      = LOCATION_NAME;
                detail.m_SpriteName = "ico_X";
                detail.m_IconType   = MapIcon.MapIconType.TopIcon;
            }

            detail.transform.position = GameManager.GetPlayerTransform().position;
            InterfaceManager.m_Panel_Map.AddMapDetailToMap(detail);
        }
        public virtual void AssignDetailLine(Map map, MapDetail mapDetail, string dataLine, string ColumnHeaderName = "")
        {
            var firstField      = mapDetail.MapFields.FirstOrDefault();
            var startFirstField = firstField?.Start ?? 0;

            for (int j = 0; j < mapDetail.DetailCount; j++)
            {
                // "start" is used when detail line is on 1 line
                var start = startFirstField + j * mapDetail.DetailLength;

                // chi insert khi doan data cua Detail khac rong
                if (!string.IsNullOrWhiteSpace(dataLine.TMid(start, mapDetail.DetailLength)))
                {
                    var docDetailLine = CreateNewDocumentDetailLine();
                    // Go through each field to assign data
                    foreach (var field in mapDetail.MapFields)
                    {
                        var value = string.Empty;
                        if (!string.IsNullOrEmpty(map.Delimiter))
                        {
                            var rowItems = dataLine.LoadListFields(map.Delimiter, "").ToList();
                            var pos      = -1;

                            if (map.ColumnNameRow == 0)
                            {
                                pos = field.Start - 1;
                            }
                            else
                            {
                                pos = GetPositionOfField(map, ColumnHeaderName, field.ColumnName);
                            }

                            if (rowItems.Count >= pos && pos != -1)
                            {
                                value = rowItems[pos];
                            }
                        }
                        else
                        {
                            value = dataLine.Mid(field.Start + j * mapDetail.DetailLength, field.Length);
                        }

                        docDetailLine.SetPropertyValue(field.FieldName, value);
                    }
                    // Add detail
                    DetailLines.Add(docDetailLine);
                }
            }
        }
Exemple #8
0
        private static void ValidateAndUploadSpecCert(MapDetail mapDetail, SpecCertGenerationResult result, StreamWriter logFile, bool uploadSpecCert, string specCertType)
        {
            LogInformation(logFile, string.Format("Generating document plug from spec cert {0}", Path.GetFileName(result.SpecCertPath)));

            using (StreamReader stream = new StreamReader(result.SpecCertPath))
            {
                try
                {
                    GCExcelToDocumentPlug excelToDocumentPlug;
                    switch (specCertType)
                    {
                    case "edi":
                        excelToDocumentPlug = new X12GCExcelToDocumentPlug();
                        break;

                    case "xml":
                        excelToDocumentPlug = new XmlGCExcelToDocumentPlug();
                        break;

                    case "flatfile":
                        excelToDocumentPlug = new FlatFileGCExcelToDocumentPlug();
                        break;

                    default:
                        throw new NotSupportedException(string.Format("Spec cert type {0} is not supported", specCertType));
                        break;
                    }

                    IDocumentPlug plug = excelToDocumentPlug.GenerateDocumentPlug(stream.BaseStream, mapDetail.OrgName, mapDetail.DocumentType, mapDetail.Direction, Maarg.Contracts.GCValidate.SpecCertFileType.X12);

                    // Serialize document plug for investigation
                    plug.SerializeToXml().Save(Path.ChangeExtension(result.SpecCertPath, "xml"));

                    if (uploadSpecCert)
                    {
                        // TODO: Add logic to upload to Azure blob
                        LogWarning(logFile, "Upload functionality will be added soon.");
                    }

                    LogInformation(logFile, string.Format("Document plug generated successfully"));
                }
                catch (Exception ex)
                {
                    result.Errors.Add(string.Format("Spec cert validation failed. Error: {0}", ex.ToString()));
                    LogError(logFile, string.Format("Spec cert validation failed. Error: {0}", ex.ToString()));
                }
            }
        }
        private static void Prefix(PlayerManager __instance)
        {
            GameObject gameObject = __instance.m_InteractiveObjectUnderCrosshair;

            if (!gameObject)
            {
                return;
            }

            MapDetail detail = gameObject.GetComponentInParent <MapDetail>();

            if (detail && detail.enabled && !detail.m_IsUnlocked && detail.m_RequiresInteraction)
            {
                detail.Unlock();
            }
        }
Exemple #10
0
        private static void CreateErrorLogFile(string fileName, MapDetail mapDetail, SpecCertGenerationResult result, StreamWriter logFile)
        {
            string errorFileName = string.Format("{0} - {1}", Path.GetFileNameWithoutExtension(fileName), Path.ChangeExtension(mapDetail.FileName, "err"));

            LogInformation(logFile, string.Format("Writing errors to {0} file", errorFileName));

            using (StreamWriter errorFile = new StreamWriter(errorFileName))
            {
                errorFile.WriteLine("Errors encountered during spec cert generation/validation from {0} file", mapDetail.FileName);
                errorFile.WriteLine("Errors:");
                foreach (string error in result.Errors)
                {
                    errorFile.WriteLine(error);
                }
            }
        }
        public ToolDetailPage(string ToolDescription, string ToolLocation, string CombinedPrice, string ToolImage, double ToolLat, double ToolLong, string OwnerPhone, string ToolDatabaseNameSub, DateTime MinUserDate, DateTime MaxUserDate)
        {
            InitializeComponent();
            Label_ToolDescription.Text = ToolDescription;
            Label_ToolLocation.Text    = ToolLocation;
            Label_ToolPrice.Text       = CombinedPrice;
            Image_Tool.Source          = ToolImage;
            Label_Startdate.Text       = "From " + MinUserDate.ToString("dd/MM/yyyy");
            Label_Enddate.Text         = "till " + MaxUserDate.ToString("dd/MM/yyyy");
            MapDetail.MoveToRegion(
                MapSpan.FromCenterAndRadius(
                    new Position(ToolLat, ToolLong), Distance.FromKilometers(1)));
            var pin = new Pin {
                Type = PinType.SearchResult, Position = new Position(ToolLat, ToolLong), Label = ToolDescription
            };

            MapDetail.Pins.Add(pin);
            this.OwnerPhone          = OwnerPhone;
            this.ToolDatabaseNameSub = ToolDatabaseNameSub;
            this.MinUserDate         = MinUserDate;
            this.MaxUserDate         = MaxUserDate;
        }
 protected override void AssignDetailLine(Map map, MapDetail mapDetail, string dataLine, string columnHeaderName = "")
 {
     base.AssignDetailLine(map, mapDetail, dataLine, columnHeaderName);
 }
Exemple #13
0
 public abstract void SaveMap(MapDetail map);
Exemple #14
0
 protected override void AssignDetailLine(Map map, MapDetail mapDetail, string dataLine, string columnHeaderName = "")
 {
     return;
 }