Exemplo n.º 1
0
        protected void BtnLogin_Click(object sender, EventArgs e)
        {
            PIServiceReference.WebService1SoapClient serviceRef = new PIServiceReference.WebService1SoapClient();
            string rawData = serviceRef.SelectUser(Username.Text, Password.Text);

            if (rawData.Equals("[]"))
            {
                LbError.Text      = "Герешно потребителско име или парола!";
                LbError.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                JArray a       = JArray.Parse(rawData);
                User   newuser = new User();
                foreach (JObject o in a.Children <JObject>())
                {
                    newuser.Id       = (int)o["Id"];
                    newuser.Username = (string)o["Username"];
                    newuser.Password = (string)o["Password"];
                    newuser.Rights   = (int)o["Rights"];
                }
                Session["user"]   = newuser.Username;
                Session["rights"] = newuser.Rights;
                Response.Redirect("WebForm1.aspx");
            }
        }
Exemplo n.º 2
0
        protected void BtnSelect_Click(object sender, EventArgs e)
        {
            PIServiceReference.WebService1SoapClient serviceRef = new PIServiceReference.WebService1SoapClient();
            string rawData = serviceRef.SelectVignetteByCarNumber(Number.Text);

            if (rawData.Equals("[]"))
            {
                LbResult2.Text      = "Няма намерени записи по въведения от вас номер!";
                LbResult2.ForeColor = System.Drawing.Color.Red;
                dataGrid.Visible    = false;
            }
            else
            {
                JArray a = JArray.Parse(rawData);
                foreach (JObject o in a.Children <JObject>())
                {
                    Vignette newVignette = new Vignette();
                    newVignette.Id             = (int)o["Id"];
                    newVignette.carNumber      = (string)o["carNumber"];
                    newVignette.expirationDate = (string)o["expirationDate"];
                    newVignette.Category       = (int)o["category"];
                    VignettesList.Add(newVignette);
                }
                LbResult2.Text      = "Търсенето беше успешно! Резултатите са показани в таблицата долу.";
                LbResult2.ForeColor = System.Drawing.Color.Blue;
                dataGrid.DataSource = VignettesList;
                dataGrid.DataBind();
                dataGrid.Visible = true;
            }
        }
Exemplo n.º 3
0
 protected void BtnRegister_Click(object sender, EventArgs e)
 {
     if (int.Parse(Session["Rights"].ToString()) == 0)
     {
         MsgBox("Нямате права за тази операция!", this.Page, this);
     }
     else
     {
         int  number;
         bool success = Int32.TryParse(Category.Text, out number);
         if (success)
         {
             if (number == 1 || number == 2 || number == 3)
             {
                 PIServiceReference.WebService1SoapClient serviceRef = new PIServiceReference.WebService1SoapClient();
                 //LbResult.Text = serviceRef.RegisterNewVignette(carNumber.Text, expirationDate.Text, number);
                 DateTime today      = DateTime.UtcNow.Date;
                 DateTime expiration = today.AddDays(Double.Parse(expire.SelectedItem.Value));
                 LbResult.Text = serviceRef.RegisterNewVignette(carNumber.Text, expiration.ToString("dd/MM/yyyy"), number);
                 BtnShow_Click(sender, e);
             }
             else
             {
                 LbResult.Text = "Категорията трябва да е число между 1 и 3!";
             }
         }
         else
         {
             LbResult.Text = "Категорията трябва да е число между 1 и 3!";
         }
     }
 }
Exemplo n.º 4
0
        protected void BtnRegister_Click(object sender, EventArgs e)
        {
            bool isHuman = ExampleCaptcha.Validate(txtCaptcha.Text);

            if (isHuman)
            {
                if (RegPassword.Text.Length > 4)
                {
                    PIServiceReference.WebService1SoapClient serviceRef = new PIServiceReference.WebService1SoapClient();
                    LbResult.Text = serviceRef.RegisterNewUsers(RegUsername.Text, RegPassword.Text, 0);
                }
                else
                {
                    LbResult.Text = "Паролата трябва да е с дължина поне 5 символа!";
                }
            }
            else
            {
                LbResult.Text = "Въведете текста от изображението правилно!";
            }
        }
Exemplo n.º 5
0
        protected void BtnShow_Click(object sender, EventArgs e)
        {
            PIServiceReference.WebService1SoapClient serviceRef = new PIServiceReference.WebService1SoapClient();
            string rawData = serviceRef.ShowAllData();
            JArray a       = JArray.Parse(rawData);

            foreach (JObject o in a.Children <JObject>())
            {
                Vignette newVignette = new Vignette();
                newVignette.Id             = (int)o["Id"];
                newVignette.carNumber      = (string)o["carNumber"];
                newVignette.expirationDate = (string)o["expirationDate"];
                newVignette.Category       = (int)o["category"];
                VignettesList.Add(newVignette);
            }
            LbResult2.Text      = "Търсенето беше успешно! Резултатите са показани в таблицата долу.";
            LbResult2.ForeColor = System.Drawing.Color.Blue;
            dataGrid.DataSource = VignettesList;
            dataGrid.DataBind();
            dataGrid.Visible = true;
        }