Пример #1
0
        private bool SaveData()
        {
            lblValidationMessages.ResetText();
            BusinessLogic.Obracuni Obracuni = new BusinessLogic.Obracuni();

            StringBuilder message = ValidateDataInput();

            if (message.Length == 0)
            {
                Obracuni.pShema_id_dokumenta = (int)ucbDokumentiShema.Value;
                Obracuni.pShema_naziv        = txtNaziv.Text.Trim();

                if (FormEditMode == Enums.FormEditMode.Insert || FormEditMode == Enums.FormEditMode.Copy)
                {
                    if (!Obracuni.InsertShema())
                    {
                        return(false);
                    }
                }
                else if (FormEditMode == Enums.FormEditMode.Update)
                {
                    if (!Obracuni.EditShema())
                    {
                        return(false);
                    }
                }
                bool persist = Obracuni.Persist();
                if (persist)
                {
                    FormEditMode = Enums.FormEditMode.Update;
                    return(true);
                }
                return(false);
            }
            else
            {
                lblValidationMessages.Text = message.ToString();
                return(false);
            }
        }