Example #1
0
        public bool RegisterPageTRANSACTION(string email, string nume, string oras, string telefon, string judet, string parola)
        {
            ///////////////////////////////////////////////////////////////////////////////
            using (TransactionScope trans = new TransactionScope())
            {
                var context = new OLXDataContext();

                var res = from u in context.DB_USERs
                          where u.NUME.ToString() == email
                          select new { u.ID };
                List <string> temp = new List <string>();
                foreach (var item in temp)
                {
                    temp.Add(item.ToString());
                }
                if (temp.Count != 0)
                {
                    return(false);//exista contul
                }
                context.tranSignIn(email, nume, telefon, judet, oras, parola);
                context.SubmitChanges();
                this.Close();
                Login l = new Login();
                l.Show();
                trans.Complete();
                return(true);
            }
            //////////////////////////////////////////////////////////////////////////////////////
        }
Example #2
0
        public bool LoginPageTRANSACTION(string email, string hash_parola)
        {
            ///////////////////////////////////////////////////////////////////////////////
            using (TransactionScope trans = new TransactionScope())
            {
                var    context  = new OLXDataContext();
                string parolaBD = "";

                var rez = from ps in context.DB_PASSWORDs
                          select new { ps.PAROLA, ps.ID_USER };
                foreach (var item in rez)
                {
                    if (item.ID_USER == email)
                    {
                        parolaBD = item.PAROLA.ToString();
                    }
                }

                if (parolaBD != hash_parola)
                {
                    MessageBox.Show("Email sau parola gresita", "EROARE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                var log = from l in context.DB_LOGINs
                          where l.ID_USER == email
                          select l.ID_USER;
                List <string> temp = new List <string>();
                foreach (var item in log)
                {
                    temp.Add(item.ToString());
                }
                if (temp.Count != 0)
                {
                    var log1 = from l in context.DB_LOGINs
                               where l.ID_USER == email
                               select l.DATA_DELOGAT;
                    List <string> temp1 = new List <string>();
                    foreach (var item in log1)
                    {
                        temp1.Add(item.ToString());
                    }
                    if (temp1.Count == 0)
                    {
                        MessageBox.Show("Sunteti deja conectat", "ATENTIE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }
                }

                context.tranLogIn(email, hash_parola);
                context.SubmitChanges();

                this.Close();
                trans.Complete();
                return(true);
            }
            //////////////////////////////////////////////////////////////////////////////////////
        }
Example #3
0
        public MainPage()
        {
            var dbContext = new OLXDataContext();

            InitializeComponent();
            panel3.Top    = 4;
            panel3.Left   = 961;
            panel3.Width  = 151;
            panel3.Height = 52;
            panel_up.Controls.Add(panel3);


            dbContext.SubmitChanges();

            var result1 = from j in dbContext.DB_RO_COUNTies
                          select j.NUME_JUDET;

            foreach (var item in result1)
            {
                comboBox1.Items.AddRange(new object[] { item.ToString() });
            }
            var result2 = from o in dbContext.DB_RO_CITies
                          select o.NUME_ORAS;

            foreach (var item in result2)
            {
                comboBox2.Items.AddRange(new object[] { item.ToString() });
            }
            comboBox3.Items.AddRange(new object[] { "Toate" });
            comboBox3.Items.AddRange(new object[] { "lei" });
            comboBox3.Items.AddRange(new object[] { "euro" });

            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 0;

            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource          = printPromotedAnounces(); //dbContext.spGetFirstDisplay();//
            //dataGridView1.Columns["ID"].Visible = false;
            dataGridView1.Refresh();
        }
Example #4
0
        private void btnAdaugaAnunt_Click(object sender, EventArgs e)
        {
            string titlu    = tboxTitlu.Text;
            string stare    = tboxStare.Text;
            string categ    = comboBoxCategorie.Text;
            string subcateg = comboBoxSubcategorie.Text;
            int    pret     = Convert.ToInt32(tboxPret.Text.ToString());
            bool   negociabil;

            if (cboxNegociabil.Checked)
            {
                negociabil = true;
            }
            else
            {
                negociabil = false;
            }
            string descriere    = tboxDescriere.Text;
            string locIntalnire = richTextBoxLocIntalnire.Text;


            var context = new OLXDataContext();

            context.spADDprod(Program.OLXusername, titlu, stare, categ, subcateg, pret, negociabil, descriere, locIntalnire, ConvertFiletoByte(this.pictureBox1.ImageLocation));
            context.SubmitChanges();

            if (categ == "Auto, Moto, Ambarcatiuni") // autoturisme
            {
                autoMarca           = cboxMarca.Text;
                autoModel           = tboxModel.Text;
                autoCuloare         = tboxCuloareAuto.Text;
                autoCutieViteze     = tboxCutieViteze.Text;
                autoAn              = tboxAnAuto.Text;
                autoNrKM            = tboxRulaj.Text;
                autoCaroserie       = tboxCaroserie.Text;
                autoCombustibil     = tboxFuel.Text;
                autoCapacitateMotor = tboxMotor.Text;

                context.spADDprod_details_auto(Program.OLXusername, titlu, autoMarca, autoModel, autoCuloare, autoCutieViteze, autoAn, autoNrKM, autoCaroserie, autoCombustibil, autoCapacitateMotor);
                context.SubmitChanges();
            }
            if (categ == "Locuri de munca")
            {
                muncaTip     = tboxTipMunca.Text;
                muncaTipMob  = tboxTipMobilitate.Text;
                muncaSalariu = Convert.ToInt32(tboxSalariu.Text.ToString());

                context.spADDprod_details_work(Program.OLXusername, titlu, muncaTip, muncaTipMob, muncaSalariu);
                context.SubmitChanges();
            }
            if (categ == "Moda & frumusete")
            {
                fashionTipArticol = tboxTipArticolVestimentar.Text;
                fashionMarimea    = tboxCutieViteze.Text;
                fashionCuloare    = tboxCuloareModa.Text;
                fashionMarca      = tboxMarcaModa.Text;

                context.spADDprod_details_fashion(Program.OLXusername, titlu, fashionTipArticol, fashionMarimea, fashionCuloare, fashionMarca);
                context.SubmitChanges();
            }
            if (categ == "Imobiliare")
            {
                casaCamere          = tboxNrCamere.Text;
                casaSuprafata       = tboxSuprafata.Text;
                casaCompartimentare = tboxCompartimente.Text;
                casaAn          = tboxAnCasa.Text;
                casaTipVanzator = tboxTipVanzator.Text;
                if (checkboxParcare.Checked)
                {
                    casaParcare = true;
                }
                else
                {
                    casaParcare = false;
                }
                casaSuprafataCurte = tboxSupCurte.Text;

                context.spADDprod_details_house(Program.OLXusername, titlu, casaCamere, casaSuprafata, casaCompartimentare, casaAn, casaTipVanzator, casaParcare, casaSuprafata);
                context.SubmitChanges();
            }

            InsertKeyWords(Convert.ToInt32(context.spGetIDAnunt(Program.OLXusername, titlu).ToString()), titlu, pret);
            MessageBox.Show("Anunt adaugat cu succes!");
            this.Close();
        }