Пример #1
0
        private bool SaveData()
        {
            this.lblValidationMessages.ResetText();

            BusinessLogic.UstanoveSkolskeGodine ustanoveSkolskeGodine = new BusinessLogic.UstanoveSkolskeGodine();


            if (this.FormEditMode == Enums.FormEditMode.Insert ||
                this.FormEditMode == Enums.FormEditMode.Copy)
            {
                ustanoveSkolskeGodine.Add((int?)(this.ComboBoxUstanova.Value != null ? this.ComboBoxUstanova.Value : null),
                                          (int?)(this.ComboBoxSkolskaGodina.Value != null ? this.ComboBoxSkolskaGodina.Value : null));
            }
            else if (this.FormEditMode == Enums.FormEditMode.Update)
            {
                ustanoveSkolskeGodine.Update(this.ID.Value, (int?)(this.ComboBoxUstanova.Value != null ? this.ComboBoxUstanova.Value : null),
                                             (int?)(this.ComboBoxSkolskaGodina.Value != null ? this.ComboBoxSkolskaGodina.Value : null));
            }

            if (ustanoveSkolskeGodine.IsValid)
            {
                return(ustanoveSkolskeGodine.Persist());
            }
            else
            {
                ustanoveSkolskeGodine.DisplayValidationMessages(this);
            }

            return(false);
        }
Пример #2
0
        public void Delete(object sender, EventArgs e)
        {
            if (this.UltraGridUstanoveSkolskeGodine.ActiveRow != null)
            {
                int id = Convert.ToInt32(this.UltraGridUstanoveSkolskeGodine.ActiveRow.Cells["ID"].Value);

                if (MessageBox.Show(string.Format("Obrisati ustanovu / školsku godinu '{0}-{1} / {2}'?", id, this.UltraGridUstanoveSkolskeGodine.ActiveRow.Cells["Ustanova"].Value,
                                                  this.UltraGridUstanoveSkolskeGodine.ActiveRow.Cells["SkolskaGodina"].Value),
                                    "Brisanje ustanove / školske godine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    BusinessLogic.UstanoveSkolskeGodine ustanoveSkolskeGodine = new BusinessLogic.UstanoveSkolskeGodine();
                    ustanoveSkolskeGodine.Delete(id);

                    if (ustanoveSkolskeGodine.IsValid)
                    {
                        ustanoveSkolskeGodine.Persist();
                        LoadGridUstanoveSkolskeGodine();
                    }
                    else
                    {
                        ustanoveSkolskeGodine.DisplayValidationMessages();
                    }
                }
            }
        }