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
        internal static void FireAll(DemoModel model, ExtModel extModel)
        {
            model.Boolean_property.Set(false);

            model.Boolean_array.Set(new[] { false, true, false });

            var scalar = new MyScalar(
                false,
                50,
                32000,
                1000000000,
                -2000000000000000000,
                3.14f,
                -123456789.012345678,
                byte.MaxValue - 1,
                ushort.MaxValue - 1,
                uint.MaxValue - 1,
                ulong.MaxValue - 1,
                MyEnum.net,
                Flags.anyFlag | Flags.netFlag,
                MyInitializedEnum.hundred
                );

            // ReSharper disable once UnusedVariable
            // ReSharper disable once InconsistentNaming
            var(_bool, _byte, _short, _int, _long, _float, _double, _unsigned_byte, unsigned_short, _unsigned_int, _unsigned_long, _my_enum, _flags, initializedEnum) = scalar;
            var(first, second) = new ComplicatedPair(new Derived("First"), new Derived("Second"));

            model.Scalar.Set(scalar);

            model.Set.Add(50);

            model.MapLongToString.Add(50, "C#");

            const string valA = "C#";
            const string valB = "protocol";

            model.Interned_string.Set(valA);
            model.Interned_string.Set(valA);
            model.Interned_string.Set(valB);
            model.Interned_string.Set(valB);
            model.Interned_string.Set(valA);

            var derived = new Derived("C# instance");

            model.Polymorphic.Set(derived);

            var openDerived = new OpenDerived("C# instance open derived string", "C# instance open string");

            model.Polymorphic_open.Set(openDerived);

            var openClass = new OpenClass("c# test");

            openClass.String.Set("property");

            model.Enum.Value = MyEnum.net;
            extModel.Checker.Fire();

            model.Struct_with_open_field.Value = new StructWithOpenStructField(new OpenStructInField("", "", 456, "", ""));
        }
Beispiel #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);
        }
Beispiel #4
0
        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            OpenClass p = new OpenClass();

            getSms();
            send1();
        }
Beispiel #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!";
            }
        }
        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";
                }
            }
        }
 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";
     }
 }
Beispiel #8
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
            {
            }
        }
Beispiel #9
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 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OpenClass OpenClass = new OpenClass();


            int rand = OpenClass.RandomNumber(100000, 999999);

            TextBox1.Text = rand.ToString();
            if (Session["M_ID"] == null)
            {
            }
            else
            {
                TextBox2.Text = Session["M_ID"].ToString();
            }
            if (Session["firepopup"] == "true")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "final() ", true);
            }
            else
            {
            }
        }