コード例 #1
0
 protected void LinkButton4_Click(object sender, EventArgs e)
 {
     if (TextBox1.Text == TextBox5.Text)
     {
         OpenClass update = new OpenClass();
         update.inserting("UPDATE System_Users SET password='******' WHERE National_ID='" + Session["User"] + "'");
         update.inserting("UPDATE Agents_Reg SET password='******' WHERE National_ID='" + Session["User"] + "'");
         Session.Clear();
         Response.Redirect("../Agents/Log_in.aspx");
     }
     else
     {
         Label2.Text = "The password do not match";
     }
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        protected void insertdetails(object sender, EventArgs e)
        {
            string        str = ConfigurationManager.ConnectionStrings["Fuel_systemConnectionString"].ToString();
            SqlConnection con = new SqlConnection(str);
            SqlCommand    cmd = new SqlCommand("SELECT *FROM Fuel WHERE Station_ref='" + DropDownList1.SelectedItem.Value + "' AND Fuel_ref='" + DropDownList2.SelectedItem.Value + "'", con);

            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                response.Text = "You already submitted this record please confirm";
                con.Close();
            }
            else
            {
                con.Close();
                OpenClass p      = new OpenClass();
                Random    random = new Random();
                int       rand   = random.Next(100000, 999999);

                p.inserting("INSERT INTO  Fuel(Station_ref,Fuel_ref,Tank_capacity,Current_capacity,Price_itre) VALUES('" + DropDownList1.SelectedItem.Value + "','" + DropDownList2.SelectedItem.Value + "','" + TextBox4.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "')");
                Session["firepopup"] = null;
                response.Text        = "Submitted successfully!";

                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "final()", true);
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "final() ", true);
        }
コード例 #4
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!";
            }
        }
コード例 #5
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!";
            }
        }