Example #1
0
        public object ktheEmail(string username)
        {
            sqlConfig sqlConfig = new sqlConfig();
            var       emaill    = sqlConfig.ktheRol("select email  from useri where username ='******'");

            return(emaill);
        }
Example #2
0
        protected void LOGIN(object sender, EventArgs e)
        {
            var username = usernamee.Value;
            var passi    = pasi.Value;


            sqlConfig sqlConfig = new sqlConfig();
            var       rol       = sqlConfig.ktheRol("select role  from useri where username ='******'  and password ='******'");

            //Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "successalert()", true);


            if (Convert.ToInt32(rol) == 1)
            {
                Session["name"] = username;
                Response.Redirect("admintable.aspx");
            }
            if (Convert.ToInt32(rol) == 2)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "randomtext", "Operator()", true);
            }
            if (Convert.ToInt32(rol) != 1 && Convert.ToInt32(rol) != 2)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "randomtext", "a()", true);
            }
        }
Example #3
0
        protected void shiko_nese_ka_sherbim(object sender, EventArgs e)
        {
            sqlConfig sqlConfig = new sqlConfig();

            if (!string.IsNullOrEmpty(emer.Value) && !string.IsNullOrEmpty(idkarte.Value))
            {
                sqlConfig.strcon.Open();
                string     query   = "select id from client where emer = '" + emer.Value + "' and IdKarte ='" + idkarte.Value + "'";
                SqlCommand cmd     = new SqlCommand(query, sqlConfig.strcon);
                var        gjendet = cmd.ExecuteScalar();
                sqlConfig.strcon.Close();
                if (Convert.ToInt32(gjendet) != 0)
                {
                    sqlConfig.strcon.Open();
                    string     kthe_sa_makina_ka_klienti = "select count(*) from client e inner join instalim t on e.id = t.id_klienti where e.IdKarte like '" + idkarte.Value + "'";
                    SqlCommand cmdd       = new SqlCommand(kthe_sa_makina_ka_klienti, sqlConfig.strcon);
                    var        ka_sherbim = cmdd.ExecuteScalar();

                    if (Convert.ToInt32(ka_sherbim) != 0)
                    {
                        if (Convert.ToInt32(ka_sherbim) == 1)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                                "err_msg",
                                                                "alert('ky klient ka te rregjistruar  " + Convert.ToInt32(ka_sherbim) + " makine ');",
                                                                true);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                                "err_msg",
                                                                "alert('ky klient ka te rregjistruar  " + Convert.ToInt32(ka_sherbim) + " makina ');",
                                                                true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                            "err_msg",
                                                            "alert('ky klient nuk  ka asnje makine te rregjistruar');",
                                                            true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                        "err_msg",
                                                        "alert('ky klient nuk  egziston i rregjistruar ');",
                                                        true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                    "err_msg",
                                                    "alert('Ploteso fushat');",
                                                    true);
            }
        }
Example #4
0
        protected void saveemail(object sender, EventArgs e)
        {
            try
            {
                string paisja = paisje();

                string sherbimi = lloj_sherbimi();

                string vendiInstalimit = vend_instalimi();
                string pagesa          = menyra_pageses();


                sqlConfig sqlConfig = new sqlConfig();
                if (!string.IsNullOrEmpty(emer.Value) && !string.IsNullOrEmpty(idkarte.Value) && !string.IsNullOrEmpty(sherbimi) &&
                    !string.IsNullOrEmpty(vendiInstalimit) && !string.IsNullOrEmpty(pagesa) && !string.IsNullOrEmpty(paisja) && !string.IsNullOrEmpty(modeli.Value) &&
                    !string.IsNullOrEmpty(targa.Value) && !string.IsNullOrEmpty(imei.Value) && !string.IsNullOrEmpty(Nr_teli.Value) && !string.IsNullOrEmpty(Text1.Value))
                {
                    sqlConfig.strcon.Open();
                    string     query   = "select id from client where emer = '" + emer.Value + "' and IdKarte ='" + idkarte.Value + "'";
                    SqlCommand cmd     = new SqlCommand(query, sqlConfig.strcon);
                    var        gjendet = cmd.ExecuteScalar();
                    sqlConfig.strcon.Close();
                    if (Convert.ToInt32(gjendet) != 0)
                    {
                        sqlConfig.strcon.Open();

                        string     targa_unike = "  select count(id) from instalim where targa like '" + targa.Value + "'";
                        SqlCommand cmddr       = new SqlCommand(targa_unike, sqlConfig.strcon);

                        if (Convert.ToInt32(cmddr.ExecuteScalar()) != 0)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                                "err_msg",
                                                                "alert('kjo targe ekziston e rregjistruar me pare!');",
                                                                true);
                        }
                        else
                        {
                            //sqlConfig.strcon.Open();
                            string     insert_sherbim = "insert into instalim values(" + gjendet + ",'" + targa.Value + "','" + modeli.Value + "','" + paisja + "','" + imei.Value + "','+355 " + Nr_teli.Value + "','" + sherbimi + "','" + vendiInstalimit + "','" + pagesa + "','" + Text2.Value + "','" + Convert.ToString(DateTime.Now) + "','" + Text1.Value + "' )";
                            SqlCommand cmdd           = new SqlCommand(insert_sherbim, sqlConfig.strcon);
                            var        ka_sherbim     = cmdd.ExecuteNonQuery();



                            var client = new SmtpClient("smtp.gmail.com", 587)
                            {
                                Credentials = new NetworkCredential("*****@*****.**", "Rifi98@@$"),
                                EnableSsl   = true
                            };
                            client.Send("*****@*****.**", "*****@*****.**", "GpsAlbania", "Klientit me emer :" + emer.Value + " mori sherbim ne mjetin me targe: " + targa.Value.ToUpper() + " ");


                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                                "err_msg",
                                                                "alert('ky sherbim i shtua me sukses tek klienti me emer" + emer.Value.ToUpper() + " dhe u dergua ne email');",
                                                                true);
                        }
                        sqlConfig.strcon.Close();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                            "err_msg",
                                                            "alert('ky klient nuk  egziston i rregjistruar , rregjistro klientin ne fillim');",
                                                            true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                        "err_msg",
                                                        "alert('Ploteso fushat');",
                                                        true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        public bool save_instalim()
        {
            bool result = false;

            try
            {
                string paisja = paisje();

                string sherbimi = lloj_sherbimi();

                string vendiInstalimit = vend_instalimi();
                string pagesa          = menyra_pageses();


                sqlConfig sqlConfig = new sqlConfig();
                if (!string.IsNullOrEmpty(emer.Value) && !string.IsNullOrEmpty(idkarte.Value) && !string.IsNullOrEmpty(sherbimi) &&
                    !string.IsNullOrEmpty(vendiInstalimit) && !string.IsNullOrEmpty(pagesa) && !string.IsNullOrEmpty(paisja) && !string.IsNullOrEmpty(modeli.Value) &&
                    !string.IsNullOrEmpty(targa.Value) && !string.IsNullOrEmpty(imei.Value) && !string.IsNullOrEmpty(Nr_teli.Value) && !string.IsNullOrEmpty(Text1.Value))
                {
                    sqlConfig.strcon.Open();
                    string     query   = "select id from client where emer = '" + emer.Value + "' and IdKarte ='" + idkarte.Value + "'";
                    SqlCommand cmd     = new SqlCommand(query, sqlConfig.strcon);
                    var        gjendet = cmd.ExecuteScalar();
                    sqlConfig.strcon.Close();
                    if (Convert.ToInt32(gjendet) != 0)
                    {
                        sqlConfig.strcon.Open();

                        string     targa_unike = "  select count(id) from instalim where targa like '" + targa.Value + "'";
                        SqlCommand cmddr       = new SqlCommand(targa_unike, sqlConfig.strcon);

                        if (Convert.ToInt32(cmddr.ExecuteScalar()) != 0)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                                "err_msg",
                                                                "alert('kjo targe ekziston e rregjistruar me pare!');",
                                                                true);
                        }
                        else
                        {
                            //sqlConfig.strcon.Open();
                            string     insert_sherbim = "insert into instalim values(" + gjendet + ",'" + targa.Value + "','" + modeli.Value + "','" + paisja + "','" + imei.Value + "','+355 " + Nr_teli.Value + "','" + sherbimi + "','" + vendiInstalimit + "','" + pagesa + "','" + Text2.Value + "','" + Convert.ToString(DateTime.Now) + "','" + Text1.Value + "' )";
                            SqlCommand cmdd           = new SqlCommand(insert_sherbim, sqlConfig.strcon);
                            var        ka_sherbim     = cmdd.ExecuteNonQuery();
                            sqlConfig.strcon.Close();

                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                                "err_msg",
                                                                "alert('ky sherbim i shtua me sukses tek klienti me emer " + emer.Value.ToUpper() + "');",
                                                                true);


                            result = true;
                        }
                        sqlConfig.strcon.Close();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                            "err_msg",
                                                            "alert('ky klient nuk  egziston i rregjistruar , rregjistro klientin ne fillim');",
                                                            true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                        "err_msg",
                                                        "alert('Ploteso fushat');",
                                                        true);
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(result);

                throw ex;
            }
        }
Example #6
0
        public void kthe_info_id(string id ,string gjinia)
        {
            string emeri = string.Empty;
            string targa = string.Empty;
            sqlConfig sqlConfig = new sqlConfig();


            string query = "select Count(IdKarte) from client where IdKarte like '" + id + "' ";

            SqlCommand cmd = new SqlCommand(query, sqlConfig.strcon);
            string gjejTarge = "select t.targa , e.emer from client e inner join instalim t on e.id = t.id_klienti where e.IdKarte like '" + id + "'";
            sqlConfig.Single_Select(gjejTarge);
            sqlConfig.strcon.Open();
            var gjendet = cmd.ExecuteScalar();
            sqlConfig.strcon.Close();

            if (Convert.ToInt32(gjendet) != 0)
            {

                if (sqlConfig.dt.Rows.Count > 0)
                {
                    emeri = sqlConfig.dt.Rows[0].Field<string>("emer");
                    targa = sqlConfig.dt.Rows[0].Field<string>("targa");

                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                          "err_msg",
                          "alert('ky klient eshte i rregjistruar me emer " + emeri.ToLower() + " dhe  me targe " + targa.ToLower() + "!');",
                          true);

                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                          "err_msg",
                          "alert('ky klient eshte i rregjistruar por nuk ka akoma nje sherbim');",
                          true);
                }



            }

            else
            {
               


                string queryy = "insert into client(emer, atesi,mbiemer,IdKarte,Email, numer_kontrate , gjinia, adress,date_inserted) values('" + emer.Text + "','" + atesia.Value + "','" + mbiemri.Value + "','" + idkarte.Value + "','" + email.Value + "','" + kontrata.Value + "','" + gjinia + "','" + adresa.Value + "','" + DateTime.Now + "')";

                if (sqlConfig.insert(queryy))
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "admin()", true);

                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "operator()", true);

                }


            }


        }