Esempio n. 1
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            try
            {
                GlobalVar.LastClosingDate = (DateTime)dataGridPeminjaman.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value;
                if ((DateTime)dataGridPeminjaman.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value <= GlobalVar.LastClosingDate)
                {
                    throw new Exception(string.Format(ISA.Toko.Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                }
                switch (selectedGrid)
                {
                case enumSelectedGrid.HeaderSelected:
                    if (dataGridPeminjaman.SelectedCells.Count > 0)
                    {
                        if ((dataGridPeminjaman.SelectedCells[0].OwningRow.Cells["SyncFlag"].Value.ToString() == "1") || _Print > 0)
                        {
                            if (!SecurityManager.AskPasswordManager())
                            {
                                return;
                            }
                        }
                        ArusStock.frmPeminjamanUpdate ifrmChild = new ArusStock.frmPeminjamanUpdate(this, _RowID);
                        ifrmChild.MdiParent = Program.MainForm;
                        Program.MainForm.RegisterChild(ifrmChild);
                        ifrmChild.Show();
                    }
                    break;

                case enumSelectedGrid.DetailSelected:
                    if (dataGridPeminjamanDetail.SelectedCells.Count > 0)
                    {
                        if ((dataGridPeminjamanDetail.SelectedCells[0].OwningRow.Cells["SyncFlagD"].Value.ToString() == "1") || _Print > 0)
                        {
                            if (!SecurityManager.AskPasswordManager())
                            {
                                return;
                            }
                        }
                        ArusStock.frmPeminjamanDetailUpdate ifrmChild = new ArusStock.frmPeminjamanDetailUpdate(this, _RowIDD, _HeaderIDD);
                        ifrmChild.MdiParent = Program.MainForm;
                        Program.MainForm.RegisterChild(ifrmChild);
                        ifrmChild.Show();
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Esempio n. 2
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:
                if (dataGridPeminjaman.SelectedCells.Count > 0 || dataGridPeminjaman.SelectedCells.Count == 0)
                {
                    ArusStock.frmPeminjamanUpdate ifrmChild = new ArusStock.frmPeminjamanUpdate(this);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
                break;

            case enumSelectedGrid.DetailSelected:
                try
                {
                    if (dataGridPeminjaman.SelectedCells.Count > 0)
                    {
                        GlobalVar.LastClosingDate = (DateTime)dataGridPeminjaman.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value;
                        if ((DateTime)dataGridPeminjaman.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value <= GlobalVar.LastClosingDate)
                        {
                            throw new Exception(string.Format(ISA.Toko.Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                        }
                        ArusStock.frmPeminjamanDetailUpdate ifrmChild = new ArusStock.frmPeminjamanDetailUpdate(this, _RowID, _RecordID);
                        ifrmChild.MdiParent = Program.MainForm;
                        Program.MainForm.RegisterChild(ifrmChild);
                        ifrmChild.Show();
                    }
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }

                break;
            }
        }