Exemplo n.º 1
0
        private void NapuniKorisnika()
        {
            string connection_string = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};",
                                                     "mssql6.mojsite.com,1555", "vugergrad_chat", "vugergrad_chat", "chatajMO2010");


            Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient(connection_string);

            lblNazivUstanove.Text = client.ExecuteScalar("Select Ime From Korisnici Where OIB = '" + uscChat.oib_korisnika + "'").ToString();

            if (!uscChat.pValidiran)
            {
                if (System.Environment.UserName.ToString().Length < 30)
                {
                    txtKorisnickoIme.Text = System.Environment.UserName.ToString();
                }
                else
                {
                    txtKorisnickoIme.Text = string.Empty;
                }
            }
            else
            {
                txtKorisnickoIme.Text = client.ExecuteScalar("Select KorisnickoIme From Korisnici Where OIB = '" + uscChat.oib_korisnika + "'").ToString();
            }
        }
Exemplo n.º 2
0
        public void ZakljucnoStanje(object sender, EventArgs e)
        {
            Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient();
            try
            {
                DialogResult result = MessageBox.Show("Zelite li napraviti prijenos zaključnog stanja u novu godinu?", "Zaključno stanje", MessageBoxButtons.YesNo);

                if (result == DialogResult.Yes)
                {
                    int year           = Convert.ToInt32(client.ExecuteScalar("Select IDGODINE From GODINE Where GODINEAKTIVNA = 1"));
                    int next_year      = year + 1;
                    int broj_dokumenta = Convert.ToInt32(client.ExecuteScalar("Select Max(BrojDokumenta) From GKSTAVKA Where IDDOKUMENT = 1"));


                    client.ExecuteNonQuery("Insert Into GKSTAVKA Select '01.01." + next_year + "',1, BROJSTAVKE,IDDOKUMENT,IDMJESTOTROSKA,IDORGJED,IDKONTO,'početno stanje', " +
                                           "duguje, POTRAZUJE, '01.01." + next_year + "', IDPARTNER, ZATVORENIIZNOS, 0, ORIGINALNIDOKUMENT, " + next_year + ", GKDATUMVALUTE From GKSTAVKA " +
                                           "Where IDDOKUMENT = 1 And BROJDOKUMENTA = " + broj_dokumenta + " And GKGODIDGODINE = " + year + "");


                    client.ExecuteNonQuery("DECLARE @temp as money Update GKSTAVKA Set @temp = duguje, duguje = POTRAZUJE, POTRAZUJE = @temp " +
                                           "Where IDDOKUMENT = 1 And GKGODIDGODINE = " + next_year + " And BROJDOKUMENTA = 1");

                    IzmjenaKontniPlan(next_year, client);

                    MessageBox.Show("Molimo provjerite točnost podataka te u slučaju pogreške nazovite T4S.");
                }
            }
            catch { MessageBox.Show("Dogodila se greška prilikom prijenosa. Molimo nazovite T4S."); }
        }
Exemplo n.º 3
0
 private int GetNextIzvod(object p)
 {
     try
     {
         return(Convert.ToInt32(client.ExecuteScalar("Select Max(BROJDOKUMENTA) From GKSTAVKA Where GKGODIDGODINE = '" + p + "' And IDDOKUMENT = 4")) + 1);
     }
     catch { return(1); }
 }
Exemplo n.º 4
0
        private bool ProvjeraKorisnika()
        {
            string connection_string = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};",
                                                     "mssql6.mojsite.com,1555", "vugergrad_chat", "vugergrad_chat", "chatajMO2010");

            client = new Mipsed7.DataAccessLayer.SqlClient(connection_string);

            object oib_chat = client.ExecuteScalar("Select OIB FROM Korisnici Where OIB = '" + oib_korisnika + "'");

            if (oib_chat != null)
            {
                pValidiran = Convert.ToBoolean(client.ExecuteScalar("Select Validiran From Korisnici Where OIB = '" + oib_korisnika + "'"));

                if (pValidiran)
                {
                    pBlokiran = Convert.ToBoolean(client.ExecuteScalar("Select Blokiran From Korisnici Where OIB = '" + oib_korisnika + "'"));

                    if (!pBlokiran)
                    {
                        pKorisnickoIme           = client.ExecuteScalar("Select KorisnickoIme From Korisnici Where OIB = '" + oib_korisnika + "'").ToString();
                        pID_Korisnika            = Convert.ToInt32(client.ExecuteScalar("Select ID From Korisnici Where OIB = '" + oib_korisnika + "'"));
                        btnPosaljiPoruku.Enabled = true;
                        return(true);
                    }
                    else
                    {
                        MessageBox.Show("Vaš pristup chatu je blokiran od strane administratora.\nZa pomoć se obratite u Tools for Schools.");
                        btnPosaljiPoruku.Enabled = false;
                        return(false);
                    }
                }
                else
                {
                    MessageBox.Show("Da bi pristupili chatu potrebno je napraviti registraciju.");
                    btnPosaljiPoruku.Enabled = false;

                    using (frmRegistracija registracija = new frmRegistracija())
                    {
                        if (registracija.ShowDialog() == DialogResult.OK)
                        {
                            UpdateKorisnika();
                            if (ProvjeraKorisnika())
                            {
                                PaljenjeServisa();
                            }
                        }
                    }

                    return(false);
                }
            }
            else
            {
                MessageBox.Show("Vaš OIB se ne nalazi na listi osoba koje imaju pristup chatu.\nZa aktiviranje chata javite se u Tools for Schools.");
                btnPosaljiPoruku.Enabled = false;
                return(false);
            }
        }
Exemplo n.º 5
0
        private bool ValidacijaKorisnika()
        {
            string connection_string = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};",
                                                     "mssql6.mojsite.com,1555", "vugergrad_chat", "vugergrad_chat", "chatajMO2010");

            Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient(connection_string);

            //provjera dili postoji vec to korisnicko ime
            string korisnicko_ime = txtKorisnickoIme.Text.Trim();

            if (korisnicko_ime.Length > 30)
            {
                MessageBox.Show("Korisničko ime ne smije sadržavati više od 30 znakova");
                return(false);
            }

            int count = Convert.ToInt32(client.ExecuteScalar("Select Count(ID) From Korisnici Where KorisnickoIme = '" + korisnicko_ime + "'"));

            if (count > 0)
            {
                MessageBox.Show("Korisničko ime već postoji u bazi.\nUnesite drugo korisničko ime.");
                return(false);
            }
            return(true);
        }
Exemplo n.º 6
0
        private bool ProvjeraZaMinus(decimal kolicina, decimal stanje)
        {
            Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient();

            string materijalno = client.ExecuteScalar("Select Distinct Materijalno From Korisnik").ToString();

            if (materijalno == "True" & (stanje - kolicina) < 0)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 7
0
        private void frmLogoPath_Load(object sender, EventArgs e)
        {
            string putanja = client.ExecuteScalar("Select Top 1 Logo From Korisnik").ToString();

            if (putanja.Length > 0)
            {
                lblPutanja.Text = "Postavljena putanja za logo je: \n\r" + putanja;
            }
            else
            {
                lblPutanja.Text = "Odaberite lokaciju na kojoj će se nalaziit logo.";
            }
        }
Exemplo n.º 8
0
        private bool ProvjeraRadnikaZAJOPPD()
        {
            Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient();

            try
            {
                string var = client.ExecuteScalar("Select ID From JOPPDAObracun Where OBRACUN_ID = '" + CurrentDataRow["DDIDRADNIK"].ToString() + "'").ToString();
                return(false);
            }
            catch
            {
                return(true);
            }
        }
Exemplo n.º 9
0
        private void UpdateKorisnika()
        {
            string connection_string = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};",
                                                     "mssql6.mojsite.com,1555", "vugergrad_chat", "vugergrad_chat", "chatajMO2010");

            client = new Mipsed7.DataAccessLayer.SqlClient(connection_string);

            string stari_korisnik = client.ExecuteScalar("Select KorisnickoIme From Korisnici Where OIB = '" + oib_korisnika + "'").ToString();

            client.ExecuteNonQuery("Update Korisnici Set KorisnickoIme = '" + pKorisnickoIme + "', Validiran = '" + pValidiran + "' " +
                                   "Where OIB = '" + oib_korisnika + "'");

            chat_service.RemoveUser(stari_korisnik);
        }
Exemplo n.º 10
0
        public uscChat()
        {
            InitializeComponent();

            this.smartPartInfo1 = new SmartPartInfo("Chat", "Chat");
            this.infoProvider   = new SmartPartInfoProvider();
            this.infoProvider.Items.Add(this.smartPartInfo1);

            oib_korisnika = client.ExecuteScalar("Select KORISNIKOIB From Korisnik").ToString();
            PodesavanjePanela();
            pArrayUsera = new ArrayList();
            if (ProvjeraKorisnika())
            {
                PaljenjeServisa();
            }
        }
Exemplo n.º 11
0
        public void Razred(object sender, EventArgs e)
        {
            DialogResult message = MessageBox.Show("Jeste li sigurni da želite napraviti podizanje godine svim učenicima?", "Podizanje školske godine", MessageBoxButtons.YesNo);

            if (message == DialogResult.Yes)
            {
                Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient();

                int max_razred = Convert.ToInt32(client.ExecuteScalar("Select Max(Razred) From Ucenik Where Len(Razred) < 3").ToString());

                client.ExecuteNonQuery("Update Ucenik Set Razred = YEAR(GETDATE()) Where Razred = " + max_razred);

                for (int i = max_razred; i > 1; i--)
                {
                    client.ExecuteNonQuery("Update Ucenik Set Razred = " + i + " Where Razred = " + (i - 1));
                }

                this.FillData();
                MessageBox.Show("Podizanje školske godine je izvršeno.", "Podizanje školske godine");
            }
        }
Exemplo n.º 12
0
        private void LoadRKPKorisnika()
        {
            Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient();

            label12.Text = "- " + client.ExecuteScalar("Select Top(1) RKP From Korisnik").ToString();
        }
Exemplo n.º 13
0
        public void Ispis(object sender, EventArgs e)
        {
            if (ugdOdobrenje.ActiveRow != null)
            {
                ReportDocument rpt = new ReportDocument();
                rpt.Load(System.Windows.Forms.Application.StartupPath + @"\FinposIzvjestaji\Odobrenje.rpt");

                // Set connection string from config in existing LogonProperties
                rpt.DataSourceConnections[0].SetConnection(Mipsed7.Core.ApplicationDatabaseInformation.ServerName, Mipsed7.Core.ApplicationDatabaseInformation.DatabaseName, true);
                rpt.DataSourceConnections[0].SetLogon(Mipsed7.Core.ApplicationDatabaseInformation.SqlUserName, Mipsed7.Core.ApplicationDatabaseInformation.SqlPassword);
                rpt.DataSourceConnections[0].IntegratedSecurity = false;

                Odobrenje.pID = (int)ugdOdobrenje.ActiveRow.Cells["ID"].Value;

                using (Odobrenje objekt = new Odobrenje())
                {
                    rpt.SetDataSource(objekt.GetOdobrenjeIspis());

                    KORISNIKDataSet set2 = new KORISNIKDataSet();
                    new KORISNIKDataAdapter().Fill(set2);

                    if (set2.KORISNIK.Rows.Count > 0)
                    {
                        rpt.SetParameterValue("naziv", RuntimeHelpers.GetObjectValue(set2.KORISNIK.Rows[0]["KORISNIK1NAZIV"]));
                        rpt.SetParameterValue("oib", RuntimeHelpers.GetObjectValue(set2.KORISNIK.Rows[0]["KORISNIKOIB"]));
                        rpt.SetParameterValue("adresa", RuntimeHelpers.GetObjectValue(set2.KORISNIK.Rows[0]["KORISNIK1ADRESA"]));
                    }

                    // podesavanje loga na ispisu, ukoliko nije podesena lokacija za logo, gleda staru logiku
                    Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient();
                    string putanja = client.ExecuteScalar("Select Top 1 Logo From Korisnik").ToString();

                    if (putanja.Length == 0)
                    {
                        try
                        {
                            rpt.SetParameterValue("logoPath", string.Empty);

                            string logoPath = AppDomain.CurrentDomain.BaseDirectory + @"Resources\logo_135_135.jpg";

                            if (System.IO.File.Exists(logoPath))
                            {
                                rpt.SetParameterValue("logoPath", logoPath);
                            }
                        }
                        catch { }
                    }
                    else
                    {
                        rpt.SetParameterValue("logoPath", putanja);
                    }

                    ExtendedWindowWorkspace workspace = new ExtendedWindowWorkspace();
                    PreviewReportWorkItem   item      = this.Controller.WorkItem.Items.Get <PreviewReportWorkItem>("Pregled");
                    if (item == null)
                    {
                        item = this.Controller.WorkItem.Items.AddNew <PreviewReportWorkItem>("Pregled");
                    }
                    item.Izvjestaj = rpt;
                    item.Activate();
                    item.Show(item.Workspaces["main"]);
                }
            }
        }