Example #1
0
        private bool SaveData()
        {
            lblValidationMessages.ResetText();

            BusinessLogic.NacinIsporuke.pNaziv = BusinessLogic.NacinIsporuke.IsDbNull <string>(uteNaziv.Value);

            StringBuilder message = ValidateDataInput();

            if (message.Length == 0)
            {
                BusinessLogic.NacinIsporuke objekt = new BusinessLogic.NacinIsporuke();

                if (FormEditMode == Enums.FormEditMode.Insert || FormEditMode == Enums.FormEditMode.Copy)
                {
                    if (objekt.Insert(message))
                    {
                        FormEditMode = Enums.FormEditMode.Update;
                        return(true);
                    }
                }
                else if (this.FormEditMode == Enums.FormEditMode.Update)
                {
                    if (objekt.Update(message))
                    {
                        return(true);
                    }
                }
            }

            lblValidationMessages.Text = message.ToString();
            return(false);
        }
Example #2
0
        private void LoadGridNacinIsporuke()
        {
            BusinessLogic.NacinIsporuke objekt = new BusinessLogic.NacinIsporuke();

            ugdNacinIsporuke.DataSource = objekt.GetNacinIsporukeMainGrid();
            ugdNacinIsporuke.DataBind();
            Utils.Tools.UltraGridStyling(ugdNacinIsporuke);

            foreach (UltraGridRow row in ugdNacinIsporuke.Rows)
            {
                if (row.Index == BusinessLogic.NacinIsporuke.pSelectedIndex)
                {
                    ugdNacinIsporuke.ActiveRow = row;
                }
            }
        }
Example #3
0
        public void Delete(object sender, EventArgs e)
        {
            if (ugdNacinIsporuke.ActiveRow != null)
            {
                BusinessLogic.NacinIsporuke.pID = Convert.ToInt32(ugdNacinIsporuke.ActiveRow.Cells["ID"].Value);

                if (MessageBox.Show(string.Format("Obrisati nacin isporuke '{0}-{1}'?", BusinessLogic.CPVOznake.pID, ugdNacinIsporuke.ActiveRow.Cells["Naziv"].Value),
                    "Brisanje način isporuke", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    BusinessLogic.NacinIsporuke objekt = new BusinessLogic.NacinIsporuke();
                    if (!objekt.Delete())
                    {
                        MessageBox.Show("Dogodila se greška prilikom brisanja načina isporuke.\nKontaktirajte administratora [Error:00022]");
                    }
                    LoadGridNacinIsporuke();
                }
            }
        }