internal static MethodInvoker Create(MethodInfo method, object target)
        {

            var args = new List<Type>(method.GetParameters().Select(p => p.ParameterType));
            Type delegateType;

            var returnMethodInvoker = new MethodInvoker
            {
                ParameterTypeList = args.ToList(),
                ParameterCount = args.Count,
                ReturnType = method.ReturnType,
                MethodName = method.Name
            };


            if (method.ReturnType == typeof(void))
            {
                delegateType = Expression.GetActionType(args.ToArray());
            }
            else
            {
                args.Add(method.ReturnType);
                delegateType = Expression.GetFuncType(args.ToArray());
            }

            returnMethodInvoker.MethodDelegate = method.CreateDelegate(delegateType, target);

            return returnMethodInvoker;

        }
Exemple #2
1
        static void Main(string[] args)
        {
            var names = Regex.Split(Console.ReadLine(), "\\s+").ToList();
            var predicates = new Dictionary<string, Func<string, string, bool>>
            {
                { "StartsWith", (name, substring) => name.StartsWith(substring) },
                { "EndsWith", (name, substring) => name.EndsWith(substring) },
                { "Length", (name, length) => name.Length.ToString().Equals(length) }
            };

            string command;
            while ((command = Console.ReadLine()) != "Party!")
            {
                if (names.Count == 0)
                {
                    break;
                }

                var parameters = Regex.Split(command, "\\s+");

                var action = parameters[0];
                var condition = parameters[1];
                var conditionOperator = parameters[2];

                var filteredNames = new List<string>();
                foreach (string name in names)
                {
                    if (predicates[condition](name, conditionOperator))
                    {
                        switch (action)
                        {
                            case "Double":
                                filteredNames.Add(name);
                                filteredNames.Add(name);
                                break;
                            case "Remove":
                                // Not adding jack.
                                break;
                            default:
                                throw new NotImplementedException();
                        }
                    }
                    else
                    {
                        filteredNames.Add(name);
                    }
                }

                names = filteredNames.ToList();
            }

            if (names.Count != 0)
            {
                Console.WriteLine($"{string.Join(", ", names)} are going to the party!");
            }
            else
            {
                Console.WriteLine("Nobody is going to the party!");
            }
        }
        public static List<List<SubCalendarEvent>> GenerateListOfSubCalendarEvent(List<List<SubCalendarEvent>> MyEncasingList)
        {
            //Trying To Spread out arrray
            List<List<SubCalendarEvent>> ListOfList = new List<List<SubCalendarEvent>>();
            List<List<SubCalendarEvent>> ListOfListCopy = ListOfList.ToList();
            int i = 0;
            for (i = 0; i < MyEncasingList.Count; i++)
            {
                ListOfListCopy = ListOfList.ToList();
                List<List<SubCalendarEvent>> UpdatedListOfList = new List<List<SubCalendarEvent>>();
                foreach (SubCalendarEvent MySubCalendarEvent in MyEncasingList[i])//ListOfList.CopyTo(MyOtherArray);
                {
                    //Console.WriteLine("other {0}\n", MyNumber);
                    if (ListOfListCopy.Count == 0)
                    {
                        UpdatedListOfList.Add(CreateNewListAndAppend(MySubCalendarEvent, new List<SubCalendarEvent>()));
                    }
                    foreach (List<SubCalendarEvent> MyUpdatedSingleList in ListOfListCopy)
                    {
                        if (!isSubCalendarEventAlreadyInList(MySubCalendarEvent, MyUpdatedSingleList))
                        {
                            UpdatedListOfList.Add(CreateNewListAndAppend(MySubCalendarEvent, MyUpdatedSingleList));
                        }

                    }
                }
                ListOfList = UpdatedListOfList;
            }
            return ListOfList;
        }
 public static List<List<TimeSpan>> GenerateListOfTimeSpan(List<List<TimeSpan>> MyEncasingList)
 {
     //Trying To Spread out arrray
     List<List<TimeSpan>> ListOfList = new List<List<TimeSpan>>();
     List<List<TimeSpan>> ListOfListCopy = ListOfList.ToList();
     int i = 0;
     for (i = 0; i < MyEncasingList.Count; i++)
     {
         ListOfListCopy = ListOfList.ToList();
         List<List<TimeSpan>> UpdatedListOfList = new List<List<TimeSpan>>();
         foreach (TimeSpan MyTimeSpan in MyEncasingList[i])//ListOfList.CopyTo(MyOtherArray);
         {
             //Console.WriteLine("other {0}\n", MyNumber);
             if (ListOfListCopy.Count == 0)
             {
                 UpdatedListOfList.Add(CreateNewListAndAppend(MyTimeSpan, new List<TimeSpan>()));
             }
             foreach (List<TimeSpan> MyUpdatedSingleList in ListOfListCopy)
             {
                 UpdatedListOfList.Add(CreateNewListAndAppend(MyTimeSpan, MyUpdatedSingleList));
             }
         }
         ListOfList = UpdatedListOfList;
     }
     return ListOfList;
 }
        public void Start()
        {
            List<IWebSocketConnection> sockets = new List<IWebSocketConnection>();
            Fleck.WebSocketServer server = new Fleck.WebSocketServer("ws://127.0.0.1:8181");

            server.Start(socket =>
                {
                    socket.OnOpen = () =>
                        {
                            Console.WriteLine("Connection open.");
                            sockets.Add(socket);
                        };
                    socket.OnClose = () =>
                        {
                            Console.WriteLine("Connection closed.");
                            sockets.Remove(socket);
                        };
                    socket.OnMessage = message =>
                        {
                            Console.WriteLine("Client says: " + message);
                            sockets.ToList().ForEach(s => s.Send(" client says:" + message));
                        };

                });

            string input = Console.ReadLine();
            while (input != "exit")
            {
                sockets.ToList().ForEach(s => s.Send(input));
                input = Console.ReadLine();
            }
        }
        public CollectionQuerySimplification(List<object> coll)
        {
            var x = coll.Select(element => element as object).Any(element => element != null);  // Noncompliant use OfType
            x = coll.Select((element) => ((element as object))).Any(element => (element != null) && CheckCondition(element) && true);  // Noncompliant use OfType
            var y = coll.Where(element => element is object).Select(element => element as object); // Noncompliant use OfType
            var y = coll.Where(element => element is object).Select(element => element as object[]);
            y = coll.Where(element => element is object).Select(element => (object)element); // Noncompliant use OfType
            x = coll.Where(element => element == null).Any();  // Noncompliant use Any([expression])
            var z = coll.Where(element => element == null).Count();  // Noncompliant use Count([expression])
            z = Enumerable.Count(coll.Where(element => element == null));  // Noncompliant
            z = Enumerable.Count(Enumerable.Where(coll, element => element == null));  // Noncompliant
            y = coll.Select(element => element as object);
            y = coll.ToList().Select(element => element as object); // Noncompliant
            y = coll
                .ToList()  // Noncompliant
                .ToArray() // Noncompliant
                .Select(element => element as object);

            var z = coll
                .Select(element => element as object)
                .ToList();

            var c = coll.Count(); //Noncompliant
            c = coll.OfType<object>().Count();

            x = Enumerable.Select(coll, element => element as object).Any(element => element != null); //Noncompliant
            x = Enumerable.Any(Enumerable.Select(coll, element => element as object), element => element != null); //Noncompliant
        }
        public IList<Flight> ParseFlights(HtmlNode documentNode)
        {
            var element = documentNode.SelectNodes("//table[@class='resultTable dealsResults']/tbody//tr[position()>1]");

            IEnumerable<Flight> flights = new List<Flight>();

            if (element == null)
                return flights.ToList();

            flights = from row in element
                      where row.HasChildNodes
                      let departureAirport = row.ChildNodes[1].InnerText
                      let destination = row.ChildNodes[3].InnerText
                      let departureDate = row.ChildNodes[5].SelectSingleNode("ul/li").InnerText
                      let returnDate = row.ChildNodes[5].SelectSingleNode("ul/li[position()>1]").InnerText
                      let departFlightTime = row.ChildNodes[7].SelectSingleNode("ul/li/ul/li").InnerText
                      let returnFlightTime = row.ChildNodes[7].SelectSingleNode("ul/li[position()>1]/ul/li").InnerText
                      let noOfNights = row.ChildNodes[9].InnerText
                      let departureAirportCode = row.ChildNodes[13].SelectSingleNode("fieldset/input[@id='depAP']").GetAttributeValue("value", "N/a")
                      let arrivalAirportCode = row.ChildNodes[13].SelectSingleNode("fieldset/input[@id='retAP']").GetAttributeValue("value", "N/a")
                      let seats = row.SelectSingleNode("td[@class='seatsLeft']").ChildNodes.Count > 2 ? row.SelectSingleNode("td[@class='seatsLeft']/div").InnerText : "0"
                      select new Flight
                          {
                              DepartureAirport = new Airport { Code = departureAirportCode, Name = departureAirport },
                              ArrivalAirport = new Airport { Code = arrivalAirportCode, Name = destination },
                              ArrivalDate = (departureDate + " " + departFlightTime + ":00").ToFormattedDateString(),
                              SeatsLeft = seats.ToInt32(),
                              DepartureDate =(returnDate + " " + returnFlightTime + ":00").ToFormattedDateString(),
                              NoOfNights = noOfNights.ToInt32()
                          };

            return flights.ToList();
        }
Exemple #8
0
        static void Test1()
        {
            FleckLog.Level = LogLevel.Debug;
            var allSockets = new List<IWebSocketConnection>();
            var server = new WebSocketServer("ws://localhost:8181");
            server.Start(socket =>
                {
                    socket.OnOpen = () =>
                        {
                            Console.WriteLine("Open!");
                            allSockets.Add(socket);
                        };
                    socket.OnClose = () =>
                        {
                            Console.WriteLine("Close!");
                            allSockets.Remove(socket);
                        };
                    socket.OnMessage = message =>
                        {
                            Console.WriteLine(message);
                            allSockets.ToList().ForEach(s => s.Send("Echo: " + message));
                        };
                });

            var input = Console.ReadLine();
            while (input != "exit")
            {
                foreach (var socket in allSockets.ToList())
                {
                    socket.Send(input);
                }
                input = Console.ReadLine();
            }
        }
Exemple #9
0
 private static void gener(int num, int len)
 {
     StringBuilder k1 = new StringBuilder();
     for (int a = 0; a < len; a++)
     {
         k1.Append(num.ToString());
     }
     List<int> lst1 = new List<int>();
     List<List<int>> depo = new List<List<int>>();
     for (int a = 0; a < num; a++)
     {
         lst1.Add(a);
     }
     long k = long.Parse(k1.ToString());
     for (int a = 0; a < k; a++)
     {
         List<int> lst = new List<int>();
         for (int z = 0; z < a.ToString().Length; z++)
         {
             lst.Add(int.Parse(a.ToString().ToCharArray()[z].ToString()));
         }
         lst.Sort();
         bool ok = true;
         if (lst.ToList().Distinct().Count() == lst.ToList().Count())
         {
             for (int b = 0; b < lst.Count; b++)
             {
                 if (!lst1.Contains(lst[b]))
                 {
                     ok = false;
                 }
             }
             if (ok)
             {
                 bool ko = true;
                 for (int c = 0; c < depo.Count; c++)
                 {
                     if (lst == (depo[c]))
                     {
                         ko = false;
                     }
                 }
                 if (ko)
                 {
                     depo.Add(lst);
                 }
             }
         }
     }
     List<List<int>> depo1 = new List<List<int>>(depo.Distinct().ToList());
     for (int a = 0; a < depo1.Count; a++)
     {
         for (int b = 0; b < depo1[a].Count; b++)
         {
             Console.Write("{0} ", depo1[a][b]);
         }
         Console.WriteLine();
     }
 }
	public void WhenAddingParams_ThenAddsToList()
	{
		ICollection<int> ints = new List<int>(new[] { 1, 2, 3 });

		ints.AddRange(4, 5);

		Assert.Equal(4, ints.ToList()[3]);
		Assert.Equal(5, ints.ToList()[4]);
	}
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json; charset=utf-8";

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            NFMT.User.BLL.CorporationBLL bll = new NFMT.User.BLL.CorporationBLL();
            result = bll.LoadAuthSelfCorp(user);

            List<NFMT.User.Model.Corporation> corps = new List<NFMT.User.Model.Corporation>();

            if (result.ResultStatus == 0)
            {
                corps = result.ReturnValue as List<NFMT.User.Model.Corporation>;
            }

            //合约过滤
            int contractId = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["ContractId"]))
                int.TryParse(context.Request.QueryString["ContractId"], out contractId);

            //合约抬头过滤
            IEnumerable<NFMT.User.Model.Corporation> ecs = new List<NFMT.User.Model.Corporation>();
            if (contractId > 0)
            {
                NFMT.Contract.BLL.ContractCorporationDetailBLL corpBLL = new NFMT.Contract.BLL.ContractCorporationDetailBLL();
                result = corpBLL.LoadCorpListByContractId(user, contractId,true);
                if (result.ResultStatus != 0)
                    context.Response.End();

                List<NFMT.Contract.Model.ContractCorporationDetail> contractCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
                var corpIds = contractCorps.Select(c => c.CorpId).ToList();
                ecs = corps.Where(c => corpIds.Contains(c.CorpId));
                corps = ecs.ToList();
            }

            int subId = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["SubId"]))
                int.TryParse(context.Request.QueryString["SubId"], out subId);
            if (subId > 0)
            {
                NFMT.Contract.BLL.SubCorporationDetailBLL subCorpBLL = new NFMT.Contract.BLL.SubCorporationDetailBLL();
                result = subCorpBLL.Load(user, subId, true);
                if (result.ResultStatus != 0)
                    context.Response.End();

                List<NFMT.Contract.Model.SubCorporationDetail> subCorps = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
                var corpIds = subCorps.Select(c => c.CorpId).ToList();
                ecs = corps.Where(c => corpIds.Contains(c.CorpId));
                corps = ecs.ToList();
            }

            string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(corps);
            context.Response.Write(jsonStr);
        }
Exemple #12
0
        static void Main(string[] args)
        {
            FleckLog.Level = LogLevel.Info;
            var allsockets = new List<IWebSocketConnection>();
            var server = new WebSocketServer("ws://localhost:8181");

            server.Start(socket =>
            {
                socket.OnOpen = () =>
                    {   //See socket.ConnectionInfo.* for additional informations
                        Console.WriteLine(String.Empty);
                        Console.WriteLine("[NEW CLIENT CONNECTION]======================");
                        Console.WriteLine("GUID: " + socket.ConnectionInfo.Id);
                        Console.WriteLine("IP: " + socket.ConnectionInfo.ClientIpAddress);
                        Console.WriteLine("Port: " + socket.ConnectionInfo.ClientPort);
                        Console.WriteLine("=============================================");
                        Console.WriteLine(String.Empty);
                        allsockets.Add(socket);

                    };

                socket.OnClose = () =>
                {
                        Console.WriteLine(String.Empty);
                        Console.WriteLine("[DISCONNECTED CLIENT]=======================");
                        Console.WriteLine("GUID: " + socket.ConnectionInfo.Id);
                        Console.WriteLine("IP: " + socket.ConnectionInfo.ClientIpAddress);
                        Console.WriteLine("Port: " + socket.ConnectionInfo.ClientPort);
                        Console.WriteLine("=============================================");
                        Console.WriteLine(String.Empty);
                        allsockets.Remove(socket);
                    };

                socket.OnMessage = (message) =>
                {
                    //TODO: Json.Net Deserialize
                    Console.WriteLine("[JSON MESSAGE] " + message);
                    allsockets.ToList().ForEach(s => s.Send(message));
                };
            });

            var input = Console.ReadLine();
            while (input != "exit")
            {
                foreach (var socket in allsockets.ToList())
                {
                    socket.Send(input);
                }

                input = Console.ReadLine();
            }
        }
Exemple #13
0
        public int LoadFromCsv(string fileName, int tickerCode)
        {
            var storeThread = new DBStoreThread(true);
            var candles = new List<CandleData>();
            var totalStored = 0;

            using (var sr = new StreamReader(fileName, Encoding.GetEncoding(1252)))
            {
                while (!sr.EndOfStream)
                {
                    var line = sr.ReadLine();
                    if (string.IsNullOrEmpty(line)) continue;
                    var parts = line.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
                    // date - time - o-h-l-c
                    if (parts.Length < 6) continue;
                    DateTime time;
                    if (!DateTime.TryParseExact(parts[0] + " " + parts[1],
                                                "yyyy.MM.dd HH:mm", CultureProvider.Common, DateTimeStyles.AssumeLocal,
                                                out time))
                        continue;
                    var open = parts[2].ToFloatUniformSafe() ?? 0;
                    var high = parts[3].ToFloatUniformSafe() ?? 0;
                    var low = parts[4].ToFloatUniformSafe() ?? 0;
                    var close = parts[5].ToFloatUniformSafe() ?? 0;

                    if (open == 0 || high == 0 || low == 0 || close == 0) continue;
                    candles.Add(new CandleData(open, high, low, close, time, time.AddMinutes(1)));
                    if (candles.Count > BufferSize)
                    {
                        storeThread.PushQuotes(new Dictionary<int, List<CandleData>>
                            { { tickerCode, candles.ToList() } });
                        totalStored += candles.Count;
                        candles.Clear();
                    }
                }
                totalStored += candles.Count;
                if (candles.Count > 0)
                    storeThread.PushQuotes(new Dictionary<int, List<CandleData>>
                        { {tickerCode, candles.ToList()} });
            }

            while (storeThread.CandlesLeftInQueue > 0)
            {
                Thread.Sleep(200);
            }
            storeThread.Stop();

            return totalStored;
        }
Exemple #14
0
 public IList <ApplicantResumePoco> GetAll(params Expression <Func <ApplicantResumePoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Applicant]
                                   ,[Resume]
                                   ,[Last_Updated]
                               FROM [dbo].[Applicant_Resumes]"
         };
         var list = new List <ApplicantResumePoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new ApplicantResumePoco
             {
                 Id          = (Guid)reader["Id"],
                 Applicant   = (Guid)reader["Applicant"],
                 Resume      = reader["Resume"].ToString(),
                 LastUpdated = !Convert.IsDBNull(reader["Last_Updated"])?Convert.ToDateTime(reader["Last_Updated"]):DateTime.MinValue
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
Exemple #15
0
 public IList <ApplicantJobApplicationPoco> GetAll(params Expression <Func <ApplicantJobApplicationPoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Applicant]
                                   ,[Job]
                                   ,[Application_Date]
                                   ,[Time_Stamp]
                               FROM [dbo].[Applicant_Job_Applications]"
         };
         var list = new List <ApplicantJobApplicationPoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new ApplicantJobApplicationPoco
             {
                 Id              = (Guid)reader["Id"],
                 Applicant       = (Guid)reader["Applicant"],
                 Job             = (Guid)reader["Job"],
                 ApplicationDate = Convert.ToDateTime(reader["Application_Date"]),
                 TimeStamp       = Encoding.ASCII.GetBytes(reader["Time_Stamp"].ToString())
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
 public IList <CompanyJobEducationPoco> GetAll(params Expression <Func <CompanyJobEducationPoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Job]
                                   ,[Major]
                                   ,[Importance]
                                   ,[Time_Stamp]
                               FROM [dbo].[Company_Job_Educations]"
         };
         var list = new List <CompanyJobEducationPoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new CompanyJobEducationPoco
             {
                 Id         = (Guid)reader["Id"],
                 Job        = (Guid)reader["Job"],
                 Major      = reader["Major"].ToString(),
                 Importance = (short)reader["Importance"],
                 TimeStamp  = Encoding.ASCII.GetBytes(reader["Time_Stamp"].ToString())
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
Exemple #17
0
 private StateManager GetManager(List <RuleState> states)
 {
     return(new StateManager(CurrentBlankSymb)
     {
         Table = states?.ToList() ?? Config.GenerateRules()
     });
 }
 public IList <CompanyJobSkillPoco> GetAll(params System.Linq.Expressions.Expression <Func <CompanyJobSkillPoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Job]
                                   ,[Skill]
                                   ,[Skill_Level]
                                   ,[Importance]
                                   ,[Time_Stamp]
                               FROM [dbo].[Company_Job_Skills]"
         };
         var list = new List <CompanyJobSkillPoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new CompanyJobSkillPoco
             {
                 Id         = (Guid)reader["Id"],
                 Job        = (Guid)reader["Job"],
                 Skill      = reader["Skill"].ToString(),
                 SkillLevel = reader["Skill_Level"].ToString(),
                 Importance = Convert.ToInt32(reader["Importance"]),
                 TimeStamp  = Encoding.ASCII.GetBytes(reader["Time_Stamp"].ToString())
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
        public static List <T> Concat <T>(this List <T> self, params T[] data)
        {
            var list = self?.ToList() ?? new List <T>();

            list.AddRange(data);
            return(list);
        }
		protected WorkflowComponent(string name, string description, List<Data> modelDataInputs, List<Data> modelDataOutputs, bool isAuxiliary = false, string parentName = "")
            : this(name, description, isAuxiliary, parentName)
        {
			// Call ToList() to avoid some obscure bugs introduced by aliasing of the lists
			ModelDataInputs = modelDataInputs?.ToList() ?? new List<Data>();
			ModelDataOutputs = modelDataOutputs?.ToList() ?? new List<Data>();
        }
Exemple #21
0
 public SeatingPlanForm(List <Student> students, List <ClassroomSpot> seatingPlan)
 {
     InitializeComponent();
     StudentListbox.subscribeToStudentListChangeEvent(refreshDeskCount);
     StudentListbox.updateStudentList(students);
     loadedSeatingPlan = seatingPlan?.ToList();
 }
    public virtual async Task <List <ReleaseDate> > GetReleaseDates(string nativeReleaseID, int offset)
    {
        string             uri          = $"release/dates?release_id={ (nativeReleaseID ?? throw new ArgumentNullException(nameof(nativeReleaseID))) }&include_release_dates_with_no_data=true&offset={offset}&sort_order=asc";
        List <ReleaseDate> releaseDates = await Parse <List <ReleaseDate> >(uri, "release_dates");

        return(releaseDates?.ToList());
    }
 public RoomRateGroupElement Copy()
 {
     return(new RoomRateGroupElement()
     {
         Id = Id,
         SupplierId = SupplierId,
         AvailabilityCheckId = AvailabilityCheckId,
         Price = Price?.Copy(),
         BasePrice = BasePrice?.Copy(),
         IsSpecialOffer = IsSpecialOffer,
         VisaSupportProvided = VisaSupportProvided,
         BookingRemarks = BookingRemarks,
         IsMinPrice = IsMinPrice,
         IsNonRefundable = IsNonRefundable,
         CancellationRuleIds = CancellationRuleIds?.ToList(),
         Provider = Provider,
         PaymentType = PaymentType,
         HoldTimeLimit = HoldTimeLimit,
         IsApproximatePrice = IsApproximatePrice,
         DiscountID = DiscountID,
         PriceAtDay = PriceAtDay,
         NeedAdditionalRequest = NeedAdditionalRequest,
         AdditionalInformation = AdditionalInformation?.ToDictionary(info => info.Key, info => info.Value.ToList()),
         Allotment = Allotment,
         CheckInTime = CheckInTime,
         CheckOutTime = CheckOutTime,
         GuestCitizenshipRequired = GuestCitizenshipRequired,
         Availability = Availability,
         VATInfo = VATInfo?.Copy(),
         AgencyTimeLimit = AgencyTimeLimit,
         FreeCount = FreeCount
     });
 }
 public IList <SecurityRolePoco> GetAll(params Expression <Func <SecurityRolePoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Role]
                                   ,[Is_Inactive]
                               FROM [dbo].[Security_Roles]"
         };
         var list = new List <SecurityRolePoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new SecurityRolePoco
             {
                 Id         = (Guid)reader["Id"],
                 Role       = reader["Role"].ToString(),
                 IsInactive = Convert.ToBoolean(reader["Is_Inactive"])
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
Exemple #25
0
        private List <KeyValuePair <string, string> > GetHeaderValuesWithCallSequence(List <KeyValuePair <string, string> > headerValues, string methodName)
        {
            var ret = headerValues?.ToList() ?? new List <KeyValuePair <string, string> >();

            var callSequnce = GetCallSequence();

            var actionName = HttpContextAccessor.HttpContext?.Request?.Path ?? methodName;

            callSequnce.Add(new CallSequenceHeaderModel {
                Application = AssemblyName, Action = actionName
            });

            var strCallSequence = JsonUtils.Serialize(callSequnce);

            ret.Add(new KeyValuePair <string, string>(CallSequenceKey, strCallSequence));

            var callSequenceId = GetCallSequenceIdFromContextItemsOrGenerateNew();

            if (string.IsNullOrEmpty(callSequenceId) == false)
            {
                ret.Add(new KeyValuePair <string, string>(CallSequenceIdKey, callSequenceId));
            }

            return(ret);
        }
Exemple #26
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposed != null && !disposed.EnsureCalledOnce())
            {
                log.LogTrace("Disposing (disposing:{0})".Fmt(disposing));

                if (disposing)
                {
                    listenerTermination.OnNext(Unit.Default);
                    listenerTermination.Dispose();

                    if (subscription != null)
                    {
                        subscription.Dispose();
                        subscription = null;
                    }

                    disposables.Dispose();
                    connections?.ToList().ForEach(connection => connection?.Dispose());

                    observable.OnCompleted();
                    observable.Dispose();

                    if (tcpListener != null)
                    {
                        tcpListener.Stop();
                        tcpListener = null;
                    }
                }

                log.LogTrace("Disposed");
            }
        }
Exemple #27
0
 public IList <SecurityLoginsRolePoco> GetAll(params Expression <Func <SecurityLoginsRolePoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Login]
                                   ,[Role]
                                   ,[Time_Stamp]
                               FROM [dbo].[Security_Logins_Roles]"
         };
         var list = new List <SecurityLoginsRolePoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new SecurityLoginsRolePoco
             {
                 Id        = (Guid)reader["Id"],
                 Login     = (Guid)reader["Login"],
                 Role      = (Guid)reader["Role"],
                 TimeStamp = Encoding.ASCII.GetBytes(reader["Time_Stamp"].ToString())
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
Exemple #28
0
 public List <PlayerStatsSessionCacheInfo> GetPlayersCacheInfo()
 {
     lock (locker)
     {
         return(playersCacheInfo?.ToList());
     }
 }
        private bool IsValid(ClaimsPrincipal claimsPrincipal, List <string> requiredScopes = null, List <string> requiredRoles = null)
        {
            if (claimsPrincipal == null)
            {
                return(false);
            }

            requiredScopes = requiredScopes?.ToList() ?? new List <string>();
            requiredRoles  = requiredRoles?.ToList() ?? new List <string>();

            if (!requiredScopes.Any() && !requiredRoles.Any())
            {
                return(true);
            }

            var hasAccessToRoles  = false;
            var hasAccessToScopes = false;

            if (requiredRoles.Any())
            {
                hasAccessToRoles = requiredRoles.All(claimsPrincipal.IsInRole);
            }

            if (requiredScopes.Any())
            {
                var scopeClaim = claimsPrincipal.HasClaim(x => x.Type == ScopeType)
                    ? claimsPrincipal.Claims.First(x => x.Type == ScopeType).Value
                    : string.Empty;

                var tokenScopes = scopeClaim?.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)?.ToList() ?? new List <string>();
                hasAccessToScopes = requiredScopes.All(x => tokenScopes.Any(y => string.Equals(x, y, StringComparison.OrdinalIgnoreCase)));
            }

            return(hasAccessToRoles && hasAccessToScopes);
        }
Exemple #30
0
        public GameState DeepCopy()
        {
            var gameStateCopy = new GameState {
                RedTotalHp       = RedTotalHp,
                BlueTotalHp      = BlueTotalHp,
                CurrentMobIndex  = CurrentMobIndex,
                LastTeamColor    = LastTeamColor,
                CurrentTeamColor = CurrentTeamColor,
                TurnOrder        = TurnOrder.ToList(),
                AllPlayed        = AllPlayed,
                PlayersPlayed    = PlayersPlayed?.ToList()
            };

            for (int i = 0; i < Cooldowns.Count; i++)
            {
                gameStateCopy.Cooldowns.Add(Cooldowns[i]);
            }

            gameStateCopy.MobInstances = new MobInstance[MobInstances.Length];
            for (int i = 0; i < MobInstances.Length; i++)
            {
                gameStateCopy.MobInstances[i] = MobInstances[i].DeepCopy();
            }

            return(gameStateCopy);
        }
        public MainPage()
        {
            InitializeComponent();

            var strings = new List<string>
                    {
                        "Hello",
                        "Hello world",
                        "Hello world Hello world",
                        "Hello world Hello world Hello world",
                        "Hello world Hello world Hello world \nHello world",
                        "Hello world Hello world Hello world \nHello world Hello world",
                        "Hello world Hello world Hello world \nHello world Hello world \nHello world",
                    };

            for (var i = 0; i < 3; i++)
            {
                strings.AddRange(strings);
            }

            Items = strings.ToList();

            GroupedItems = Items.GroupBy(d => "Group 1").Union(Items.GroupBy(d => "Group 2")).ToList();

            DataContext = this;
        }
        /// <summary>
        /// Constructor initializes necessary variables and reads in saved constraints from text file.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            string fileName = @"Stored_Constraints.txt";
            Debug.WriteLine(DateTime.Now.ToString());
            filePath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), fileName);
            dateTimesForConstraints = new Dictionary<string, string>();

            backgroundListener = new SpeechRecognizer();
            constraints = new List<string>();
            BLResultGenerated = new TypedEventHandler<SpeechContinuousRecognitionSession, SpeechContinuousRecognitionResultGeneratedEventArgs>(blResultGenerated);
            backgroundListener.ContinuousRecognitionSession.ResultGenerated += BLResultGenerated;

            constraints = readInConstraintsFromFile();
            currentlyStoredConstraints = constraints.ToList();
            updateConstraintsWindow(constraints);

            this.Closing += OnAppClosing;

            var waitOn = loadOnStart();
            while (waitOn.Status != AsyncStatus.Completed) { }
            var ff = backgroundListener.ContinuousRecognitionSession.StartAsync();

            notifyIcon = new NotifyIcon();
            notifyIcon.Icon = new System.Drawing.Icon("trayImage.ico");
            notifyIcon.Visible = true;
            notifyIcon.DoubleClick +=
                delegate (object sender, EventArgs args)
                {
                    this.Show();
                    this.WindowState = WindowState.Normal;
                };
        }
        public JsonResult AddQuestion(string questionData, string answerData, string User_Id)
        {
            var flag = false;
            //|4, |1,3,4, |dfdsf,
            //处理重复值
            questionData = questionData.TrimEnd(',');
            string[] qq = questionData.Split(',');
            string[] aa = answerData.Split('|');
            List<string> allList = new List<string>(qq);
            List<string> qllList = new List<string>(aa);
            allList = allList.Distinct().ToList();
            qllList = qllList.ToList();
            if (allList.Count > 0)
            {
                for (int i = 0; i < allList.Count; i++)
                {
                    //插入提交答案
                    QItemAnswer qitemanswer = new QItemAnswer();
                    //for (int j = 0; j < qllList.Count; j++)
                    //{
                    qitemanswer.SetQuestionID = Convert.ToInt32(allList[i]);
                    qitemanswer.Answer = "," + qllList[i + 1];
                    qitemanswer.AddDate = DateTime.Now;
                    qitemanswer.UserId = Convert.ToInt32(User_Id);
                    //break;
                    //}
                    QItemAnswerRepository.Add(qitemanswer);
                    QItemAnswerRepository.Context.Commit();
                    flag = true; ;
                }
            }

            return Json(new { flag = flag }, JsonRequestBehavior.AllowGet);
        }
Exemple #34
0
        private List <Tuple <Vector2Int, bool> > GetOutlineOld(PolygonGrid2D polygon, List <OrthogonalLineGrid2D> doorLines)
        {
            var outline = new List <Tuple <Vector2Int, bool> >();

            doorLines = doorLines?.ToList();

            foreach (var line in polygon.GetLines())
            {
                AddToOutline(Tuple.Create(line.From, true));

                if (doorLines == null)
                {
                    continue;
                }

                var doorDistances = doorLines.Select(x =>
                                                     new Tuple <OrthogonalLineGrid2D, int>(x, Math.Min(line.Contains(x.From), line.Contains(x.To)))).ToList();
                doorDistances.Sort((x1, x2) => x1.Item2.CompareTo(x2.Item2));

                foreach (var pair in doorDistances)
                {
                    if (pair.Item2 == -1)
                    {
                        continue;
                    }

                    var doorLine = pair.Item1;

                    if (line.Contains(doorLine.From) != pair.Item2)
                    {
                        doorLine = doorLine.SwitchOrientation();
                    }

                    doorLines.Remove(pair.Item1);

                    AddToOutline(Tuple.Create(doorLine.From, true));
                    AddToOutline(Tuple.Create(doorLine.To, false));
                }
            }

            return(outline);

            void AddToOutline(Tuple <Vector2Int, bool> point)
            {
                if (outline.Count == 0)
                {
                    outline.Add(point);
                    return;
                }

                var lastPoint = outline[outline.Count - 1];

                if (!lastPoint.Item2 && point.Item2 && lastPoint.Item1 == point.Item1)
                {
                    return;
                }

                outline.Add(point);
            }
        }
Exemple #35
0
 public ActionResult Index()
 {
     List<StructureTypeEntity> lstStructureType = new List<StructureTypeEntity>();
     lstStructureType = DAFacade.GetStructureTypeListByFilter(string.Format("ScaleYear='2009'"));
     ViewBag.StructureType = lstStructureType.ToList();
     return View();
 }
Exemple #36
0
 public IList <CompanyJobPoco> GetAll(params Expression <Func <CompanyJobPoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Company]
                                   ,[Profile_Created]
                                   ,[Is_Inactive]
                                   ,[Is_Company_Hidden]
                                   ,[Time_Stamp]
                               FROM [dbo].[Company_Jobs]"
         };
         var list = new List <CompanyJobPoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new CompanyJobPoco
             {
                 Id              = (Guid)reader["Id"],
                 Company         = (Guid)reader["Company"],
                 ProfileCreated  = Convert.ToDateTime(reader["Profile_Created"]),
                 IsInactive      = (bool)reader["Is_Inactive"],
                 IsCompanyHidden = (bool)reader["Is_Company_Hidden"],
                 TimeStamp       = Encoding.ASCII.GetBytes(reader["Time_Stamp"].ToString())
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
        public IEnumerable <QueryProductsModel> QueryProducts(List <int> oids)
        {
            IEnumerable <QueryProductsModel> result = new List <QueryProductsModel>();

            try
            {
                result = handler.QueryProducts(oids);
                if (result != null && result.Any())
                {
                    var data = QueryProductSalesInfo(result.Select(x => x.PID).ToList());
                    if (data != null)
                    {
                        result?.ToList().ForEach(x =>
                        {
                            data.TryGetValue(x.PID, out ProductSalesPredic p);
                            x.cy_list_price = p?.OfficialWebsitePrice ?? 0;
                            x.cy_cost       = p?.Cost ?? 0;
                            x.Maoli         = x.cy_list_price - x.cy_cost;
                            x.Maoli         = x.cy_list_price - x.cy_cost;
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Log(Level.Error, ex.ToString());
                return(null);
            }
            return(result);
        }
 public IList <SecurityLoginsLogPoco> GetAll(params Expression <Func <SecurityLoginsLogPoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Login]
                                   ,[Source_IP]
                                   ,[Logon_Date]
                                   ,[Is_Succesful]
                               FROM [dbo].[Security_Logins_Log]"
         };
         var list = new List <SecurityLoginsLogPoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new SecurityLoginsLogPoco
             {
                 Id          = (Guid)reader["Id"],
                 Login       = (Guid)reader["Login"],
                 SourceIP    = reader["Source_IP"].ToString(),
                 LogonDate   = Convert.ToDateTime(reader["Logon_Date"]),
                 IsSuccesful = Convert.ToBoolean(reader["Is_Succesful"])
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
        public RespuestaBusquedaSolicitudesVob BuscarSolicitudes(SolicitudBusquedaSolicitudesVob solicitud)
        {
            List<SolicitudVob> lista = new List<SolicitudVob>();
            var solicitudrepositorio = new GNTSolicitudRepositorio();

            lista = solicitudrepositorio.BuscarSolicitudes();

            
            if (solicitud.SolicitudFilter.Codigo_Solicitud != null)
            {
                if (solicitud.SolicitudFilter.Codigo_Solicitud > 0)
                {
                    lista = lista.Where(x => x.Codigo_Solicitud == solicitud.SolicitudFilter.Codigo_Solicitud).ToList();
                }
            }

  
            if (solicitud.SolicitudFilter.FechaInicio != null && solicitud.SolicitudFilter.FechaFin != null)
            {
                lista = lista.Where(x => x.FechaSolicitud >= solicitud.SolicitudFilter.FechaInicio && x.FechaSolicitud <= solicitud.SolicitudFilter.FechaFin).ToList();
            }

            lista = lista.OrderByDescending(x => x.FechaSolicitud).ToList();

            int total = lista.Count();

            return new RespuestaBusquedaSolicitudesVob
            {
                listasolicitudes = lista.ToList(),
                totalelementos = total
            };

        }
Exemple #40
0
 public ui.TextStyle getTextStyle(float textScaleFactor = 1.0f)
 {
     return(new ui.TextStyle(
                color: color,
                decoration: decoration,
                decorationColor: decorationColor,
                decorationStyle: decorationStyle,
                decorationThickness: decorationThickness,
                fontWeight: fontWeight,
                fontStyle: fontStyle,
                textBaseline: textBaseline,
                fontFamily: fontFamily,
                fontFamilyFallback: fontFamilyFallback,
                fontSize == null ? null : fontSize * textScaleFactor,
                letterSpacing: letterSpacing,
                wordSpacing: wordSpacing,
                height: height,
                // locale: locale,
                foreground: foreground,
                background: background ?? (backgroundColor != null
             ? new Paint {
         color = backgroundColor
     }
             : null
                                           ),
                shadows: shadows?.ToList(),
                fontFeatures: fontFeatures
                ));
 }
        private void AddResourcesToProject()
        {
            PublishedProject publishedProject = null;
            DraftProject draftProject;
            LV_Projects.InvokeIfRequired(s => publishedProject = s.SelectedItems[0].Tag as PublishedProject);

            List<EnterpriseResource> resourceList = new List<EnterpriseResource>();

            LV_EnterpiseResources.InvokeIfRequired(s =>
            {
                ListView.SelectedListViewItemCollection selectedItems = s.SelectedItems;
                resourceList.AddRange(selectedItems.Cast<ListViewItem>().Select(selectedItem => (EnterpriseResource)selectedItem.Tag));
            });

            if (resourceList.Any())
            {
                draftProject = publishedProject.IsCheckedOut ? publishedProject.Draft : publishedProject.CheckOut();

                resourceList.ToList().ForEach(r =>
                    {
                        Log.WriteVerbose(new SourceInfo(), TB_Status, "Adding Resource:{0} to Project:{1}.", r.Name, publishedProject.Draft.Name);
                        draftProject.ProjectResources.AddEnterpriseResource(r);
                    });

                QueueJob queueJob = draftProject.Update();
                Log.WriteVerbose(new SourceInfo(), TB_Status, _bgeAddResourcesToProject, "Waiting for the Project Update job to complete.");
                CsomHelper.ExecuteAndWait(queueJob, TB_Status);
            }
            Log.WriteVerbose(new SourceInfo(), TB_Status, _bgeAddResourcesToProject, "Refreshing Project resources.");
            GetDraftTeamForSelectedProject();
        }
Exemple #42
0
 void Start()
 {
     var spawnPoints = new List<GameObject>();
     foreach (Transform t in spawnPointParent.transform) { spawnPoints.Add(t.gameObject); }
     remainingSpawnPoints = spawnPoints.ToList();
     SpawnInitialStations();
 }
Exemple #43
0
        public static List<DateTime> GetDatesHeadersFromDataSet(OleDbCommand cmd, int takeNumber)
        {
            var columnNames = new List<DateTime>();
            DataSet ds;
            using (var adptr = new OleDbDataAdapter(cmd))
            {
                ds = new DataSet();

                adptr.Fill(ds);
            }
            for (int i = takeNumber + 1; i < ds.Tables[0].Columns.Count; i++)
            {
                var columnName = ds.Tables[0].Columns[i].ColumnName;
                DateTime date;

                if (DateTime.TryParse(columnName, out date))
                {
                    columnNames.Add(new DateTime(date.Year,date.Month, 1));
                }
                else
                {
                    throw new Exception(String.Format("Could not parse {0} as date.", date));
                }
            }

            return columnNames.ToList();
        }
        private ActionResult All()
        {
            var userNameInfo = UserName;
            var settings = UserSettings;

            var changelists = (from item in db.ChangeLists.AsNoTracking()
                                where (item.UserName == userNameInfo.fullUserName ||
                                        item.UserName == userNameInfo.userName ||
                                        item.ReviewerAlias == userNameInfo.reviewerAlias) &&
                                        item.Stage != (int)ChangeListStatus.Deleted
                                select item).OrderByDescending(x => x.TimeStamp);

            var model = new List<ChangeListDisplayItem>();
            foreach (var item in changelists)
            {
                model.Add(new ChangeListDisplayItem(item));
            }

            if (model.Count == 0)
            {
                return RedirectToAction("Index", "SubmitReview");
            }

            var js = new JavaScriptSerializer();
            var data = model.ToList();

            ViewBag.ChangeListDisplayItems = js.Serialize(data);
            ViewBag.Message = "Code Reviewer";
            ViewBag.UserSettings = js.Serialize(ReviewUtil.GenerateUserContext(0, userNameInfo.userName, "settings", settings));

            return View(data);
        }
        static void Main(string[] args)
        {
            Console.Write("Write a sequence of numbers, separated by spaces: ");
            string input = Console.ReadLine();
            List<int> listOfNums = new List<int>();

            try
            {
                listOfNums = (new List<string>(Regex.Split(input, @"\s+"))).Select(s => int.Parse(s)).ToList();
            }
            catch (FormatException)
            {
                Console.WriteLine("The input must contain at least 1 number.");
                return;
            }

            List<int> outputListOfNums = listOfNums.ToList();

            foreach (int num in listOfNums)
            {
                int count = listOfNums.Where(x => x.Equals(num)).Count();

                if (count % 2 != 0)
                {
                    outputListOfNums.RemoveAll(x => x == num);
                }
            }

            Console.WriteLine(string.Join(" ", outputListOfNums));
        }
 public IList <CompanyDescriptionPoco> GetAll(params System.Linq.Expressions.Expression <Func <CompanyDescriptionPoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [Id]
                                   ,[Company]
                                   ,[LanguageID]
                                   ,[Company_Name]
                                   ,[Company_Description]
                                   ,[Time_Stamp]
                               FROM [dbo].[Company_Descriptions]"
         };
         var list = new List <CompanyDescriptionPoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new CompanyDescriptionPoco
             {
                 Id                 = (Guid)reader["Id"],
                 Company            = (Guid)reader["Company"],
                 LanguageId         = reader["LanguageID"].ToString(),
                 CompanyName        = reader["Company_Name"].ToString(),
                 CompanyDescription = reader["Company_Description"].ToString(),
                 TimeStamp          = Encoding.ASCII.GetBytes(reader["Time_Stamp"].ToString())
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
Exemple #47
0
        public PositionProvider Copy()
        {
            PositionProvider p = new PositionProvider()
            {
                Location             = Location,
                Direction            = Direction,
                PositionOffset       = PositionOffset,
                RandomMultitude      = RandomMultitude,
                RandomPositionOption = RandomPositionOption,
                RandomTransforms     = RandomTransforms.ToArray(),
                Degree                = Degree,
                RelativeTo            = RelativeTo,
                RotationFacing        = RotationFacing,
                PositionRefrence      = PositionRefrence,
                RotationRefrence      = RotationRefrence,
                RotationOffset        = RotationOffset,
                RotationOffsetType    = RotationOffsetType,
                RotationOffsetVector  = RotationOffsetVector,
                RotationRandomOffset  = RotationRandomOffset,
                RandomMemory          = RandomMemory?.ToList(),
                RandomTransformMemory = RandomTransformMemory?.ToList(),
                LastProvidedPosition  = LastProvidedPosition,
            };

            return(p);
        }
Exemple #48
0
 // GET: /Reports/
 public ActionResult Index()
 {
     List<SalaryPeriodEntity>lstSalaryPeriod=new List<SalaryPeriodEntity>();
     lstSalaryPeriod=DAFacade.GetSalaryPeriodForDropDown(string.Empty);
     ViewBag.SalaryPeriod=lstSalaryPeriod.ToList();
     return View();
 }
Exemple #49
0
        void cargarDetalleOrden(int idPreOrden)
        {
            List<OrdenDTO> listaOrdenes = new List<OrdenDTO>();
            OrdenBL obj = new OrdenBL();
            List<ItemOrdenDTO> lstItem = new List<ItemOrdenDTO>();
            ClienteDTO cliente = new ClienteDTO();
            cliente.nombre = Context.User.Identity.Name;
            cliente.nombreUsuario = Context.User.Identity.Name;
            cliente.correoElectronico = Context.User.Identity.Name;

            listaOrdenes = obj.ConsultarOrdenesUsuario(idPreOrden, cliente, "");

            lblTituloDetalle.Text = "Detalle Orden " + idPreOrden.ToString();

            lblNombreUsuario.Text = listaOrdenes[0].usuarioOrden.correoElectronico;
            lblTipoDocumento.Text = listaOrdenes[0].usuarioOrden.tipoDocumento;
            lblNumeroDocumento.Text = listaOrdenes[0].usuarioOrden.numeroDocumento;

            lblDireccion.Text = listaOrdenes[0].usuarioOrden.ubicacionCliente.numeroDireccion;
            lblCiudad.Text = listaOrdenes[0].usuarioOrden.ubicacionCliente.nombreCiudad;
            lblDepartamento.Text = listaOrdenes[0].usuarioOrden.ubicacionCliente.nombreDepartamento;
            lblTelefono.Text = listaOrdenes[0].usuarioOrden.telefono;

            foreach (var orden in listaOrdenes)
            {
                lstItem = orden.listaItemsOrden.ToList();
            }

            grvDetalleOrden.DataSource = lstItem.ToList();
            grvDetalleOrden.DataBind();

        }
    static void Main()
    {
        Console.WriteLine("Enter a list of integers on a single line separated by a space:");
        string input = Console.ReadLine();
        int[] numbers = Array.ConvertAll(input.Split(), int.Parse);

        int mask = (1 << numbers.Length) - 1;
        int maxLength = 0;
        List<int> longestSubsequence = new List<int>();

        for (int i = mask; i >= 1; i--)
        {
            char[] indexesToTake = Convert.ToString(i, 2).PadLeft(numbers.Length, '0').ToCharArray();

            List<int> currentSubsequence = new List<int>();

            for (int j = 0; j < numbers.Length; j++)
            {
                if (indexesToTake[j] == '1')
                {
                    currentSubsequence.Add(numbers[j]);
                }   
            }

            if (NonDecreasing(currentSubsequence) && currentSubsequence.Count > maxLength)
            {
                maxLength = currentSubsequence.Count;
                longestSubsequence.Clear();
                longestSubsequence = currentSubsequence.ToList();
            }
        }

        PrintList(longestSubsequence);
    }
 public IList <SystemLanguageCodePoco> GetAll(params Expression <Func <SystemLanguageCodePoco, object> >[] navigationProperties)
 {
     using (var conn = new SqlConnection(_connString))
     {
         SqlCommand cmd = new SqlCommand
         {
             Connection  = conn,
             CommandText = @"SELECT [LanguageID]
                                       ,[Name]
                                       ,[Native_Name]
                                   FROM [dbo].[System_Language_Codes]"
         };
         var list = new List <SystemLanguageCodePoco>();
         conn.Open();
         var reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             list.Add(new SystemLanguageCodePoco
             {
                 LanguageID = reader["LanguageID"].ToString(),
                 Name       = reader["Name"].ToString(),
                 NativeName = reader["Native_Name"].ToString()
             });
         }
         conn.Close();
         return(list?.ToList());
     }
 }
        public async Task<ActionResult> Index()
        {
            if (Session["User"] != null)
            {
                if (Session["Paid_User"].ToString() == "Unpaid")
                {
                    return RedirectToAction("Billing", "PersonalSetting");
                }
                else
                {
                    User objUser = (User)Session["User"];
                    string selectedgroupid = Session["group"].ToString();
                    IEnumerable<Domain.Socioboard.Domain.Groupmembers> lstGroupMembers = new List<Domain.Socioboard.Domain.Groupmembers>();
                    HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGroupMembers/GetAcceptedGroupMembers?GroupId=" + selectedgroupid, "Bearer", Session["access_token"].ToString());
                    if (response.IsSuccessStatusCode)
                    {
                        lstGroupMembers = await response.Content.ReadAsAsync<IEnumerable<Domain.Socioboard.Domain.Groupmembers>>();
                    }

                    return View("Index", lstGroupMembers.ToList());
                }
            }
            else
            {
                return RedirectToAction("Index", "Index");
            }
            
        }
 public void Initialise(IEnumerable<IRiakNode> nodes)
 {
     _nodes = nodes.ToList();
     var list = _nodes.ToList();
     _generator = () => list;
     _roundRobin = new ConcurrentEnumerable<IRiakNode>(RoundRobin()).GetEnumerator();
 }
 public AwardExperience(IEnumerable<string> parameter, List<Kerbal> kerbals, int experience, bool awardImmediately)
 {
     this.parameter = parameter.ToList();
     this.kerbals = kerbals.ToList();
     this.experience = experience;
     this.awardImmediately = awardImmediately;
 }
Exemple #55
0
        public override ModConfig Clone()
        {
            var clone = (ModConfigShowcaseDefaultValues)base.Clone();

            clone.ListOfInts = ListOfInts?.ToList();
            return(clone);
        }
Exemple #56
0
        public IEnumerable<Navbar> navbarItems()
        {
            var menu = new List<Navbar>();
            //menu.Add(new Navbar { Id = 1, nameOption = "Home Page", controller = "Home", action = "Index", imageClass = "fa fa-institution", status = true, isParent = false, parentId = 0 });
            //menu.Add(new Navbar { Id = 2, nameOption = "Analytic Tools", imageClass = "glyphicon glyphicon-leaf", status = true, isParent = true, parentId = 0 });
            //menu.Add(new Navbar { Id = 3, nameOption = "Biological Index", controller = "Home", action = "FlotCharts", status = true, isParent = false, parentId = 2 });
            //menu.Add(new Navbar { Id = 4, nameOption = "Oceanographic Parameters", controller = "Home", action = "MorrisCharts", status = true, isParent = false, parentId = 2 });
            //menu.Add(new Navbar { Id = 4, nameOption = "Upwelling Index", controller = "Home", action = "UpwellingIndex", status = true, isParent = false, parentId = 2 });
            //menu.Add(new Navbar { Id = 5, nameOption = "Elevation Profile Tool", controller = "Home", action = "Tables", imageClass = "fa fa-line-chart fa-1", status = true, isParent = false, parentId = 0 });
            //menu.Add(new Navbar { Id = 6, nameOption = "Comparative Tool", controller = "Home", action = "Forms", imageClass = "glyphicon glyphicon-resize-horizontal", status = true, isParent = false, parentId = 0 });
            //menu.Add(new Navbar { Id = 7, nameOption = "UI Elements", imageClass = "fa fa-wrench fa-fw", status = true, isParent = true, parentId = 0 });
            //menu.Add(new Navbar { Id = 8, nameOption = "Panels and Wells", controller = "Home", action = "Panels", status = true, isParent = false, parentId = 7 });
            //menu.Add(new Navbar { Id = 9, nameOption = "Buttons", controller = "Home", action = "Buttons", status = true, isParent = false, parentId = 7 });
            //menu.Add(new Navbar { Id = 10, nameOption = "Notifications", controller = "Home", action = "Notifications", status = true, isParent = false, parentId = 7 });
            //menu.Add(new Navbar { Id = 11, nameOption = "Typography", controller = "Home", action = "Typography", status = true, isParent = false, parentId = 7 });
            //menu.Add(new Navbar { Id = 12, nameOption = "Icons", controller = "Home", action = "Icons", status = true, isParent = false, parentId = 7 });
            //menu.Add(new Navbar { Id = 13, nameOption = "Grid", controller = "Home", action = "Grid", status = true, isParent = false, parentId = 7 });

            menu.Add(new Navbar { Id = 1, nameOption = "Home Page", controller = "Home", action = "Index", imageClass = "fa fa-institution", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 2, nameOption = "Bathymetry  GIS mapping and transects", controller = "Home", action = "BathymetricTransects", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 3, nameOption = "CCLME Upwelling index", controller = "Home", action = "UpwellingIndex", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 4, nameOption = "Precipitation and river discharges", controller = "Home", action = "PrecipitationDischarges", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 5, nameOption = "Tide gauge graphs", controller = "Home", action = "TideGauge", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 6, nameOption = "Argo Profiles (3D)", controller = "Home", action = "Argo3D", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 7, nameOption = "GIS SST and Chl data and anomaly analysis", controller = "Home", action = "OceanographicAnomalies", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 8, nameOption = "Spatio-temporal data Viewer: SST, Chl, PSU", controller = "Home", action = "SpatioTemporalViewer", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 9, nameOption = "Oceanographic transects", controller = "Home", action = "OceanographicTransects", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 10, nameOption = "Biological data: abundance, distribution, species richness", controller = "Home", action = "BiologicalData", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 11, nameOption = "Using my own data", controller = "Home", action = "UsingOwnData", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 12, nameOption = "Interpolation tools for GIS", controller = "Home", action = "InterpolationTools", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 13, nameOption = "Time series analysis", controller = "Home", action = "TimeSeries", status = true, isParent = false, parentId = 0 });
            menu.Add(new Navbar { Id = 14, nameOption = "Reports", controller = "Home", action = "Tables", status = true, isParent = false, parentId = 0 });
            return menu.ToList();
        }
Exemple #57
0
        internal List <String> GetAllTablesDestination()
        {
            List <String> litDestinationn             = new List <string>();
            List <NotificationTableDestination> table = DbNotification.NotificationTableDestination.ToList();

            table?.ToList().ForEach(t => litDestinationn.Add(t.TableDestination));
            return(litDestinationn);
        }
Exemple #58
0
        public ComplexData Clone()
        {
            var clone = (ComplexData)MemberwiseClone();

            clone.ListOfInts   = ListOfInts?.ToList();
            clone.nestedSimple = nestedSimple?.Clone();
            return(clone);
        }
Exemple #59
0
        public void Test()
        {
            List <SmartContractRegistrationCache> list = null;
            var a = list?.ToList();

            Console.WriteLine($"test{a?.Count}");
            Console.WriteLine("test2");
        }
Exemple #60
0
 public Node(List <Action> lactions, List <Action> ractions, string name)
 {
     active        = false;
     this.name     = name;
     this.lActions = lactions?.ToList();
     isLeftChild   = false;
     this.rActions = ractions?.ToList();
 }