Exemple #1
0
        public void ChangePasswordLocalReader(ChangePasswordLocalReader request)
        {
            DateTime DateBirth;

            if (!DateTime.TryParseExact(request.DateBirth, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateBirth))
            {
                throw new Exception("G001");
            }

            if (this.DateBirth.Date != DateBirth.Date)
            {
                throw new Exception("R005");
            }
            if (string.IsNullOrEmpty(request.NewPassword))
            {
                throw new Exception("R006");
            }
            loader.ChangePasswordLocalReader(this, request);
        }
Exemple #2
0
 internal void ChangePasswordLocalReader(ReaderInfo reader, ChangePasswordLocalReader request)
 {
     request.NewPassword = ReaderInfo.HashPass(request.NewPassword, reader.Salt);
     dbw.ChangePasswordLocalReader(request.ReaderId, request.NewPassword);
 }
Exemple #3
0
        private void bChangePwd_Click(object sender, EventArgs e)
        {
            ChangePasswordLocalReader request = new ChangePasswordLocalReader();

            request.ReaderId    = 222222;
            request.DateBirth   = "1996-01-03";//new DateTime(1996, 01, 03, 0, 0, 0);
            request.NewPassword = "******";
            string jsonData = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }

            request.ReaderId    = 333;
            request.DateBirth   = "1965-11-08";// new DateTime(1965, 11, 08, 7, 7, 7);
            request.NewPassword = "******";
            jsonData            = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }

            request.ReaderId    = 100000;
            request.DateBirth   = "1985-11-01";// new DateTime(1965, 11, 08, 7, 7, 7);
            request.NewPassword = "******";
            jsonData            = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }

            request.ReaderId    = 555;
            request.DateBirth   = "1981-03-17";// new DateTime(1981, 03, 17, 7, 7, 7);
            request.NewPassword = "******";
            jsonData            = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }

            request.ReaderId    = 777;
            request.DateBirth   = "1979-03-24";// new DateTime(1979, 03, 24, 7, 7, 7);
            request.NewPassword = "******";
            jsonData            = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }

            request.ReaderId    = 888;
            request.DateBirth   = "1978-05-07";// new DateTime(1978, 05, 07, 7, 7, 7);
            request.NewPassword = "******";
            jsonData            = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }

            request.ReaderId    = 999;
            request.DateBirth   = "1983-09-30";//new DateTime(1983, 09, 30, 7, 7, 7);
            request.NewPassword = "******";
            jsonData            = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }

            request.ReaderId    = 200500;
            request.DateBirth   = "1972-02-19";// new DateTime(1972, 02, 19, 7, 7, 7);
            request.NewPassword = "******";
            jsonData            = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }

            request.ReaderId    = 214444;
            request.DateBirth   = "1965-04-30";// new DateTime(1965, 04, 30, 7, 7, 7);
            request.NewPassword = "******";
            jsonData            = JsonConvert.SerializeObject(request, ALISDateFormatJSONSettings);

            using (HttpClient client = new HttpClient())
            {
                var response = client.PostAsync(ALIS_ADDRESS + "Readers/ChangePasswordLocalReader", new StringContent(jsonData, Encoding.UTF8, "application/json"));
                tbResponse.Text = response.Result.Content.ReadAsStringAsync().Result;
            }
        }