Beispiel #1
0
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (selectedGrid == enumSelectedGrid.PengirimanEkspedisiHeader)
     {
         if (dataGridView1.SelectedCells.Count > 0)
         {
             try
             {
                 GlobalVar.LastClosingDate = (DateTime)dataGridView1.SelectedCells[0].OwningRow.Cells["TglKirim"].Value;
                 if ((DateTime)dataGridView1.SelectedCells[0].OwningRow.Cells["TglKirim"].Value <= GlobalVar.LastClosingDate)
                 {
                     throw new Exception(string.Format(ISA.Toko.Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                 }
                 Guid rowID = (Guid)dataGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                 Ekspedisi.frmEkspedisiPengirimanUpdate ifrmChild = new Ekspedisi.frmEkspedisiPengirimanUpdate(this, rowID);
                 ifrmChild.MdiParent = Program.MainForm;
                 Program.MainForm.RegisterChild(ifrmChild);
                 ifrmChild.Show();
                 //}
             }
             catch (Exception ex)
             {
                 Error.LogError(ex);
             }
         }
         else
         {
             MessageBox.Show(Messages.Error.RowNotSelected);
         }
     }
 }
Beispiel #2
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.PengirimanEkspedisiHeader:
                Ekspedisi.frmEkspedisiPengirimanUpdate ifrmChild = new Ekspedisi.frmEkspedisiPengirimanUpdate(this);
                ifrmChild.MdiParent = Program.MainForm;
                Program.MainForm.RegisterChild(ifrmChild);
                ifrmChild.Show();
                RefreshDataHeader();
                break;

            case enumSelectedGrid.PengirimanEkspedisiDetail:
                if (dataGridView1.SelectedCells.Count > 0)
                {
                    try
                    {
                        GlobalVar.LastClosingDate = (DateTime)dataGridView1.SelectedCells[0].OwningRow.Cells["TglKirim"].Value;
                        if ((DateTime)dataGridView1.SelectedCells[0].OwningRow.Cells["TglKirim"].Value <= GlobalVar.LastClosingDate)
                        {
                            throw new Exception(string.Format(ISA.Toko.Messages.Error.AlreadyClosingPJT, GlobalVar.LastClosingDate));
                        }
                        Guid     _headerID = (Guid)dataGridView1.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                        string   _trID     = dataGridView1.SelectedCells[0].OwningRow.Cells["TrID"].Value.ToString();
                        DateTime _fromDate = (DateTime)rdbTgl.FromDate;
                        DateTime _toDate   = (DateTime)rdbTgl.ToDate;
                        Ekspedisi.frmEkspedisiPengirimanDetailUpdate ifrmChild2 = new Ekspedisi.frmEkspedisiPengirimanDetailUpdate(this, _headerID, _trID, _fromDate, _toDate);
                        ifrmChild2.MdiParent = Program.MainForm;
                        Program.MainForm.RegisterChild(ifrmChild2);
                        ifrmChild2.Show();
                        RefreshDataHeader();
                    }
                    catch (Exception ex)
                    {
                        Error.LogError(ex);
                    }
                }
                break;
            }
        }