IEnumerator PerformUpdate()
        {
            while (true)
            {
                for (var i = 0; i < _agents.Count; i++)
                {
                    for (var j = 0; j < _agents.Count; j++)
                    {
                        if (i == j) continue;

                        if (Vector3.Distance(_agents[i].transform.position, _agents[j].transform.position) > SenseDistance) continue;

                        var sense = new Sight { AgentSensed = _agents[j] };

                        _nodeGraph = sense.PropagateSense(PathFinder, _agents[i].transform.position, _agents[j].transform.position);

                        var attenuation = _nodeGraph.AsEnumerable().Sum(node => node.Attenuation);

                        if (attenuation > MaxAttenuation) continue;

                        _agents[i].HandleSense(sense);

                    }
                }

                yield return new WaitForSeconds(.5f);

            }
        }
 protected override IEnumerable<IRefactoringConditionChecker> GetAllConditionCheckers()
 {
     var checkers = new List<IRefactoringConditionChecker>();
     checkers.Add(new ParametersChecker());
     checkers.Add(new ReturnTypeChecker());
     return checkers.AsEnumerable();
 }
Example #3
0
        public static PagingSearchOption PagingGetSearchOption()
        {
            var request = HttpContext.Current.Request;

            var ret = new PagingSearchOption()
            {
                CurrentPageNo = int.Parse((request[Paging.KEY_CURRENT_PAGE_NO] ?? "1")),
                RowCountOnPage = int.Parse((request[Paging.KEY_ROWCOUNT_ON_PAGE] ?? Paging.CONST_ROWCOUNT_ON_PAGE.ToString())),
                TotalRowCount = int.Parse(request[Paging.KEY_TOTAL_ROW_COUNT] ?? "1")
            };

            var searchOption = (request[Paging.KEY_SEARCH_OPTION] ?? "");

            List<KeyValuePair<string, string>> optionList = new List<KeyValuePair<string,string>>();
            foreach(var option in searchOption.Split(';'))
            {
                if ( option.Contains('=') == false ) continue;
                var optionItem = option.Split('=');

                optionList.Add(new KeyValuePair<string,string>(optionItem[0], optionItem[1]));
            }

            ret.SearchOption = optionList.AsEnumerable();

            return ret;
        }
 public static IEnumerable<module> GetMyModules()
 {
     DBFactory db;
     SqlDataReader rdr;
     List<module> data = null;
                 
     try
     {
         db = new DBFactory("CCATDBEntities");
         rdr = db.ExecuteReader("MSI_GetLeftSideMenu", new SqlParameter("@roleName", GetRoleName()));
         data = new List<module>();
         module record;
         while (rdr.Read())
         {
             record = new module();
             record.moduleId = Convert.ToInt32(rdr["moduleId"].ToString());
             record.pageMenuGroups = rdr["pageMenuGroups"].ToString();
             data.Add(record);
         }
         //Close the datareader
         rdr.Close();
     }
     catch (Exception ex)
     {
         throw new Exception("Exception in DataQueries.GetMyModules:" + ex.Message);
     }
     return data.AsEnumerable<module>();
     
 }
        /// <summary>
        /// Menus the specified date range.
        /// </summary>
        /// <param name="dateRange">The date range.</param>
        /// <returns>Archive widget</returns>
        public PartialViewResult Menu(string dateRange = null)
        {
            ViewBag.SelectedArchive = dateRange;

            IEnumerable<DateTime> dates = this.repository.Articles
                                            .Select(b => b.Modified)
                                            .Distinct()
                                            .OrderByDescending(b => b);

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

            foreach(DateTime date in dates)
            {
                StringBuilder archiveName = new StringBuilder();

                archiveName.Append(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(date.Month));
                archiveName.Append(" ");
                archiveName.Append(date.Year.ToString());

                if (!dateRanges.Exists(d => d == archiveName.ToString()))
                {
                    dateRanges.Add(archiveName.ToString());
                }
            }

            return PartialView(dateRanges.AsEnumerable());
        }
        private IEnumerable<CodeCoverageStatistics> ReadDataFromNodes(XmlDocument doc, string summaryXmlLocation)
        {
            var listCoverageStats = new List<CodeCoverageStatistics>();

            if (doc == null)
            {
                return null;
            }

            XmlNode reportNode = doc.SelectSingleNode("coverage");

            if (reportNode != null)
            {
                if (reportNode.Attributes != null)
                {
                    CodeCoverageStatistics coverageStatisticsForLines = GetCCStats(labelTag: _linesCovered, coveredTag: _linesCoveredTag, validTag: _linesValidTag,
                                                                                    priorityTag: "line", summaryXmlLocation: summaryXmlLocation, reportNode: reportNode);

                    if (coverageStatisticsForLines != null)
                    {
                        listCoverageStats.Add(coverageStatisticsForLines);
                    }

                    CodeCoverageStatistics coverageStatisticsForBranches = GetCCStats(labelTag: _branchesCovered, coveredTag: _branchesCoveredTag, validTag: _branchesValidTag,
                                                                                        priorityTag: "branch", summaryXmlLocation: summaryXmlLocation, reportNode: reportNode);

                    if (coverageStatisticsForBranches != null)
                    {
                        listCoverageStats.Add(coverageStatisticsForBranches);
                    }
                }
            }

            return listCoverageStats.AsEnumerable();
        }
        public IEnumerable<LineProperty> GetLineProperty(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<LineProperty> LinePropertyList = new List<LineProperty>();
            try
            {
                DataTable resultTable = axHelper.GetLinePropertyList(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    LineProperty LinePropertyObject = new LineProperty();
                    LinePropertyObject.LinePropertyCode = row["LinePropertyCode"].ToString();
                    LinePropertyObject.LinePropertyDescription =  row["LinePropertyName"].ToString();

                    LinePropertyList.Add(LinePropertyObject);

                }
            }
            catch (Exception e)
            {
                throw e;

            }
            return LinePropertyList.AsEnumerable<LineProperty>();
        }
Example #8
0
 public List<CampaignConflitView> GetDataDemo()
 {
     string s = "אבגדaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgGaAbBcCdDeEFfgG";
     char[] ch = s.ToCharArray();
     var data = new List<CampaignConflitView>();
     ;
     int i = 0;
     while (i < 28)
     {
         data.Add(new CampaignConflitView
         {
             TypeCode = i.ToString(),
             CampaignId = Guid.NewGuid(),
             CampaignName = ch[i].ToString(),
             CampaignSubtypeId = Guid.NewGuid(),
             CampaignApprovalStatus = true.ToString(),
             ProposedStartDate = DateTime.Now.AddDays(i),
             ProposedEndDate = DateTime.Now.AddDays(i),
             ConflitContacts = i,
             ListId = Guid.NewGuid(),
             ListName = ch[i].ToString(),
             CampaignSubtypeName = "dd"
         });
         i++;
     }
     return data.AsEnumerable().OrderBy(r => r.CampaignName).ToList();
 }
Example #9
0
        public static IEnumerable<Tuple<string, string>> Swummarize(string directoryPath)
        {
            var swummaries = new List<Tuple<string, string>>();

            var srcmlMethods = MethodExtractor.ExtractAllMethodsFromDirectory(directoryPath);

            foreach (var methodDef in srcmlMethods)
            {
                // Extract SUnit Statements from MethodDefinition
                var statements = SUnitExtractor.ExtractAll(methodDef).ToList();

                // Translate Statements into SUnits
                List<SUnit> sunits = statements.ConvertAll(
                            new Converter<Statement, SUnit>(SUnitTranslator.Translate));

                // Generate text from SUnits
                List<string> sentences = sunits.ConvertAll(
                            new Converter<SUnit, string>(TextGenerator.GenerateText));

                // Collect text and summarize
                var methodDocument = String.Join<string>("\n", sentences);

                // TEMP: Just use full set of sentences for now. Don't use Summarizer.
                //       Maybe set a flag for this.
                //var summary = Summarizer.Summarize(methodDocument);
                var summary = methodDocument;

                // Add swummary to collection with its full method name
                var methodName = methodDef.GetFullName();
                swummaries.Add(new Tuple<string, string>(methodName, summary));
            }

            return swummaries.AsEnumerable();
        }
Example #10
0
        public static Task<IEnumerable<LocationDescription>> GetLocationsAndBusiness(string query, GeoCoordinate currentUserPosition)
        {
            var locations = new List<LocationDescription>();

            return GetBingLocations(query, currentUserPosition).ContinueWith(
                bingContinuation =>
                {
                    return GetGooglePlaces(query, currentUserPosition).ContinueWith(
                        googleContinuation =>
                        {
                            if (bingContinuation.IsCompleted)
                            {
                                locations.AddRange(bingContinuation.Result);
                            }

                            if (googleContinuation.IsCompleted)
                            {
                                locations.AddRange(googleContinuation.Result);
                            }

                            locations = SortLocationDescriptionsByDistance(locations, currentUserPosition);

                            return locations.AsEnumerable();
                        });
                }).Unwrap();
        }
Example #11
0
        public IEnumerable<PartDetails> GetItemNumbers(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<PartDetails> itemnumberList = new List<PartDetails>();
            try
            {
                DataTable resultTable = axHelper.GetItemNumbersList(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    PartDetails partObject = new PartDetails();
                    partObject.ItemNumber = row["ItemNumber"].ToString();
                    partObject.ProductName = row["ProductName"].ToString();
                    partObject.ProductSubType = row["ProductSubType"].ToString();
                    itemnumberList.Add(partObject);

                }
            }
            catch (Exception e)
            {
                throw e;

            }
            return itemnumberList.AsEnumerable<PartDetails>();
        }
 public static IEnumerable<FileInfo> ParseBISolutionFile(this FileInfo source)
 {
     var biFiles = new List<FileInfo>();
     biFiles.AddRange(source.GetSSISPackages());
     biFiles.AddRange(source.GetSqlScripts());
     return biFiles.AsEnumerable();
 }
Example #13
0
        public override IEnumerable<Row> Execute(IEnumerable<Row> rows)
        {
            //Console.WriteLine("Truncating Table");
            //TruncateTable(this.TargetTable, this.ConnectionStringSettings.ConnectionString);
            Console.WriteLine("Current feed data processing started");
            var rowsToBeInserted = new List<Row>();
            foreach (var row in rows)
            {
                var array = row["AWord"].ToString().Split(',');
                var i = 1;
                row["Name"] = array[i++];
                row["Description"] = array[i++];
                row["ImagePath"] = array[i++];
                row["PromotionId"] = array[i++];
                row["RAM"] = array[i++];
                row["Harddisk"] = array[i++];
                row["Processor"] = array[i++];
                row["Display"] = array[i++];
                rowsToBeInserted.Add(row);
            }
            //Bulk insert data
            var results = base.Execute(rowsToBeInserted.AsEnumerable());

            //Display all the rows to be inserted
            DisplayRows(rowsToBeInserted);

            Console.WriteLine("Feeds are processed");
            return results;
        }
 protected override Job TryGiveTerminalJob(Pawn pawn)
 {
     if (!(pawn is Droid))
     {
         return null;
     }
     Droid droid = (Droid)pawn;
     if (!droid.Active)
         return null;
     //Check the charge level
     if (droid.TotalCharge < droid.MaxEnergy * chargeThreshold)
     {
         IEnumerable<Thing> chargers;
         List<Thing> list = new List<Thing>();
         foreach(var c in Find.ListerBuildings.AllBuildingsColonistOfClass<Building_DroidChargePad>())
         {
             list.Add((Thing)c);
         }
         chargers = list.AsEnumerable();
         Predicate<Thing> pred = (Thing thing) => { return ((Building_DroidChargePad)thing).IsAvailable(droid); };
         Thing target = GenClosest.ClosestThing_Global_Reachable(pawn.Position, chargers, PathEndMode.OnCell, TraverseParms.For(pawn), distance, pred);
         if (target != null)
         {
             return new Job(DefDatabase<JobDef>.GetNamed("MD2ChargeDroid"), new TargetInfo(target));
         }
     }
     return null;
 }
Example #15
0
        public IEnumerable<FailureCode> GetFailureCode(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<FailureCode> failureCodeList = new List<FailureCode>();
            try
            {
                DataTable resultTable = axHelper.GetFailureCodeList(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    FailureCode failureCodeObject = new FailureCode();
                    failureCodeObject.FailureCodeNo = row["FailureCode"].ToString();
                    failureCodeObject.FailureDescription = row["FailureCode"].ToString() + " - " + row["FailureDescription"].ToString();

                    failureCodeList.Add(failureCodeObject);

                }
            }
            catch (Exception e)
            {
                throw e;

            }
            return failureCodeList.AsEnumerable<FailureCode>();
        }
        public IEnumerable<SpecialtyCode> GetSpecialCodes(string userName, string TransactionId)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<SpecialtyCode> SpecialtyCodeList = new List<SpecialtyCode>();
            try
            {

                DataTable resultTable = axHelper.GetSpecialityCodeList(userName, TransactionId.ToString());

                foreach (DataRow row in resultTable.Rows)
                {
                    SpecialtyCode SpecialtyCodeObject = new SpecialtyCode();
                    SpecialtyCodeObject.SpecialityCodeNo = row["SpecialityCode"].ToString();
                    SpecialtyCodeObject.SpecialityDescription =  row["SpecialityDescription"].ToString();

                    SpecialtyCodeList.Add(SpecialtyCodeObject);

                }

            }
            catch (Exception e)
            {
                throw e;
            }
            return SpecialtyCodeList.AsEnumerable<SpecialtyCode>();
        }
Example #17
0
        IEnumerable<Price> IMarketPriceRepository.FetchPrices(IEnumerable<Item> items, SolarSystem system)
        {
            string urlData = "";
            foreach (Item item in items)
            {
                urlData += "typeid=" + item.ApiId + "&";
            }
            urlData += "usesystem=" + system.ApiId;

            XDocument doc = XDocument.Load(String.Format(String.Format(_priceURL, urlData)));
            IEnumerable<XElement> itemElements = doc.Element("evec_api").Element("marketstat").Elements("type");
            IList<Price> prices = new List<Price>();
            foreach (XElement itemElement in itemElements)
            {
                string itemApi = itemElement.Attribute("id").Value;
                Item currentItem = items.Single(i => i.ApiId.Equals(itemApi));
                Price price = new Price
                {
                    Item = currentItem,
                    SolarSystem = system,
                    Buy = Double.Parse(itemElement.Element("buy").Element("max").Value, CultureInfo.InvariantCulture),
                    Sell = Double.Parse(itemElement.Element("sell").Element("min").Value, CultureInfo.InvariantCulture),
                    Date = DateTime.Today
                };
                prices.Add(price);
            }
            return prices.AsEnumerable();
        }
        public static IEnumerable<RecipeDef> AllRecipes()
        {
            List<RecipeDef> list = new List<RecipeDef>();

            foreach (var def in DefDatabase<ManufacturingPlantRecipesDef>.AllDefs)
            {
                foreach (var recipe in def.recipes)
                {
                    list.Add(recipe);
                }
            }
            foreach (var def in DefDatabase<RecipeDef>.AllDefs.Where(d => d.workSkill != null && (d.workSkill == SkillDefOf.Crafting || d.workSkill == SkillDefOf.Cooking || d.workSkill == SkillDefOf.Artistic)))
            {
                if(!list.Contains(def))
                    list.Add(def);
            }
            foreach (var def in DefDatabase<ManufacturingPlantRecipesDef>.AllDefs)
            {
                if (def.blackList != null)
                {
                    foreach (var recipe in def.blackList)
                    {
                        if (list.Contains(recipe))
                        {
                            list.Remove(recipe);
                        }
                    }
                }
            }
            return list.AsEnumerable();
        }
        //- To get the GetTechnicians for Check In Page
        public IEnumerable<ServiceTechnician> GetTechnicians(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<ServiceTechnician> techniciansList = new List<ServiceTechnician>();
            try
            {
                DataTable resultTable = axHelper.GetTechnicians(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    ServiceTechnician technicianObject = new ServiceTechnician();
                    technicianObject.ServiceTechnicianName = row["Name"].ToString();
                    technicianObject.ServiceTechnicianNo = row["Number"].ToString();

                    techniciansList.Add(technicianObject);

                }
            }
            catch (Exception ex)
            {
                throw ex;

            }
            return techniciansList.AsEnumerable<ServiceTechnician>();
        }
Example #20
0
        public static IReparentingHost FindReparentingHost(this IControl control)
        {
            var tp = control.TemplatedParent;
            var chain = new List<IReparentingHost>();

            while (tp != null)
            {
                var reparentingHost = tp as IReparentingHost;
                var styleable = tp as IStyleable;

                if (reparentingHost != null)
                {
                    chain.Add(reparentingHost);
                }

                tp = styleable?.TemplatedParent ?? null;
            }

            foreach (var reparenting in chain.AsEnumerable().Reverse())
            {
                if (reparenting.WillReparentChildrenOf(control))
                {
                    return reparenting;
                }
            }

            return null;
        }
 public static IEnumerable<pageMenuGroupId_and_pageMenuId> get_myPageMenuGroupIds_and_pageMenuIds(int _appId)
 {
     DBFactory db;
     SqlDataReader rdr;
     List<pageMenuGroupId_and_pageMenuId> data = null;
     try
     {
         db = new DBFactory("CCATDBEntities");
         rdr = db.ExecuteReader("MSI_GetMenuDetails", new SqlParameter("@appId", _appId));
         data = new List<pageMenuGroupId_and_pageMenuId>();
         pageMenuGroupId_and_pageMenuId record;
         while (rdr.Read())
         {
             record = new pageMenuGroupId_and_pageMenuId();
             record.listOrder = Convert.ToInt32(rdr["listOrder"].ToString());
             record.pageMenuGroupId = Convert.ToInt32(rdr["pageMenuGroupId"].ToString());
             record.pageMenuId = Convert.ToInt32(rdr["pageMenuId"].ToString());
             data.Add(record);
         }
         //Close the datareader
         rdr.Close();
     }
     catch (Exception ex)
     {
         throw new Exception("Exception in DataQueries.get_myPageMenuGroupIds_and_pageMenuIds:" + ex.Message);
     }
     return data.AsEnumerable<pageMenuGroupId_and_pageMenuId>();
 }
Example #22
0
        //- To get the GetCustomers for Check In Page
        public IEnumerable<Customer> GetCustomers(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<Customer> customerList = new List<Customer>();
            try
            {
                DataTable resultTable = axHelper.GetCustomers(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    Customer customerObject = new Customer();
                    customerObject.CustomerAccount = row["CustomerAccount"].ToString();
                    customerObject.CustomerName = row["CustomerAccount"].ToString() + " - " + row["CustomerName"].ToString();

                    customerList.Add(customerObject);

                }
            }
            catch (Exception e)
            {
                throw e;

            }
            return customerList.AsEnumerable<Customer>();
        }
Example #23
0
 public JsonResult CreateJson(List<TaskViewModel> viewTasks, List<LinkViewModel> viewLinks)
 {
     var jsonData = new
     {
         // create tasks array
         data = (
             from t in viewTasks.AsEnumerable()
             select new
             {
                 id = t.TaskId,
                 text = t.Text,
                 start_date = t.StartDate.ToString("u"),
                 duration = t.Duration,
                 order = t.SortOrder,
                 progress = t.Progress,
                 open = true,
                 parent = t.ParentId,
                 type = (t.Type != null) ? t.Type : String.Empty,
                 holder = (t.Holder != null) ? t.Holder : String.Empty
             }
         ).ToArray(),
         // create links array
         links = (
             from l in viewLinks.AsEnumerable()
             select new
             {
                 id = l.LinkId,
                 source = l.SourceTaskId,
                 target = l.TargetTaskId,
                 type = l.Type
             }
         ).ToArray()
     };
     return new JsonResult { Data = jsonData, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
 }
Example #24
0
        // GET: Employees
        public ActionResult Index()
        {
            //get the token from the cache.
            string signedInUserID = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;

            ADALTokenCache UserTokenCache = new ADALTokenCache(signedInUserID);

            List<TokenCacheItem> items = UserTokenCache.ReadItems().Where(tc => tc.Resource == "https://graph.microsoft.com").ToList();

            string myAccessToken = items[0].AccessToken;

            //make a HTTPClient request for the information and include the token.
            // thanks to post Vardhaman Deshpande.
            string resourceUrl = string.Format("https://graph.microsoft.com/beta/{0}/users", ConfigurationManager.AppSettings["ida:Domain"]);
            List<Employee> json = new List<Employee>();

            using (var client = new HttpClient())
            {
                using (var request = new HttpRequestMessage(HttpMethod.Get, resourceUrl))
                {
                    request.Headers.Add("Authorization", "Bearer " + myAccessToken);
                    request.Headers.Add("Accept", "application/json;odata.metadata=minimal");
                    using (var response = client.SendAsync(request).Result)
                    {
                        var jsonResult = JObject.Parse(response.Content.ReadAsStringAsync().Result);
                        json = JsonConvert.DeserializeObject<List<Employee>>(jsonResult["value"].ToString());
                    }
                }
            }

            return View(json.AsEnumerable<Employee>());
        }
        public static IEnumerable<EventViewModel> ConvertToEventViewModel(this List<EventfulEvent> EventfulEvents)
        {
            List<EventViewModel> model = new List<EventViewModel>();

            foreach (EventfulEvent events in EventfulEvents)
            {
                string url = null;

                var images = events.image as System.Xml.XmlNode[];

                if (images != null)
                {
                    url = images.Any(e => string.Equals(e.Name, "medium", StringComparison.InvariantCultureIgnoreCase)) ?
                        images.Single(e => string.Equals(e.Name, "medium", StringComparison.InvariantCultureIgnoreCase)).InnerText : null;
                }

                model.Add(new EventViewModel
                        {
                            EventfulId = events.id,
                            Author = events.owner,
                            Location = events.venue_address,
                            StartDateTime = DateTime.Parse(events.start_time),
                            Title = events.title,
                            IsEventfultEvent = true,
                            ImageURI = url
                        });
            }

            return model.AsEnumerable();
        }
        //- To get the GetWOClassification for Check In Page
        public IEnumerable<WOClassification> GetWOClassification(string userName)
        {
            IAXHelper axHelper = ObjectFactory.GetInstance<IAXHelper>();
            List<WOClassification> woClassificationList = new List<WOClassification>();
            try
            {
                DataTable resultTable = axHelper.GetWOClassificationList(userName);

                foreach (DataRow row in resultTable.Rows)
                {
                    WOClassification woObject = new WOClassification();
                    woObject.WOClassificationCode = row["WOCode"].ToString();
                    woObject.WOClassificationName = row["WOCode"].ToString() + " - " + row["WODescription"].ToString();

                    woClassificationList.Add(woObject);

                }
            }
            catch (Exception e)
            {
                throw e;

            }

            return woClassificationList.AsEnumerable<WOClassification>();
        }
Example #27
0
        public override void Execute()
        {
            List<XElement> xList = new List<XElement>();

            for(int i=0; i < QueueState.Count();i++)
            {
                IBuilding b = QueueState.ElementAt(i).Key;
                IBuildingFunction f = BuildingState.Where( x => x.Value == b).FirstOrDefault().Key;
                ITimer t = QueueState.ElementAt(i).Value;

                XElement xEl = new XElement("Queue",
                    new XElement("Building",
                        new XElement("Id", b.Id),
                        new XElement("Time", t.Get()),
                        new XElement("Function",f.Name),
                        new XElement("X",b.Tile.X),
                        new XElement("Z",b.Tile.Z)
                        ));
                xList.Add(xEl);
            }

            XElement New = new XElement("QueueSystem",
               xList.AsEnumerable()
                   );
            Debug.Log(New.ToString());
            GameData.SaveQueueState(New);
        }
        protected override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node)
        {
            var newTypeDeclaration = (TypeDeclarationSyntax)base.VisitClassDeclaration(node);

            if (_fields.Count > 0 || _methods.Count > 0)
            {
                var members = new List<MemberDeclarationSyntax>(newTypeDeclaration.Members);
                members.InsertRange(0, _methods);
                members.InsertRange(0, _fields);

                return ((ClassDeclarationSyntax)newTypeDeclaration).Update(
                    newTypeDeclaration.Attributes,
                    newTypeDeclaration.Modifiers,
                    newTypeDeclaration.Keyword,
                    newTypeDeclaration.Identifier,
                    newTypeDeclaration.TypeParameterListOpt,
                    newTypeDeclaration.BaseListOpt,
                    newTypeDeclaration.ConstraintClauses,
                    newTypeDeclaration.OpenBraceToken,
                    Syntax.List(members.AsEnumerable()),
                    newTypeDeclaration.CloseBraceToken,
                    newTypeDeclaration.SemicolonTokenOpt);
            }

            return newTypeDeclaration;
        }
        public IEnumerable<Product> getProduct(IEnumerable<ProductModel> data)
        {
            var list = new List<Product>();
            if (data.Count() > 0)
            {
                foreach (var model in data)
                {
                    var prod = new Product();

                    if (model != null)
                    {
                        prod.CategoryId = model.CategoryId;
                        prod.Discontinued = model.Discontinued;
                        prod.Name = model.Name;
                        prod.ProductCategory = getCategory(model.ProductCategory);
                        prod.ProductId = model.ProductId;
                        prod.ProductSupplier = getSupplier(model.ProductSupplier);
                        prod.QuantityPerUnit = model.QuantityPerUnit;
                        prod.ReorderLevel = model.ReorderLevel;
                        prod.SupplierId = model.SupplierId;
                        prod.UnitPrice = model.UnitPrice;
                        prod.UnitsInStock = model.UnitsInStock;
                        prod.UnitsOnOrder = model.UnitsOnOrder;
                    }
                    list.Add(prod);
                }
            }
            return list.AsEnumerable();
        }
        /// <summary>
        /// Email seding regrading process
        /// </summary>
        public void SendingMail()
        {
            var pendingEmailQueue = EmailUtility.GetPendingEmailQueue();
            foreach (var queue in pendingEmailQueue)
            {
                queue.EmailContent = GetEmailContent(queue);
                try
                {
                    List<string> to = new List<string>();
                    to.Add(queue.Receiver);

                    Tuple<bool, string> mailResult = EmailUtility.SendEmail(EmailUtility.FromEmail, to.AsEnumerable(), null, null, queue.ProcessName, queue.EmailContent, null);
                    if (mailResult.Item1 == true)
                    {
                        EmailLogVM emailLogVM = new EmailLogVM();
                        emailLogVM.Process = queue.Process;
                        emailLogVM.EmailBody = queue.EmailContent;
                        emailLogVM.Receiver = queue.Receiver;
                        emailLogVM.SentTime = System.DateTime.Now;
                        EmailUtility.SaveEmailLog(emailLogVM, queue.Id);
                    }
                    else
                    {
                        queue.ErrorStatus = mailResult.Item2;
                        EmailUtility.UpdateEmailQueue(queue);
                    }
                }
                catch (Exception ex)
                {
                    queue.ErrorStatus = ex.Message;
                    EmailUtility.UpdateEmailQueue(queue);
                }
            }
        }