예제 #1
0
        private void commandButton1_Click(object sender, EventArgs e)
        {
            try
            {
                bool Closing = false;

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

                if (dataGridHeader.SelectedCells[0].OwningRow.Cells["TglKirim"].Value.ToString() != "")
                {
                    if ((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglKirim"].Value != GlobalVar.DateOfServer)
                    {
                        MessageBox.Show("TglKirim sudah terisi dan tidak sama dengan datetime server");
                        return;
                    }
                }
                Guid rowID = (Guid)dataGridHeader.SelectedCells[0].OwningRow.Cells["HeaderRowID"].Value;
                Pembelian.frmMPRBeliUpdate ifrmChild = new Pembelian.frmMPRBeliUpdate(this, rowID, Closing, "edit tgl kirim");
                ifrmChild.MdiParent = Program.MainForm;
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.Show();
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
예제 #2
0
        private void cmdADD_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.HeaderSelected:
                Pembelian.frmMPRBeliUpdate ifrmChild = new Pembelian.frmMPRBeliUpdate(this);
                ifrmChild.MdiParent = Program.MainForm;
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.Show();
                break;

            case enumSelectedGrid.DetailSelected:
                try
                {
                    if (!CekAddEditDelDetail("add"))
                    {
                        return;
                    }
                    if (int.Parse(dataGridHeader.SelectedCells[0].OwningRow.Cells["NPrint"].Value.ToString()) > 0 && !SecurityManager.IsManager())
                    {
                        if (!SecurityManager.AskPasswordManager())
                        {
                            return;
                        }
                    }
                    GlobalVar.LastClosingDate = (DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value;
                    if ((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value <= GlobalVar.LastClosingDate)
                    {
                        throw new Exception(string.Format(ISA.Trading.Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                    }

                    Guid rowID = (Guid)dataGridHeader.SelectedCells[0].OwningRow.Cells["HeaderRowID"].Value;
                    Pembelian.frmMPRBeliDetailUpdate ifrmChild2 = new Pembelian.frmMPRBeliDetailUpdate(this, rowID);
                    ifrmChild2.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild2);
                    ifrmChild2.Show();
                }
                catch (Exception ex)
                {
                    Error.LogError(ex);
                }
                break;
            }
        }
예제 #3
0
        private void cmdEDIT_Click(object sender, EventArgs e)
        {
            Guid rowID;

            try
            {
                //int a = 0;
                //a = Convert.ToInt32(Tools.isNull(dataGridHeader.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value,"0"));
                bool Closing = false;

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



                switch (selectedGrid)
                {
                case enumSelectedGrid.HeaderSelected:
                    if (((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value < GlobalVar.LastClosingDate))
                    {
                        throw new Exception(string.Format(ISA.Trading.Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                    }

                    if (!CekEditDelHeader("edit"))
                    {
                        return;
                    }
                    if (int.Parse(dataGridHeader.SelectedCells[0].OwningRow.Cells["NPrint"].Value.ToString()) > 0 && !SecurityManager.IsManager())
                    {
                        if (!SecurityManager.AskPasswordManager())
                        {
                            return;
                        }
                    }

                    rowID = (Guid)dataGridHeader.SelectedCells[0].OwningRow.Cells["HeaderRowID"].Value;
                    Pembelian.frmMPRBeliUpdate ifrmChild = new Pembelian.frmMPRBeliUpdate(this, rowID, Closing);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                    break;

                case enumSelectedGrid.DetailSelected:


                    if (!CekAddEditDelDetail("edit"))
                    {
                        return;
                    }
                    if (int.Parse(dataGridHeader.SelectedCells[0].OwningRow.Cells["NPrint"].Value.ToString()) > 0)
                    {
                        if (!SecurityManager.AskPasswordManager())
                        {
                            return;
                        }
                    }
                    if (((DateTime)dataGridHeader.SelectedCells[0].OwningRow.Cells["TglKeluar"].Value < GlobalVar.LastClosingDate))
                    {
                        throw new Exception(string.Format(ISA.Trading.Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                    }

                    Guid headerID = (Guid)dataGridHeader.SelectedCells[0].OwningRow.Cells["HeaderRowID"].Value;
                    rowID = (Guid)dataGridDetail.SelectedCells[0].OwningRow.Cells["DetailRowID"].Value;
                    Guid notaID = Guid.Empty;
                    if (dataGridDetail.SelectedCells[0].OwningRow.Cells["KodeRetur"].Value.ToString() == "1")
                    {
                        if (dataGridDetail.SelectedCells[0].OwningRow.Cells["NotaBeliDetailID"].Value.ToString() != "")
                        {
                            notaID = (Guid)dataGridDetail.SelectedCells[0].OwningRow.Cells["NotaBeliDetailID"].Value;
                        }
                    }
                    Pembelian.frmMPRBeliDetailUpdate ifrmChild2 = new Pembelian.frmMPRBeliDetailUpdate(this, headerID, rowID, notaID);
                    ifrmChild2.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild2);
                    ifrmChild2.Show();
                    break;
                }
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }