Ejemplo n.º 1
0
        private void ugdFormPregled_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.D0)
            {
                if (ugdFormPregled.DisplayLayout.Bands.Count > 0)
                {
                    if (ugdFormPregled.DisplayLayout.Bands[0] == ugdFormPregled.ActiveRow.Band)
                    {
                        if (ugdFormPregled.ActiveRow.Cells["Zaduzen"].Value.ToString() == "False")
                        {
                            DialogResult result = MessageBox.Show("želite li zadužiti označenu izdatnicu na skladište?", "Izdatnica na skladište", MessageBoxButtons.YesNo);

                            if (result == DialogResult.Yes)
                            {
                                this.Cursor = Cursors.WaitCursor;
                                using (BusinessLogic.Izdatnica objekt = new BusinessLogic.Izdatnica())
                                {
                                    StringBuilder message = new StringBuilder();

                                    objekt.IzdatnicaNaSkladiste(message, Convert.ToInt32(ugdFormPregled.ActiveRow.Cells["ID"].Value));

                                    if (message.Length > 0)
                                    {
                                        MessageBox.Show(message.ToString());
                                    }
                                    else
                                    {
                                        MessageBox.Show("Izdatnica usješno zadužena!");
                                    }
                                }

                                BusinessLogic.Izdatnica.pSelectedIndex = ugdFormPregled.ActiveRow.Index;
                                LoadGridData();
                                this.Cursor = Cursors.Default;
                            }
                        }
                    }
                }
            }
        }