Exemplo n.º 1
0
        private void RegjistroDergese(int derguar, int paderguar)
        {
            //regjistrimi i dergeses
            string strSql = "INSERT INTO DERGESA VALUES('" + DateTime.Now.ToString("yyyy-MM-dd") + "', " + derguar + ", " + paderguar + ",'Shkolla Manager')";

            conObject.ExecuteNonQuery(strSql);

            //modifikimi i llogarise
            int nr = derguar;
            int i  = 0;

            strSql = "SELECT *, (SASIA - KONSUMUAR) AS MBETUR FROM BLERJE WHERE (SASIA - KONSUMUAR) > 0";
            DataSet dsBlerje = conObject.ExecuteQuery(strSql);

            while (nr > 0)
            {
                int sasiaMod = Convert.ToInt32(dsBlerje.Tables[0].Rows[i]["MBETUR"]);
                int idBlerja = Convert.ToInt32(dsBlerje.Tables[0].Rows[i]["ID_BLERJE"]);
                if (nr >= sasiaMod)
                {
                    strSql = "UPDATE BLERJE SET KONSUMUAR = SASIA WHERE ID_BLERJE = " + idBlerja;
                    conObject.ExecuteNonQuery(strSql);
                }
                else
                {
                    strSql = "UPDATE BLERJE SET KONSUMUAR = KONSUMUAR + " + nr + " WHERE ID_BLERJE = " + idBlerja;
                    conObject.ExecuteNonQuery(strSql);
                }
                nr = nr - sasiaMod;
                i++;
            }

            KonvertoSinkronizoNeWebDergesa();
            KonvertoSinkronizoNeWebBlerje();
        }
Exemplo n.º 2
0
        private void btnDergo_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                Random rnd = new Random();
                int    alg = rnd.Next(5);
                alg = alg + 1;
                //regjistro kerkese ne bazen e te dhenave
                DateTime dtTani = DateTime.Now;
                string   strSql = "INSERT INTO KERKESA VALUES('" + dtTani.ToString("yyyy-MM-dd HH:mm") + "'," + numSMS.Value.ToString() + ", " + alg.ToString() + ")";
                conObject.ExecuteNonQuery(strSql);
                KonvertoSinkronizoNeWebKerkesa();
                strSql = "SELECT MAX(ID_KERKESA) AS MAX FROM KERKESA";
                DataSet dsMax     = conObject.ExecuteQuery(strSql);
                int     idKerkesa = Convert.ToInt32(dsMax.Tables[0].Rows[0][0]);


                //dergo email
                DergoEmail(idKerkesa, dtTani, Convert.ToInt32(numSMS.Value), alg);

                MessageBox.Show("Kërkesa juaj u dërgua!" + Environment.NewLine +
                                "Do të njoftoheni me email për mënyrën se si mund ta aktivizoni kërkesën e sapodërguar!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }