示例#1
0
        public void Delete(object sender, EventArgs e)
        {
            if (ugdFormPregled.ActiveRow != null)
            {
                BusinessLogic.GrupeProizvoda.pID = Convert.ToInt32(ugdFormPregled.ActiveRow.Cells["ID"].Value);

                if (MessageBox.Show(string.Format("Obrisati Grupu proizvoda '{0}-{1}'?", BusinessLogic.TipSkladista.pID, ugdFormPregled.ActiveRow.Cells["Naziv"].Value),
                                    "Brisanje Grupe proizvoda", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    using (BusinessLogic.GrupeProizvoda objekt = new BusinessLogic.GrupeProizvoda())
                    {
                        StringBuilder message = new StringBuilder();

                        if (!objekt.Delete(message))
                        {
                            MessageBox.Show(message.ToString());
                        }
                        try
                        {
                            BusinessLogic.GrupeProizvoda.pSelectedIndex = ugdFormPregled.ActiveRow.Index;
                        }
                        catch { }
                        LoadGridData();
                    }
                }
            }
        }
示例#2
0
        private bool SaveData()
        {
            lblValidationMessages.ResetText();

            StringBuilder message = ValidateDataInput();

            if (message.Length == 0)
            {
                using (BusinessLogic.GrupeProizvoda objekt = new BusinessLogic.GrupeProizvoda())
                {
                    objekt.pNaziv = uteNaziv.Value.ToString();

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

            lblValidationMessages.Text = message.ToString();
            return(false);
        }
示例#3
0
        private void LoadForm(BusinessLogic.GrupeProizvoda objekt)
        {
            var obj = objekt.GetSelectedRow();

            if (obj != null)
            {
                uteNaziv.Value = obj["Naziv"].ToString();
            }
        }
示例#4
0
 private void FormLoad(object sender, EventArgs e)
 {
     using (BusinessLogic.GrupeProizvoda objekt = new BusinessLogic.GrupeProizvoda())
     {
         if (FormEditMode == Enums.FormEditMode.Update || FormEditMode == Enums.FormEditMode.Copy)
         {
             LoadForm(objekt);
         }
     }
 }
示例#5
0
        private void LoadGridData()
        {
            using (BusinessLogic.GrupeProizvoda objekt = new BusinessLogic.GrupeProizvoda())
            {
                ugdFormPregled.DataSource = objekt.GetMainGridData();
                ugdFormPregled.DataBind();
                Utils.Tools.UltraGridStyling(ugdFormPregled);

                if (ugdFormPregled.DisplayLayout.Bands.Count > 0)
                {
                    ugdFormPregled.DisplayLayout.Bands[0].Columns["ID"].Hidden            = true;
                    ugdFormPregled.DisplayLayout.Bands[0].Columns["Naziv"].Header.Caption = "Naziv grupe";
                }

                foreach (UltraGridRow row in ugdFormPregled.Rows)
                {
                    if (row.Index == BusinessLogic.GrupeProizvoda.pSelectedIndex)
                    {
                        ugdFormPregled.ActiveRow = row;
                    }
                }
            }
        }