Ejemplo n.º 1
0
        private void cmdADD_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:
                Pembelian.frmDOBeliUpdate ifrmChild = new Pembelian.frmDOBeliUpdate(this);
                ifrmChild.MdiParent = Program.MainForm;
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.Show();
                break;

            case enumSelectedGrid.DetailSelected:
                if (!CekAddEditDel())
                {
                    return;
                }
                //GlobalVar.LastClosingDate = (DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglRequest"].Value;
                //if ((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglRequest"].Value <= GlobalVar.LastClosingDate)
                //{
                //    throw new Exception(String.Format(Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                //}

                opendetail();

                break;
            }
        }
Ejemplo n.º 2
0
        private void cmdEDIT_Click(object sender, EventArgs e)
        {
            if (!CekAddEditDel())
            {
                return;
            }
            Guid rowID;
            bool Closing_ = false;

            Closing_ = (DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglRequest"].Value < GlobalVar.LastClosingDate? true : false;
            GlobalVar.LastClosingDate = (DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglRequest"].Value;


            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:
                rowID = (Guid)dataGridHeader.SelectedCells[0].OwningRow.Cells["HeaderRowID"].Value;
                Pembelian.frmDOBeliUpdate ifrmChild = new Pembelian.frmDOBeliUpdate(this, rowID, Closing_);
                ifrmChild.MdiParent = Program.MainForm;
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.Show();
                break;

            case enumSelectedGrid.DetailSelected:
                if (dataGridDetail.SelectedCells.Count == 0)
                {
                    MessageBox.Show(Messages.Error.RowNotSelected);
                    return;
                }
                //if (Closing_)
                //{
                //    throw new Exception(String.Format(Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                //}
                try
                {
                    rowID = (Guid)dataGridDetail.SelectedCells[0].OwningRow.Cells["DetailRowID"].Value;
                    Pembelian.frmDOBeliDetailUpdate ifrmChild2 = new Pembelian.frmDOBeliDetailUpdate(this, rowID, frmDOBeliDetailUpdate.enumFormMode.Update);
                    ifrmChild2.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild2);
                    ifrmChild2.Show();
                }
                catch (System.Exception ex)
                {
                    Error.LogError(ex);
                }
                break;
            }
        }
Ejemplo n.º 3
0
        private void cmdADD_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:
                Pembelian.frmDOBeliUpdate ifrmChild = new Pembelian.frmDOBeliUpdate(this);
                ifrmChild.MdiParent = Program.MainForm;
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.Show();
                break;

            case enumSelectedGrid.DetailSelected:
                if (!CekAddEditDel())
                {
                    return;
                }
                try
                {
                    //GlobalVar.LastClosingDate = (DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglRequest"].Value;
                    //if ((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglRequest"].Value <= GlobalVar.LastClosingDate)
                    //{
                    //    throw new Exception(String.Format(Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                    //}
                    Guid headerID = (Guid)dataGridHeader.SelectedCells[0].OwningRow.Cells["HeaderRowID"].Value;
                    Pembelian.frmDOBeliDetailUpdate ifrmChild2 = new Pembelian.frmDOBeliDetailUpdate(this, headerID, frmDOBeliDetailUpdate.enumFormMode.New);
                    ifrmChild2.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild2);
                    ifrmChild2.Show();
                }
                catch (System.Exception ex)
                {
                    Error.LogError(ex);
                }

                break;
            }
        }