示例#1
0
        /// <summary>
        /// Wciśnięcie przycisku powoduje pobrania numeru id zadania wybranego przy pomocy elementu ComboBox.
        /// Id zadania wykorzystywane jest przez Metodę ZamknijZadanie, parametr Data_zakonczenia pobierany jest z pola wprowadzania tekstu.
        /// Element DataGrid jest ponownie wypełniany zadaniami użytkownika, tak by wyświetlić wprowadzoną zmianę.
        /// </summary>

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int idZadania = GetId.GetIdTask(Opis_zadania.Text);

            InsertUpdate.ZamknijZadanie(idZadania, Data_zakon.Text);
            DataGrids.FillDataGridTasksForUser(Zadania, id);
        }
示例#2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string json = string.Empty;
            string url  = string.Format("http://{0}:{1}/", IP, Port);

            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                // request.AutomaticDecompression = DecompressionMethods.GZip;

                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    using (Stream stream = response.GetResponseStream())
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            json = reader.ReadToEnd();
                        }

                GetId tmp = JsonConvert.DeserializeObject <GetId>(json);
                Ids = new ObservableCollection <string>(tmp.id);
                Console.WriteLine(json);
            }
            catch (Exception ex)
            {
                Ids = new ObservableCollection <string>()
                {
                    "Error"
                };
            }
        }
示例#3
0
        async Task StartingScript()
        {
            var   guild     = Context.Guild;
            ulong channelid = GetId.GetChannelID(guild, "general");

            if (channelid == 0)
            {
                return;
            }
            var channel = guild.GetTextChannel(channelid);
            await channel.SendMessageAsync("Loading.");

            await channel.SendMessageAsync("Loading Bubble Memory.");

            await Task.Delay(2000);

            await channel.SendMessageAsync("Bubble Memory Loaded.");

            await Task.Delay(500);

            await channel.SendMessageAsync("Initializing Bubble Memory.");

            await Task.Delay(300);

            await channel.SendMessageAsync("Bubble Memory Initialized.");

            await Task.Delay(200);

            await channel.SendMessageAsync("Bot is Loaded and Ready.");
        }
示例#4
0
        /// <summary>
        /// This constructor takes the following string format as input:
        /// <code>"(id,created,employee(id,firstname,employeeType(id), lastname),location)"</code>
        /// I am assuming that ids are integers, and that created is a very simple
        /// 2019-01-31 style date string.
        /// </summary>
        /// <param name="inputString"></param>
        public EmployeeLocation(string inputString)
        {
            InnerAndOuterString inputWithoutParanthesis = ExtractFromParanthesis.fromDelimiter("", inputString);

            if (inputWithoutParanthesis == null)
            {
                // this would happen if there were no paranthesis or if the first character was not an opening paranthesis
                throw new ArgumentException("Employee location does not begin and end with paranthesis");
            }

            InnerAndOuterString employeeAndInputWithoutEmployee = ExtractFromParanthesis.fromDelimiter("employee", inputWithoutParanthesis.inner);

            List <string> employeeLocationParts = CSVLine.toListOfLength(employeeAndInputWithoutEmployee.outer, 4);

            this.id = GetId.getId(employeeLocationParts.ElementAt(0));

            try
            {
                this.created = DateTime.ParseExact(employeeLocationParts.ElementAt(1), "yyyy-MM-dd", CultureInfo.InvariantCulture);
            }
            catch (System.FormatException)
            {
                throw new ArgumentException("Date format not in proper format (yyyy-MM-dd)");
            }

            this.employee = new Employee(employeeAndInputWithoutEmployee.inner);
            this.location = employeeLocationParts.ElementAt(3);
        }
示例#5
0
文件: UKORequests.cs 项目: azlp/uko
        public string AddNewUko(UKOmodel _uko)
        {
            string _ukoId = new GetId().getHash(nullCheck.checkStringNullReturnEmptyString(_uko.Name) + nullCheck.checkStringNullReturnEmptyString(_uko.SecondName) + nullCheck.checkStringNullReturnEmptyString(_uko.FathersName) + _uko.Date);



            try
            {
                SqlCommand cmd = new SqlCommand("AddUKO", con);

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@entitytype", _uko.Type);
                cmd.Parameters.AddWithValue("@ID", _ukoId);
                cmd.Parameters.AddWithValue("@Name", nullCheck.checkStringNull(_uko.Name));
                cmd.Parameters.AddWithValue("@SecondName", nullCheck.checkStringNull(_uko.SecondName));
                cmd.Parameters.AddWithValue("@FathersName", nullCheck.checkStringNull(_uko.FathersName));
                cmd.Parameters.AddWithValue("@DateOffBirth", nullCheck.checkDateTimeNullNotDb(_uko.Date));
                cmd.Parameters.AddWithValue("@FIO", new GetFIO().Fio(nullCheck.checkStringNullReturnEmptyString(_uko.Name), nullCheck.checkStringNullReturnEmptyString(_uko.SecondName), nullCheck.checkStringNullReturnEmptyString(_uko.FathersName)));
                cmd.Parameters.AddWithValue("@Photo", nullCheck.checkStringNull(_uko.Photo));
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();


                return(_ukoId);
            }
            catch
            {
                con.Close();

                throw;
            }
        }
        /// <summary>
        /// Przyciśnięcie tego przycisku powoduje wypełnienie obiektu DataGrid zadaniami przypisanymi działowi wybranemu przy użyciu elementu dropdown_działy.
        /// </summary>

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string dzialy = dropdown_dzialy.Text;
            int    id     = GetId.GetIdDepartment(dzialy);

            DataGrids.FillDataGridTasksForDepartment(Zadania, id);
        }
        /// <summary>
        /// Przyciśnięcie przycisku powoduje wyświetlnie zadań pracownika, którego nazwisko zostało wybrane przy użyciu elementu dropdown_nazwiska.
        /// </summary>

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string uzytkownik = dropdown_nazwiska.Text;
            int    id         = GetId.GetIdUser(uzytkownik);

            DataGrids.FillDataGridTasksForUser(Zadania, id);
        }
示例#8
0
 public MovingEntity(EntityType type, Factory source, Factory destination, GetId getId) : base(type, getId)
 {
     _owner         = source.Owner;
     _source        = source;
     _destination   = destination;
     RemainingTurns = source.GetDistanceTo(destination);
 }
示例#9
0
        /// <summary>
        /// Method to set Seeds into RolePermissions-Table.
        /// </summary>
        /// <param name="db"><see cref="DBConfig"/> object.</param>
        public static void SetSeeds(SSOContext db)
        {
            List <RolePermission> seedList = new List <RolePermission>
            {
                new RolePermission {
                    RoleId = GetId.RoleID("admin", db), PermissionId = GetId.PermissionID("Root", db)
                },
                new RolePermission {
                    RoleId = GetId.RoleID("admin", db), PermissionId = GetId.PermissionID("Edit plan", db)
                },
                new RolePermission {
                    RoleId = GetId.RoleID("dispatcher", db), PermissionId = GetId.PermissionID("Edit plan", db)
                },
                new RolePermission {
                    RoleId = GetId.RoleID("dispatcher", db), PermissionId = GetId.PermissionID("Edit arrival", db)
                },
                new RolePermission {
                    RoleId = GetId.RoleID("dispatcher", db), PermissionId = GetId.PermissionID("Edit departure", db)
                }
            };

            foreach (var item in seedList)
            {
                db.RolePermissions.Add(item);
            }
            db.SaveChanges();
        }
示例#10
0
文件: UKORequests.cs 项目: azlp/uko
        public string AddNewUkoJur(UKOmodel _uko)
        {
            string _ukoId = new GetId().getHash(nullCheck.checkStringNullReturnEmptyString(_uko.Name) + nullCheck.checkStringNullReturnEmptyString(_uko.SecondName) + nullCheck.checkStringNullReturnEmptyString(_uko.FathersName) + _uko.Date);

            try
            {
                SqlCommand cmd = new SqlCommand("AddUKOJur", con);

                cmd.CommandType = CommandType.StoredProcedure;


                cmd.Parameters.AddWithValue("@ID", _ukoId);
                cmd.Parameters.AddWithValue("@Name", nullCheck.checkStringNullReturnEmptyString(_uko.Name));
                cmd.Parameters.AddWithValue("@JurName", nullCheck.checkStringNullReturnEmptyString(_uko.SecondName));
                cmd.Parameters.AddWithValue("@INN", nullCheck.checkStringNullReturnEmptyString(_uko.INN));
                cmd.Parameters.AddWithValue("@Comment", nullCheck.checkStringNullReturnEmptyString(_uko.Comment));
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();



                return(_ukoId);
            }
            catch
            {
                con.Close();


                throw;
            }
        }
示例#11
0
 public UserStatsService(IMapper mapper, DataContext context, IHttpContextAccessor httpContextAccessor)
 {
     _mapper              = mapper;
     _context             = context;
     _httpContextAccessor = httpContextAccessor;
     GetUserId            = delegate(){
         return(int.Parse(_httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier)));
     };
 }
示例#12
0
        public void TestMethodGetIdDepartment()
        {
            string dzial = "Testy";
            int    actual;

            actual = GetId.GetIdDepartment(dzial);
            int expected = 1;

            Assert.AreEqual(expected, actual, 0.0001, "Wartosc inna niz spodziewana");
        }
示例#13
0
        public void TestMethodGetIdTask()
        {
            string opis = "Opis";
            int    actual;

            actual = GetId.GetIdTask(opis);
            int expected = 0;

            Assert.AreEqual(expected, actual, 0.0001, "Wartosc inna niz spodziewana");
        }
示例#14
0
        public QueueClient <T> Build()
        {
            GetId.VerifyNotNull($"{nameof(GetId)} is required");
            LoggerFactory.VerifyNotNull($"{nameof(LoggerFactory)} is required");
            QueueOption.VerifyNotNull($"{nameof(QueueOption)} is required");

            AwaiterCollection ??= new AwaiterCollection <T>(LoggerFactory.CreateLogger <AwaiterCollection <T> >());

            return(new QueueClient <T>(GetId, QueueOption, AwaiterCollection, LoggerFactory.CreateLogger <QueueClient <T> >()));
        }
示例#15
0
        public void TestMethodGetIdUser()
        {
            string nazwisko = "Nowak";
            int    actual;

            actual = GetId.GetIdUser(nazwisko);
            int expected = 0;

            Assert.AreEqual(expected, actual, 0.0001, "Wartosc inna niz spodziewana");
        }
示例#16
0
        public Receiver Build()
        {
            GetId.VerifyNotNull($"{nameof(GetId)} is required");
            Directory.VerifyNotNull($"{nameof(Directory)} is required");
            LoggerFactory.VerifyNotNull($"{nameof(LoggerFactory)} is required");

            AwaiterCollection ??= new AwaiterCollection <Message>(LoggerFactory.CreateLogger <AwaiterCollection <Message> >());
            QueueReceiverFactory ??= new QueueReceiverFactory(LoggerFactory);

            return(new Receiver(GetId, QueueReceiverFactory, AwaiterCollection, Directory, LoggerFactory.CreateLogger <Receiver>()));
        }
示例#17
0
        public async Task <MatchDTO> GetMatch(int id)
        {
            string URI = GetId.Replace("{id}", Convert.ToString(id));

            using (HttpClient httpClient = new HttpClient())
            {
                return(JsonConvert.DeserializeObject <MatchDTO>(
                           await httpClient.GetStringAsync(URIService.Build(URI))
                           ));
            }
        }
        /// <summary>
        /// Przyciśnięcie przycisku powoduje pobranie wartości z pól ComboPracownik i ComboDzial i przy użyciu funkcji klasy GetId przekształcenie ich do wartości id.
        /// Wartości uzyskane w ten sposób i wartości pobierane wprost z pól wprowadzania tekstu używane są do wywołania funkcji InsertZadania.
        /// Następnie aktualizowana jest zawartość elementu DataGrid Zadania, tak by pokazać również dodane zadanie.
        /// </summary>

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            string IdValue            = Id.Text;
            int    Id_dzialuValue     = GetId.GetIdDepartment(ComboDzial.Text);
            int    Id_pracownikaValue = GetId.GetIdUser(ComboPracownik.Text);
            string OpisValue          = Opis.Text;
            string Czas_na_wykoValue  = Czas_na_wyko.Text;
            string DeadlineValue      = Deadline.Text;

            InsertUpdate.InsertZadania(IdValue, Id_dzialuValue, Id_pracownikaValue, OpisValue, Czas_na_wykoValue, DeadlineValue);
            DataGrids.FillDataGridAllTasks(Zadania);
        }
示例#19
0
        public XElement GetElement()
        {
            var ns = new NamespaceDirectory();
            var w  = ns.NamespaceMain;
            var xf = new XElement(w.GetName("xf"));

            if (fontId > -1)
            {
                xf.Add(new XAttribute("fontId", fontId));
            }
            xf.Add(new XAttribute("xfId", GetId?.Invoke() ?? 0));
            return(xf);
        }
        public MergeVersionsManager(ILibraryManager libraryManager, ICollectionManager collectionManager, ILogger <VideosService> logger, IServerConfigurationManager serverConfigurationManager,
                                    IHttpResultFactory httpResultFactory,
                                    IUserManager userManager,
                                    IDtoService dtoService,
                                    IAuthorizationContext authContext, GetId request)
        {
            var id = request.Id;

            _session        = new SessionInfo(_sessionManager, logger);
            _libraryManager = libraryManager;
            _userManager    = userManager;
            _logger         = logger;
            _timer          = new Timer(_ => OnTimerElapsed(), null, Timeout.Infinite, Timeout.Infinite);
            _videoService   = new VideosService(_logger, serverConfigurationManager, httpResultFactory, libraryManager, userManager, dtoService, authContext);
        }
示例#21
0
        /// <summary>
        /// Method to set Seeds into CompanyAirportsSet-Table.
        /// </summary>
        /// <param name="db">DB context.</param>
        public static void SetSeeds(SSOContext db)
        {
            List <CompanyAirports> seedList = new List <CompanyAirports>
            {
                new CompanyAirports {
                    CompanyId = GetId.CompanyID("PROFI-IT", db), AirportId = 1
                },
                new CompanyAirports {
                    CompanyId = GetId.CompanyID("ODS", db), AirportId = 1
                }
            };

            db.AddRange(seedList);
            db.SaveChanges();
        }
        /// <summary>
        /// This constructor takes the following string format as input:
        /// <code>"id,firstname,employeeType(id),lastname"</code>
        /// </summary>
        /// <param name="inputString"></param>
        public Employee(string inputString)
        {
            InnerAndOuterString employeeTypeAndEmployeeWithoutET = ExtractFromParanthesis.fromDelimiter("employeeType", inputString);

            if (employeeTypeAndEmployeeWithoutET == null)
            {
                throw new ArgumentException("employeeType missing or missing its following paranthesis");
            }

            List <string> employeeParts = CSVLine.toListOfLength(employeeTypeAndEmployeeWithoutET.outer, 4);

            this.id           = GetId.getId(employeeParts.ElementAt(0));
            this.firstname    = employeeParts.ElementAt(1);
            this.lastname     = employeeParts.ElementAt(3);
            this.employeeType = new EmployeeType(employeeTypeAndEmployeeWithoutET.inner);
        }
示例#23
0
        /// <summary>
        /// Method to set Seeds into UserRoles-Table.
        /// </summary>
        /// <param name="db"><see cref="DBConfig"/> object.</param>
        public static void SetSeeds(SSOContext db)
        {
            List <UserRole> seedList = new List <UserRole>
            {
                new UserRole {
                    RoleId = GetId.RoleID("admin", db), UserId = GetId.UserID("greentee5", db)
                },
                new UserRole {
                    RoleId = GetId.RoleID("admin", db), UserId = GetId.UserID("sipdrenma", db)
                }
            };

            foreach (var item in seedList)
            {
                db.UserRoles.Add(item);
            }
            db.SaveChanges();
        }
示例#24
0
文件: RoleSeed.cs 项目: Shketkol/sso
        /// <summary>
        /// Method to set Seeds into Roles-Table.
        /// </summary>
        /// <param name="db"><see cref="DBConfig"/> object.</param>
        public static void SetSeeds(SSOContext db)
        {
            List <Role> seedList = new List <Role>
            {
                new Role {
                    Slug = "admin", CompanyId = GetId.CompanyID("PROFI-IT", db)
                },
                new Role {
                    Slug = "dispatcher", CompanyId = GetId.CompanyID("ODS", db)
                }
            };

            foreach (var item in seedList)
            {
                item.Slug = item.Slug.Replace(' ', '-').ToLower();
                db.Roles.Add(item);
            }
            db.SaveChanges();
        }
示例#25
0
        /// <summary>
        /// Method to set Seeds into UserParameters-Table.
        /// </summary>
        /// <param name="db"><see cref="DBConfig"/> object.</param>
        public static void SetSeeds(SSOContext db)
        {
            List <UserParams> seedList = new List <UserParams>
            {
                new UserParams {
                    UserId = GetId.UserID("greentee5", db), Key = "phone", Value = "+380501689853"
                },
                new UserParams {
                    UserId = GetId.UserID("greentee5", db), Key = "email", Value = "*****@*****.**"
                },
                new UserParams {
                    UserId = GetId.UserID("sipdrenma", db), Key = "email", Value = "*****@*****.**"
                }
            };

            foreach (var item in seedList)
            {
                db.UserParameters.Add(item);
            }
            db.SaveChanges();
        }
示例#26
0
文件: UserSeed.cs 项目: Shketkol/sso
        /// <summary>
        /// Method to set Seeds into Users-Table.
        /// </summary>
        /// <param name="db"><see cref="DBConfig"/> object.</param>
        public static void SetSeeds(SSOContext db)
        {
            List <User> seedList = new List <User>
            {
                new User {
                    Name        = "greentee5", FirstName = "Yan", LastName = "Kolovorotny",
                    Email       = "*****@*****.**", Password = BCrypt.Net.BCrypt.HashPassword("zev1982z", salt),
                    PhoneNumber = "+380501689853", CompanyId = GetId.CompanyID("PROFI-IT", db)
                },
                new User {
                    Name        = "sipdrenma", FirstName = "Piter", LastName = "Parker",
                    Email       = "*****@*****.**", Password = BCrypt.Net.BCrypt.HashPassword("uncleBen", salt),
                    PhoneNumber = "+3808008808", CompanyId = GetId.CompanyID("PROFI-IT", db)
                }
            };

            foreach (var item in seedList)
            {
                db.Users.Add(item);
            }
            db.SaveChanges();
        }
示例#27
0
        /// <summary>
        /// Przycisk logowania do Panelu_uzytkownika, wciśnięcie może dać 3 rezultaty:
        /// - jeśli nazwisko nie zostało wprowadzone, zostanie wyświetlony komunikat "Wprowadz nazwisko"
        /// - jeśli dane logowania są niepoprawne zostanie wyswielony komunikat "Bledna nazwa uzytkownika lub haslo"
        /// - jesli dane sa poprawne, okno MainWindow zostaie zamkniete i zostanie wywołany Panel_uzytkownika.
        /// </summary>

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (Nazwisko_login.Text.Length == 0)
            {
                errormessage.Text = "Wprowadz nazwisko";
                Nazwisko_login.Focus();
            }
            else
            {
                string login = Nazwisko_login.Text;
                string haslo = Haslo_login.Password;
                if (Authentication.Login(login, haslo))
                {
                    Panel_uzytkownika.id = GetId.GetIdUser(Nazwisko_login.Text);
                    userpanel.Show();
                    Close();
                }
                else
                {
                    errormessage.Text = "Bledna nazwa uzytkownika lub haslo";
                }
            }
        }
示例#28
0
 public Factory(Player owner, int x, int y, int unitCount, int productionRate, GetId getId) : base(EntityType.FACTORY, getId)
 {
     Owner          = owner;
     Position       = new Point(x, y);
     UnitCount      = unitCount;
     ProductionRate = productionRate;
 }
 input.LostFocus   += (sender, e) => ValidateId(GetId <T>(input));
 /// <summary>
 /// This constructor takes the following string format as input:
 /// <code>"id"</code>
 /// </summary>
 /// <param name="inputString"></param>
 public EmployeeType(string input)
 {
     this.id = GetId.getId(input);
 }