コード例 #1
0
 private void cmdEdit2_Click(object sender, EventArgs e)
 {
     if (customGridView2.SelectedCells.Count > 0)
     {
         if (customGridView2.Focused || cmdEdit2.Focused)
         {
             int hasil;
             using (Database db = new Database())
             {
                 db.Commands.Add(db.CreateCommand("usp_FixRencana_CekDelete"));
                 db.Commands[0].Parameters.Add(new Parameter("@rowid", SqlDbType.UniqueIdentifier, (Guid)customGridView2.SelectedCells[0].OwningRow.Cells["_RowID"].Value));
                 hasil = Convert.ToInt32(db.Commands[0].ExecuteScalar());
             }
             if (hasil > 0 && SecurityManager.UserID.ToString().ToUpper() != "MANAGER")
             {
                 MessageBox.Show("Data tidak bisa diedit karena sudah di link fixroute.");
             }
             else
             {
                 string sales = customGridView2.SelectedCells[0].OwningRow.Cells["kd_Sales"].Value.ToString();
                 String asd   = customGridView2.SelectedCells[0].OwningRow.Cells["_RowID"].Value.ToString();
                 Guid   RowID = (Guid)customGridView2.SelectedCells[0].OwningRow.Cells["_RowID"].Value;
                 Fixrute.frmRencanaKunjunganSalesman ifrmChild = new frmRencanaKunjunganSalesman(this, RowID, sales);
                 ifrmChild.MdiParent = Program.MainForm;
                 Program.MainForm.RegisterChild(ifrmChild);
                 ifrmChild.Show();
             }
         }
     }
 }
コード例 #2
0
        private void cmdAdd2_Click(object sender, EventArgs e)
        {
            if (customGridView2.Focused || cmdAdd2.Focused)
            {
                //if (customGridView2.SelectedCells.Count > 0 || customGridView2.SelectedCells.Count == 0)
                if (customGridView1.SelectedCells.Count > 0 && cmdAdd2.Enabled == true)
                {
                    DateTime dTime = Convert.ToDateTime(dateTextBox1.DateValue);
                    string   sales = customGridView1.SelectedCells[0].OwningRow.Cells["Kode_Sales"].Value.ToString();

                    Fixrute.frmRencanaKunjunganSalesman ifrmChild = new frmRencanaKunjunganSalesman(this, sales, dTime);
                    ifrmChild.MdiParent = Program.MainForm;
                    Program.MainForm.RegisterChild(ifrmChild);
                    ifrmChild.Show();
                }
            }
        }