protected void LinkButton2_Click(object sender, EventArgs e)
        {
            Auth p = new Auth();

            auth.login("Select *from Agents_Reg where National_ID='" + TextBox1.Text + "' or Username='******'");
            if (auth.log)
            {
                Label2.Text = "Error! The user with above ID or Username already exist!.";
            }
            else
            {
                OpenClass.inserting("Insert into Agents_Reg(Station_ref,National_ID,Full_names,Username,Password,Location,Phone,Role) VALUES('" + DropDownList1.SelectedItem.Value + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox7.Text + "','2')");
                TextBox4.Text = "12345678";
                Label2.Text   = "Submitted successfully!";
                //SEND MESSAGE

                string message1 = "Hae " + TextBox2.Text + " ,Your have been registered as an fuel sales agent at " + TextBox5.Text + " fuel Station.\n";
                message1 += "Your username is:YOUR NATIONAL ID";
                message1 += " and your password is: " + TextBox4.Text;
                message1 += ".\nPlease use above credentials to log in every evening at 5:00pm and submit meter readings to the manager.You will be directed to set new strong password.\n Call 0712035642 for assistance.";
                OpenClass send  = new OpenClass();
                string    Phone = TextBox7.Text;
                p.SendMessage(p.Add254(Phone), message1);
                OpenClass.ClearInputs(Page.Controls);
            }
        }
Beispiel #2
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            OpenClass OpenClass = new OpenClass();

            OpenClass.AddToSession("ID", TextBox2.Text);
            OpenClass.AddToSession("Reff", TextBox1.Text);
            if (OpenClass.CheckIfReffExist(TextBox1.Text))
            {
                OpenClass.inserting("Insert into Station_registration(Station_ref,National_ID,Station_name,Location) VALUES('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox5.Text + "')");
                OpenClass.ClearInputs(Page.Controls);
                Response.Redirect("../Agents/Station_reg.aspx");
                Label3.Text = "Data inserted successfully!";
            }
            else
            {
                OpenClass.inserting("Insert into Station_registration(Station_ref,National_ID,Station_name,Location) VALUES('" + Session["Reff"] + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox5.Text + "')");
                OpenClass.ClearInputs(Page.Controls);
                Label3.Text = "Data inserted successfully!";
            }
        }
Beispiel #3
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //Session.Add("M_ID", TextBox1.Text);
            //Session.Add("M_Fname", TextBox1.Text);
            //Session.Add("M_Fname", TextBox1.Text);
            //Session.Add("M_ID", TextBox1.Text);
            //Session.Add("M_Fname", TextBox1.Text);
            //Session.Add("M_Fname", TextBox1.Text);
            //Session.Add("M_Fname", TextBox1.Text);
            //Session.Add("M_Fname", TextBox1.Text);


            auth.login("Select *from System_Users where National_ID='" + TextBox1.Text + "' or Username='******'");

            OpenClass p = new  OpenClass();

            if (auth.log)
            {
                Label2.Text = "Error! A User with this ID or Username exist!";
            }
            else
            {
                Session.Add("M_ID", TextBox1.Text);
                p.inserting("Insert into System_Users(National_ID,Full_names,Username,Password,Location,Phone,Role) VALUES('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + p.Add254(TextBox7.Text) + "','1')");

                //LETS GET TWILIO CREDENTIALS
                string        str = ConfigurationManager.ConnectionStrings["Fuel_systemConnectionString"].ToString();
                SqlConnection con = new SqlConnection(str);
                SqlCommand    cmd = new SqlCommand("select *from Twilio_config", con);
                con.Open();
                SqlDataReader myDataReadert = cmd.ExecuteReader();
                if (myDataReadert.Read())
                {
                    string    message1 = "You have been registered with Fuela as Fuel station manager.  \n";
                    string    message2 = "Your Username is:YOUR NATIONAL ID";
                    string    message3 = "Password is:";
                    string    message4 = "Please use the credentials above to log in.Call:0712035642 for queries.";
                    OpenClass send     = new OpenClass();
                    send.SendMessage(myDataReadert["Twilio_phone"].ToString(), p.Add254(TextBox7.Text), myDataReadert["Twilio_SID"].ToString(), myDataReadert["Twilio_Auth"].ToString(), "Hae " + TextBox2.Text + message1 + "," + message2 + "','" + message3 + TextBox4.Text + "." + message4);
                    con.Close();
                }
                else
                {
                    con.Close();
                }

                Response.Redirect("../Agents/Station_reg.aspx");
                p.ClearInputs(Page.Controls);
                Label2.Text = "Records submitted successfully!";
            }
        }
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Administrations Admin = new Administrations();


            Admin.Login("SELECT *FROM System_Users WHere National_ID=@Username and Password=@Password", TextBox5.Text, TextBox1.Text);
            if (Admin.test)
            {
                if (TextBox1.Text == "12345678")
                {
                    Session.Add("User", TextBox5.Text);

                    Response.Redirect("../Agents/Set_new_password.aspx");
                }
                else if (TextBox1.Text == "12345")
                {
                    Response.Redirect("../Agents/Agents_Dashboard.aspx");
                }
                else
                {
                    Response.Redirect("../Agents/Petrol_station_selection.aspx");
                }
            }
            else
            {
                Admin.LoginaAgents("SELECT *FROM Agents_Reg WHere National_ID=@Username and Password=@Password", TextBox5.Text, TextBox1.Text);
                if (Admin.test)
                {
                    if (TextBox1.Text == "12345678")
                    {
                        Session.Add("User", TextBox5.Text);
                        Response.Redirect("../Agents/Set_new_password.aspx");
                    }
                    else if (TextBox1.Text == "12345")
                    {
                        Response.Redirect("../Agents/Agents_Dashboard.aspx");
                    }
                    else
                    {
                        Response.Redirect("../Agents/Agents_Dashboard.aspx");
                    }
                }
                else
                {
                    OpenClass Clear = new OpenClass();
                    Clear.ClearInputs(Page.Controls);
                    Label4.Text = "Invalid credentials";
                }
            }
        }
Beispiel #5
0
        void send()
        {
            OpenClass p = new OpenClass();

            p.testifavailable("SELECT *FROM System_Users where  National_ID='" + TextBox5.Text + "'");
            if (p.res)
            {
                var    random       = new Random();
                int    randomnumber = random.Next(9999);
                string message      = "Fuela password verification code:" + randomnumber;
                Session.Add("Random", randomnumber);
                p.SendMessage(Session["TwilioPhone"].ToString(), p.phone, Session["TwilioSid"].ToString(), Session["Auth"].ToString(), message);
                verify = true;
                p.seting();
                sent();
                Session.Add("User", TextBox5.Text);



                p.ClearInputs(Page.Controls);
            }
            else if (!p.res)
            {
                p.testifavailable("SELECT *FROM Agents_Reg WHERE National_ID='" + TextBox5.Text + "'");
                if (p.res)
                {
                    var    random       = new Random();
                    int    randomnumber = random.Next(9999);
                    string message      = "Fuela password verification code:" + randomnumber;
                    Session.Add("Random", randomnumber);
                    p.SendMessage(Session["TwilioPhone"].ToString(), p.phone, Session["TwilioSid"].ToString(), Session["Auth"].ToString(), message);

                    sent();
                    Session.Add("User", TextBox5.Text);
                    p.seting();
                }
                else
                {
                    Session.Add("check", "2");

                    Label2.Text = "ID not found!! Please check and try again!";
                }
            }
            else
            {
            }
        }