private void buttonSave_Click(object sender, EventArgs e)
        {
            if (Tip == 0)//dodaj
            {
                if (validacija())
                {
                    Delo           = new KrivicnaDela();
                    Delo.NazivDela = textBoxNazivDela.Text;
                    Delo.OpisDela  = textBoxOpisDela.Text;
                    Delo.BrojDana  = Int32.Parse(textBoxBrojDana.Text);

                    DateTime dateTime1    = dateTimePickerDatumPresude.Value;
                    String   dan1         = dateTime1.Day.ToString();
                    String   mesec1       = dateTime1.Month.ToString();
                    String   godina1      = dateTime1.Year.ToString();
                    String   datumPresude = mesec1 + "." + dan1 + "." + godina1;
                    Delo.DatumOsudjivanja = datumPresude;

                    this.Close();
                    DialogResult = DialogResult.OK;
                }
            }
            if (Tip == 1)
            {
                this.Close();
                DialogResult = DialogResult.No;
            }
        }
 private void RetrieveInfo(KrivicnaDela d)
 {
     textBoxId.Text                  = d.Id.ToString();
     textBoxNazivDela.Text           = d.NazivDela;
     textBoxBrojDana.Text            = d.BrojDana.ToString();
     textBoxOpisDela.Text            = d.OpisDela;
     dateTimePickerDatumPresude.Text = d.DatumOsudjivanja;
 }
コード例 #3
0
        public static KrivicnaDela GetDelo(String id)
        {
            var connectionString = "mongodb://localhost/?safe=true";
            var server           = MongoServer.Create(connectionString);
            var database         = server.GetDatabase("sistemzatvora");

            var          collection = database.GetCollection <KrivicnaDela>("krivicnadela");
            KrivicnaDela d          = collection.Find(Query.EQ("_id", ObjectId.Parse(id))).FirstOrDefault();

            return(d);
        }
コード例 #4
0
        private void buttonPrikaziDelo_Click(object sender, EventArgs e)
        {
            if (listViewKrivicnaDela.SelectedItems.Count == 0)
            {
                return;
            }
            String       id = listViewKrivicnaDela.SelectedItems[0].SubItems[0].Text;
            KrivicnaDela kd = DataManager.GetDelo(id);



            FormKrivicnoDelo f = new FormKrivicnoDelo();

            f.Tip  = 1;
            f.Delo = kd;


            f.Show();
        }