コード例 #1
0
 private void commandButton1_Click(object sender, EventArgs e)
 {
     if (_selectedGrid == enumFormMode.Header)
     {
         Master.frmTokoUpdate ifrmChild = new Master.frmTokoUpdate(this);
         ifrmChild.MdiParent = Program.MainForm;
         Program.MainForm.RegisterChild(ifrmChild);
         ifrmChild.Show();
     }
     else if (_selectedGrid == enumFormMode.Detail)
     {
         if (dataGridToko.SelectedCells.Count > 0)
         {
             string _tokoKode = dataGridToko.SelectedCells[0].OwningRow.Cells["TokoID"].Value.ToString();
             Master.frmTokoPlafonUpdate ifrmChild = new Master.frmTokoPlafonUpdate(this, _tokoKode);
             ifrmChild.MdiParent = Program.MainForm;
             Program.MainForm.RegisterChild(ifrmChild);
             ifrmChild.Show();
         }
         else
         {
             MessageBox.Show(Messages.Error.RowNotSelected);
         }
     }
     else
     {
         if (dataGridToko.SelectedCells.Count > 0)
         {
             string _tokoKode = dataGridToko.SelectedCells[0].OwningRow.Cells["TokoID"].Value.ToString();
             Master.frmTokoStatusUpdate ifrmChild = new Master.frmTokoStatusUpdate(this, _tokoKode);
             ifrmChild.MdiParent = Program.MainForm;
             Program.MainForm.RegisterChild(ifrmChild);
             ifrmChild.Show();
         }
         else
         {
             MessageBox.Show(Messages.Error.RowNotSelected);
         }
     }
 }
コード例 #2
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            if (_selectedGrid == enumFormMode.Header)
            {
                if (dataGridToko.SelectedCells.Count > 0)
                {
                    string _tokoID = dataGridToko.SelectedCells[0].OwningRow.Cells["TokoID"].Value.ToString();


                    Guid rowID = (Guid)dataGridToko.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    Master.frmTokoUpdate ifrmChild = new Master.frmTokoUpdate(this, rowID);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
                else
                {
                    MessageBox.Show(Messages.Error.RowNotSelected);
                }
            }
            else if (_selectedGrid == enumFormMode.Detail)
            {
                if (datagridPlafon.SelectedCells.Count <= 0)
                {
                    MessageBox.Show(Messages.Error.RowNotSelected);
                    return;
                }
                if ((DateTime)datagridPlafon.SelectedCells[0].OwningRow.Cells["tanggal"].Value < GlobalVar.DateOfServer)
                {
                    MessageBox.Show("Tanggal plafon kurang dari tanggal server : " + GlobalVar.DateOfServer.ToString());
                    return;
                }
                if (datagridPlafon.SelectedCells.Count > 0)
                {
                    string _tokoKode = dataGridToko.SelectedCells[0].OwningRow.Cells["KodeToko"].Value.ToString();
                    Guid   rowID     = (Guid)datagridPlafon.SelectedCells[0].OwningRow.Cells["Row"].Value;
                    Master.frmTokoPlafonUpdate ifrmChild = new Master.frmTokoPlafonUpdate(this, _tokoKode, rowID);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
                else
                {
                    MessageBox.Show(Messages.Error.RowNotSelected);
                }
            }
            else
            {
                if (dataGridStsToko.SelectedCells.Count <= 0)
                {
                    MessageBox.Show(Messages.Error.RowNotSelected);
                    return;
                }
                if (Convert.ToDateTime(dataGridStsToko.SelectedCells[0].OwningRow.Cells["TglAktif"].Value.ToString()) < GlobalVar.DateOfServer)
                {
                    MessageBox.Show("Tanggal aktif Kurang dari Tanggal Server(" + GlobalVar.DateOfServer + ")");
                    return;
                }


                if (datagridPlafon.SelectedCells.Count > 0)
                {
                    string _tokoKode = dataGridToko.SelectedCells[0].OwningRow.Cells["TokoID"].Value.ToString();

                    Guid rowID = (Guid)dataGridStsToko.SelectedCells[0].OwningRow.Cells["StsTokoRowID"].Value;
                    Master.frmTokoStatusUpdate ifrmChild = new Master.frmTokoStatusUpdate(this, _tokoKode, rowID);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
                else
                {
                    MessageBox.Show(Messages.Error.RowNotSelected);
                }
            }
        }