Example #1
1
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SqlConnection con = new SqlConnection(constring);
            con.Open();

            int curRow = int.Parse(e.RowIndex.ToString());
            string currentrow;
            currentrow = dataGridView1.Rows[curRow].Cells[1].Value.ToString();

            SqlDataAdapter adp1 = new SqlDataAdapter("Select * from ResManagerToAdmin where ResID='" + currentrow + "'", con);
            DataSet ds1 = new DataSet();
            adp1.Fill(ds1);

            SqlCommand cmd = new SqlCommand("Update ResManagerToAdmin set RView='" + p2 + "' where ResID='" + currentrow + "'", con);
            cmd.ExecuteNonQuery();

            SqlCommand cmd1 = new SqlCommand("Update ResManagerToAdmin set RFinalView='" + p2 + "' where ResID='" + currentrow + "'", con);
            cmd1.ExecuteNonQuery();

            status = ds1.Tables[0].Rows[0]["RStatus"].ToString();

            if (status == "Success")
            {
                ViewAdminResponses var = new ViewAdminResponses();
                var.ShowDialog();
            }
            else
            {
                RecordNotFound rnf = new RecordNotFound();
                rnf.ShowDialog();
            }
        }
Example #2
0
 private void dataGridView1_CellMouseLeave(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     Console.WriteLine("Mouse Leave");
     if ((e != null) && (e.RowIndex != -1) && (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null))
     {
         if (this.dataGridView1.Columns[e.ColumnIndex].Name == "Hasło")
         {
             if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
             {
                 try
                 {
                     if (!dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Contains('\u25CF'))
                     {
                         //dataGridView1.Rows[e.RowIndex].Tag = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                         dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                         dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value     = new String('\u25CF', dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Length);
                     }
                 }
                 catch (FormatException)
                 {
                     //Console.WriteLine("{0} password problem.", e.Value.ToString());
                 }
             }
         }
     }
 }
Example #3
0
        private void dgvCalendar_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridView dgv = (DataGridView)sender;

                bool state = !dgv.CurrentRow.IsNewRow ? true : false;

                switch (lang)
                {
                    case "calendarfa":
                        tmiCalendarEdit.Enabled = state;
                        tmiCalendarErase.Enabled = state;
                        break;
                    case "calendaren":
                        tmiCalendarEditEn.Enabled = state;
                        tmiCalendarEraseEn.Enabled = state;
                        break;
                    case "calendarar":
                        tmiCalendarEditAr.Enabled = state;
                        tmiCalendarEraseAr.Enabled = state;
                        break;
                    default:
                        break;
                }

                miCalendarEdit.Enabled = state;
                miCalendarErase.Enabled = state;
            }
            catch
            {
            }
        }
Example #4
0
        private void jokasoDaichoListDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string hokenjoCd, torokuNengetsu, renban;

            TraceLog.StartWrite(MethodInfo.GetCurrentMethod());
            Cursor preCursor = Cursor.Current;

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                if (e.RowIndex > -1)
                {
                    hokenjoCd = jokasoDaichoListDataGridView.Rows[e.RowIndex].Cells[0].Value.ToString();
                    torokuNengetsu = jokasoDaichoListDataGridView.Rows[e.RowIndex].Cells[1].Value.ToString();
                    renban = jokasoDaichoListDataGridView.Rows[e.RowIndex].Cells[2].Value.ToString();

                    JokasoDaichoShosai frm = new JokasoDaichoShosai(hokenjoCd, torokuNengetsu, renban);
                    Program.mForm.ShowForm(frm);
                }
            }
            catch (Exception ex)
            {
                TraceLog.ErrorWrite(MethodInfo.GetCurrentMethod(), ex.ToString());
                MessageForm.Show(MessageForm.DispModeType.Error, MessageResouce.MSGID_E00001, ex.Message);
            }
            finally
            {
                Cursor.Current = preCursor;
                TraceLog.EndWrite(MethodInfo.GetCurrentMethod());
            }
        }
 private void dgvReserva_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvReserva.CurrentCell.ColumnIndex==0)
     {
         dgvReserva.ClearSelection();
     }
 }
Example #6
0
 private void cpfResultDoc_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1)
     {
         produto = new Produto(cpfResultDoc.Rows[e.RowIndex].Cells["material"].Value.ToString(), cpfResultDoc.Rows[e.RowIndex].Cells["serie"].Value.ToString(), Convert.ToInt32(cpfResultDoc.Rows[e.RowIndex].Cells["Filial"].Value), conecta);
     }
 }
Example #7
0
 private void gridTeam2_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (gridTeam2.CurrentCell.ColumnIndex == 1)
     {
         Process.Start("http://www.coh2.org/ladders/playercard/steamid/" + gridTeam2.CurrentRow.Cells[3].Value);
     }
 }
Example #8
0
        private void OnGridWasClicked(object sender, DataGridViewCellEventArgs e)
        {
            var grid = sender as DataGridView;

            if(null == grid)
                return;

            int rowIndex = e.RowIndex;

            if(rowIndex< 0)
                return;

            var row = grid.Rows[rowIndex];

            int w = (int) row.Tag;
            var limitation = grid.Tag as WeightLimitation;
            if(null == limitation)
                return;

            if(limitation.ContainsWeight(w))
            {
                limitation.Remove(w);
            }
            else
            {
                limitation.Add(w);
            }

            PaintRow(grid, rowIndex);

            _fullSystem.NeedsToBeCounted = true;
            _fullSystem.NeedsToBeSaved = true;
        }
Example #9
0
        void gridCLPSData_CellEndEdit(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex != 8)
                {
                    _owner.m_Overlay.Write8((uint)((clps_addr + 8) + (8 * e.RowIndex) + e.ColumnIndex),
                                            (byte)int.Parse(gridCLPSData.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()));
                }
                else
                {
                    string entryName = gridCLPSData.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                    if (entryName.Equals("Other/Unknown"))
                    {
                        return;
                    }
                    byte[] entryValue = GLOBAL_CLPS_TYPES.GetFirstToSecond()[entryName];
                    int    rowIndex   = e.RowIndex;
                    for (int i = 0; i < 8; i++)
                    {
                        // Update entry in overlay CLPS table
                        _owner.m_Overlay.Write8((uint)((clps_addr + 8) + (8 * rowIndex) + i),
                                                (byte)entryValue[i]);
                    }
                }

                loadCLPSData();
            }
            catch
            {
                MessageBox.Show("Please enter a valid number between 0 - 255.");
            }
        }
Example #10
0
 private void dgTTemplates_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     gridTTemp.SelectedObject = CurrentTemplate.TTemplates[dgTTemplates.CurrentRow.Index];
     CurrentTTemplate         = CurrentTemplate.TTemplates[dgTTemplates.CurrentRow.Index];
     FillTemplatesList(CurrentTTemplate);
     FillTempsList(CurrentTemplate);
 }
Example #11
0
        void dgv_CellDoubleClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            var dgv = sender as DataGridView;

            if (dgv == null)
            {
                throw new ArgumentException();
            }
            if (dgv.SelectedCells.Count == 1 && (dgv).SelectedCells[0].OwningColumn.Name == "sample")
            {
                if (dgv.SelectedCells[0].OwningRow.Index > 0)
                {
                    (dgv).Rows.Remove((dgv).SelectedCells[0].OwningRow);
                    if ((dgv).Rows.Count <= 1)
                    {
                        dgvHolder.Controls.Remove(dgv);
                        inputDGVList.Remove(dgv);
                        (dgv).Dispose();
                        updateDGVHeights();
                    }
                    else
                    {
                        updateDataGridView((dgv));
                    }
                }
                else
                {
                    toggleDGVRows(dgv);
                }
            }
        }
Example #12
0
        private void dataGridView1_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }
            if (dataGridView1.Columns [e.ColumnIndex].Name.Equals("programId", System.StringComparison.OrdinalIgnoreCase))
            {
                FormProgram from = new FormProgram( );
                from.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                if (from.ShowDialog( ) != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }
                FishEntity.ProgramEntity model = from.model;
                dataGridView1.Rows [e.RowIndex].Cells ["programId"].Value   = model.programId;
                dataGridView1.Rows [e.RowIndex].Cells ["programName"].Value = model.programName;
            }

            if (dataGridView1.Columns [e.ColumnIndex].Name.Equals("userName", System.StringComparison.OrdinalIgnoreCase))
            {
                FormUserList from = new FormUserList(true);
                from.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                if (from.ShowDialog( ) != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }
                FishEntity.PersonEntity model = from.SelectedPersion;
                dataGridView1.Rows [e.RowIndex].Cells ["userName"].Value = model.username;
                dataGridView1.Rows [e.RowIndex].Cells ["userNum"].Value  = model.realname;
            }
        }
Example #13
0
        void dgvData_CellContentClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == colAction.Index)
            {
                Off();
                isPrint = true;
                if (SaveWeight())
                {
                    dgvData.Rows[e.RowIndex].Selected     = false;
                    dgvData.Rows[e.RowIndex + 1].Selected = true;
                    txtWeight_2.Text = "";

                    if (!string.IsNullOrWhiteSpace(dgvData.Rows[e.RowIndex].Cells[colbalance_color.Name].Value.ToString()))
                    {
                        var val = dgvData.Rows[e.RowIndex].Cells[colbalance_color.Name].Value.ToString();
                        if (val == "1")
                        {
                            dgvData.Rows[e.RowIndex].Cells[colWeight.Name].Style.BackColor = Color.Red;
                        }
                    }
                }
            }
            else if (e.ColumnIndex == colOwd.Index)
            {
                if (SaveOweGoods())
                {
                    dgvData.Rows[e.RowIndex].DefaultCellStyle.BackColor = System.Drawing.Color.Yellow;
                }
            }
        }
Example #14
0
 private void DataGridView1_CellValueChanged(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     if (mhw == null)
     {
         return;
     }
     if (e.ColumnIndex == 4)
     {
         if ((bool)dataGridView1.CurrentCell.EditedFormattedValue)
         {
             ((Item[])dataGridView1.DataSource)[e.RowIndex].locked = true;
             locks.Add(((Item[])dataGridView1.DataSource)[e.RowIndex]);
         }
         else
         {
             locks.Remove(((Item[])dataGridView1.DataSource)[e.RowIndex]);
             ((Item[])dataGridView1.DataSource)[e.RowIndex].locked = false;
         }
     }
     if (e.ColumnIndex == 2 && ((Item[])dataGridView1.DataSource)[e.RowIndex].locked == false)
     {
         var item = ((Item[])dataGridView1.DataSource)[e.RowIndex];
         ProcessIO.WriteInt32(handle, item.address + 4, int.Parse((string)dataGridView1.CurrentCell.EditedFormattedValue));
         ((Item[])dataGridView1.DataSource)[e.RowIndex].count = int.Parse((string)dataGridView1.CurrentCell.EditedFormattedValue);
     }
     if (e.ColumnIndex == 0 && ((Item[])dataGridView1.DataSource)[e.RowIndex].locked == false)
     {
         var item = ((Item[])dataGridView1.DataSource)[e.RowIndex];
         ProcessIO.WriteInt32(handle, item.address, int.Parse((string)dataGridView1.CurrentCell.EditedFormattedValue));
         ((Item[])dataGridView1.DataSource)[e.RowIndex].id = int.Parse((string)dataGridView1.CurrentCell.EditedFormattedValue);
     }
 }
Example #15
0
 private void OnCellContentClick(System.Object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     if (Grid.CurrentCell is DataGridViewButtonCell)
     {
         // --------------------------------------------------------------
         // User has clicked a button in a cell somewhere on our grid.
         // Pass event to BaseController so that it can act on it.
         // --------------------------------------------------------------
         DataGridViewButtonCell Button = (DataGridViewButtonCell)Grid.CurrentCell;
         OpenFileDialog         Dialog = new OpenFileDialog();
         Dialog.AddExtension     = true;
         Dialog.RestoreDirectory = true;
         if (Dialog.ShowDialog() == DialogResult.OK)
         {
             string Text = "";
             foreach (string FileName in Dialog.FileNames)
             {
                 if (Text != "")
                 {
                     Text += Environment.NewLine;
                 }
                 Text += FileName;
             }
             Grid.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = Text;
         }
     }
 }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
                    string serialNo = row.Cells["S.No"].Value.ToString();
                    DBManager manager=new DBManager();
                    SqlConnection connection = manager.Connection();
                    string query = "delete from Books Where [S.No]='" + serialNo + "'";
                    SqlCommand delCommand=new SqlCommand(query,connection);
                    connection.Open();

                    System.Windows.Forms.DialogResult result =
                        MessageBox.Show("Do you wnat to delete the selected book?", "Message", MessageBoxButtons.YesNo,
                            MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        delCommand.ExecuteNonQuery();
                        MessageBox.Show("deleted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        TestBook(); 
                    }


 
                }
            }
            catch (Exception exception)
            {

                MessageBox.Show(exception.StackTrace);
            }
        }
 private void dgvLoaithuoc_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     txtMaLT.DataBindings.Clear();
     txtMaLT.DataBindings.Add("Text", dgvLoaithuoc.DataSource, "MaLoai");
     txtTenLT.DataBindings.Clear();
     txtTenLT.DataBindings.Add("Text", dgvLoaithuoc.DataSource, "Ten");
 }
Example #18
0
        private void listado_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                DataGridViewRow row = this.listado.Rows[e.RowIndex];
                this.tareaSelected          = tareaService.leer(Convert.ToInt32(row.Cells[0].Value));
                this.tareaSelected.Proyecto = proyectoSelected;

                this.tituloField.Text      = tareaSelected.Titulo;
                this.descripcionField.Text = tareaSelected.Descripcion;

                this.createButton.Visible = false;
                this.deleteButton.Visible = true;
                this.saveButton.Visible   = true;
            }
            catch (ProEasyException pEx)
            {
                showError(i18n().GetString("errors." + pEx.Code));
            }
            catch (Exception)
            {
                showError(i18n().GetString("errors.1"));
            }
        }
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     _form1.viaje = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[1].Value.ToString();
     _form1.butaca = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[2].Value.ToString();
     _form1.kg = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[3].Value.ToString();
     this.Hide();
 }
Example #20
0
        public static void changeData(System.Windows.Forms.DataGridView gridView, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            int id = Convert.ToInt32(gridView.Rows[e.RowIndex].Cells[0].Value);

            if (gridView.Columns[e.ColumnIndex].Name == "lat" || gridView.Columns[e.ColumnIndex].Name == "lng")
            {
                double     x        = Convert.ToDouble(gridView.Rows[e.RowIndex].Cells[1].Value);
                double     y        = Convert.ToDouble(gridView.Rows[e.RowIndex].Cells[2].Value);
                double     distance = distCalculate(x, y);
                SqlCommand command  = new SqlCommand(@"UPDATE POINTS SET lat = @x, lng = @y, distance = @dist WHERE Id = @Id", connection);
                command.Parameters.AddWithValue("@x", x);
                command.Parameters.AddWithValue("@y", y);
                command.Parameters.AddWithValue("@dist", distance);
                command.Parameters.AddWithValue("@Id", id);
                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            }
            else
            {
                string     column  = gridView.Columns[e.ColumnIndex].Name;
                double     value   = Convert.ToDouble(gridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
                SqlCommand command = new SqlCommand($@"UPDATE RESULTS SET {column} = @value  WHERE Id = @Id", connection);
                command.Parameters.AddWithValue("@Id", id);
                command.Parameters.AddWithValue("@value", value);
                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            }
        }
        private void dgvSummary_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvSummary.Columns[e.ColumnIndex].Name == "删除")
            {
                ManageCarRequiredment manageCarRequiredment = new ManageCarRequiredment();
                manageCarRequiredment.Id = Convert.ToInt32(dgvSummary.CurrentRow.Cells["managerId"].Value.ToString());
                manageCarRequiredment.DriverId = Convert.ToInt32(dgvSummary.CurrentRow.Cells["driverId"].Value.ToString());
                manageCarRequiredment.CarId = Convert.ToInt32(dgvSummary.CurrentRow.Cells["carId"].Value.ToString());
                try
                {
                    manageCarRequiredmentBLL.DeleteObject(manageCarRequiredment);
                    driverWriteListBLL.UpdateIsUseStatus(manageCarRequiredment.DriverId,0);
                    carBll.UpdateIsUseStatus(manageCarRequiredment.CarId,0);
                    MessageBox.Show("删除成功");
                    //  DataTable carList = manageCarRequiredmentBLL.FindAll_infos(getblacklistsql);

                    // dgvSummary.DataSource = carList;
                }
                catch (Exception ex)
                {

                    MessageBox.Show("删除失败" + ex.Message);
                }

            }
        }
Example #22
0
        private void GrdRtlTbl_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow data = GrdRtlTbl.Rows[e.RowIndex];
                TxTIdx.Text = data.Cells[0].Value.ToString();

                CbomemIdx.SelectedIndex = CbomemIdx.FindString(data.Cells[1].Value.ToString());
                CbomemIdx.SelectedValue = data.Cells[1].Value;

                CbobookIdx.SelectedIndex = CbobookIdx.FindString(data.Cells[2].Value.ToString());
                CbobookIdx.SelectedValue = data.Cells[2].Value;



                DtpRentalDate.CustomFormat = "yyyy-MM-dd";
                DtpRentalDate.Format       = DateTimePickerFormat.Custom;
                DtpRentalDate.Value        = DateTime.Parse(data.Cells[3].Value.ToString());

                DtpReturnDate.CustomFormat = "yyyy-MM-dd";
                DtpReturnDate.Format       = DateTimePickerFormat.Custom;
                DtpReturnDate.Value        = DateTime.Parse(data.Cells[4].Value.ToString());



                mode            = "UPDATE";
                TxTIdx.ReadOnly = true;
            }
        }
Example #23
0
 private void grid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 4)
     {
         var id = int.Parse(grid.Rows[e.RowIndex].Cells[0].Value.ToString());
         var lname = grid.Rows[e.RowIndex].Cells[1].Value.ToString();
         var fname = grid.Rows[e.RowIndex].Cells[2].Value.ToString();
         var age = int.Parse(grid.Rows[e.RowIndex].Cells[3].Value.ToString());
         var p = new Person(id, lname, fname, age);
         var formEdit = new fEdit();
         formEdit.P = p;
         formEdit.pd = pd;
         formEdit.mv = this;
         formEdit.ShowDialog();
     }
     else
     {
         if (e.ColumnIndex == 5)
         {
             var id = int.Parse(grid.Rows[e.RowIndex].Cells[0].Value.ToString());
             var lname = grid.Rows[e.RowIndex].Cells[1].Value.ToString();
             var fname = grid.Rows[e.RowIndex].Cells[2].Value.ToString();
             var age = int.Parse(grid.Rows[e.RowIndex].Cells[3].Value.ToString());
             var p = new Person(id, lname, fname, age);
             var formDelete = new fDelete();
             formDelete.P = p;
             formDelete.pd = pd;
             formDelete.mv = this;
             formDelete.ShowDialog();
         }
     }
     ShowData(pd.Read());
 }
Example #24
0
        private void GrdDivTbl_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                //Cells[3]은 inner join으로 결과를 나타내준다.
                DataGridViewRow data = GrdBooksTbl.Rows[e.RowIndex];
                TxtIdx.Text      = data.Cells[0].Value.ToString(); // ID
                TxtIdx.ReadOnly  = true;                           //Division이 PK라서 변경하면 안 된다.
                TxtIdx.BackColor = Color.Red;
                TxtAuthor.Text   = data.Cells[1].Value.ToString(); // 저자
                //Cells[3]에는 "로맨스", "SF/판타지" ... 가 들어있다.
                //CboDivision.SelectedIndex = CboDivision.FindString(data.Cells[3].Value.ToString()); // 책 장르
                //Cell[2]에는 "B001", "B002"...가 들어있다.
                CboDivision.SelectedValue = data.Cells[2].Value;
                TxtNames.Text             = data.Cells[4].Value.ToString();                 // 책 제목
                DtpReleaseDate.Value      = DateTime.Parse(data.Cells[5].Value.ToString()); //발간일
                TxtISBN.Text  = data.Cells[6].Value.ToString();                             // ISBN
                TxtPrice.Text = data.Cells[7].Value.ToString();                             // 가격

                DtpReleaseDate.CustomFormat = "yyyy-MM-dd";
                DtpReleaseDate.Format       = DateTimePickerFormat.Custom;

                mode = "UPDATE"; // 수정은 UPDATE
            }
        }
Example #25
0
 private void DataGridViewStrata_CellDoubleClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         this.SelectStratumAndExit();
     }
 }
        private void dgvCustomers_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dgvCustomers.Columns["Show"].Index && e.RowIndex != -1)
            {
                NavigationTool.OpenNewTab(new frmCustomerDetail(customers[e.RowIndex]));
            }
            else if (e.ColumnIndex == dgvCustomers.Columns["Edit"].Index && e.RowIndex != -1)
            {
                NavigationTool.OpenNewTab(new frmEditCustomer(customers[e.RowIndex]));
                LoadCustomers(customerService.GetAll(Session.currentUser));
            }
            else if (e.ColumnIndex == dgvCustomers.Columns["Delete"].Index && e.RowIndex != -1)
            {
                Customer customer = customers[e.RowIndex];

                DialogResult dialogResult = MessageBox.Show(customer.CustomerName + " " + customer.CustomerSurname +
                                                            " adlı müşteriyi silmek istediğinizden emin misiniz?", "Müşteri Sil", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    try
                    {
                        customerService.Delete(customer, Session.currentUser);
                        customers.Remove(customer);
                        LoadCustomers(customers);
                        MessageBox.Show("Müşteri başarıyla silindi!", "Başarılı!");
                    } catch (Exception ex)
                    {
                        MessageBox.Show("Bağımlılıkları kontrol edin\n" + ex.Message, "Hata!");
                    }
                }
            }
        }
Example #27
0
        private void dgvTSRecord_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (timeSheetFSWorkingDaysBindingSource.Current == null)
            {
                return;
            }

            if (dgvTSRecord.Columns[e.ColumnIndex].DataPropertyName == "IsClosed")
            {
                if (!(timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).IsCreated)
                {
                    MessageBox.Show("Выбранная запись еще не добавлена в табель!");
                    return;
                }

                if ((timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).TimeSheetFSRecord.TimeSheet.IsClosed == true)
                {
                    MessageBox.Show("Табель рабочего времени закрыт для редактирования!");
                    return;
                }

                //зафиксировано - устанавливаем
                if ((timeSheetFSWorkingDaysBindingSource.Current != null) &&
                    ((timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).IsCreated))
                {
                    (timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).TimeSheetFSRecord.IsClosed =
                        !(timeSheetFSWorkingDaysBindingSource.Current as TimeSheetRecord).TimeSheetFSRecord.IsClosed;
                    KadrController.Instance.Model.SubmitChanges();
                }
            }
        }
Example #28
0
        void gridCLPSData_CellEndEdit(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex != columns.Length)
                {
                    ulong clps = m_CLPS[e.RowIndex].flags;

                    columns[e.ColumnIndex].SetFlag(ref clps,
                                                   ulong.Parse(gridCLPSData.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()));

                    CLPS.Entry temp = new CLPS.Entry();
                    temp.flags         = clps;
                    m_CLPS[e.RowIndex] = temp;
                }
                else
                {
                    return;
                }

                LoadCLPSData();
            }
            catch (Exception ex)
            {
                new ExceptionMessageBox(ex).ShowDialog();
                return;
            }
        }
Example #29
0
 private void dataGridViewCrs_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     int cnt = 0;
     oracleConnection1.Open();
     chartCntStd.Series[0].Points.Clear();
     dataGridViewResult.Rows.Clear();
     string mySQL = "SELECT CRS_NUM, CRS_YEAR, CRS_TERM, COUNT(EN_STD_NUM) AS CNT_STD "
         + "FROM PRO1_COURSES LEFT OUTER JOIN PRO1_ENROLLS ON CRS_YEAR = EN_CRS_YEAR AND CRS_TERM = EN_CRS_TERM AND CRS_NUM = EN_CRS_NUM "
         + "GROUP BY CRS_NUM, CRS_YEAR, CRS_TERM";
     oracleCommand1.CommandText = mySQL + " HAVING CRS_NUM IN " + "'" + dataGridViewCrs.CurrentRow.Cells[0].Value.ToString() + "'";
     OracleDataReader rdr1 = oracleCommand1.ExecuteReader();
     while (rdr1.Read())
     {
         dataGridViewResult.Rows.Add();
         dataGridViewResult.Rows[cnt].Cells[0].Value = rdr1["CRS_YEAR"];
         dataGridViewResult.Rows[cnt].Cells[1].Value = rdr1["CRS_TERM"];
         dataGridViewResult.Rows[cnt].Cells[2].Value = rdr1["CNT_STD"];
         chartCntStd.Series[0].Points.AddXY(rdr1["CRS_YEAR"], rdr1["CNT_STD"]);
         cnt++;
     }
     if (!avgFlag)
     {
         oracleCommand2.CommandText = "SELECT CRS_YEAR, CRS_TERM, ROUND(AVG(CNT_STD),0) AS AVG_STD " +
             "FROM (" + mySQL + ") GROUP BY CRS_YEAR, CRS_TERM";
         OracleDataReader rdr2 = oracleCommand2.ExecuteReader();
         while (rdr2.Read())
         {
             chartCntStd.Series[1].Points.AddXY(rdr2["CRS_YEAR"], Convert.ToInt32(rdr2["AVG_STD"]));
         }
         avgFlag = true;
         rdr2.Close();
     }
     rdr1.Close();
     oracleConnection1.Close();
 }
Example #30
0
        private void GrdDivTbl_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1)
            {
                DataGridViewRow data = GrdRentalTbl.Rows[e.RowIndex];
                TxtIdx.Text      = data.Cells[0].Value.ToString(); // ID
                TxtIdx.ReadOnly  = true;                           //Division이 PK라서 변경하면 안 된다.
                TxtIdx.BackColor = Color.Red;

                CboMemberIdx.SelectedIndex = CboMemberIdx.FindString(data.Cells[1].Value.ToString());
                CboBookIdx.SelectedIndex   = CboBookIdx.FindString(data.Cells[2].Value.ToString());
                //CboDivision.SelectedIndex = CboDivision.FindString(data.Cells[3].Value.ToString()); // 책 장르
                DtpRentalDate.Value = DateTime.Parse(data.Cells[3].Value.ToString());  // 발간일
                DtpReturnDate.Value = DateTime.Parse(data.Cells[4].Value.ToString());  // 반납일


                DtpRentalDate.CustomFormat = "yyyy-MM-dd";
                DtpRentalDate.Format       = DateTimePickerFormat.Custom;

                DtpReturnDate.CustomFormat = "yyyy-MM-dd";
                DtpReturnDate.Format       = DateTimePickerFormat.Custom;

                mode = "UPDATE"; // 수정은 UPDATE
            }
        }
Example #31
0
 private void dataGridViewNCC_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         DataGridViewRow row = this.dataGridViewNCC.Rows[e.RowIndex];
         txtTenNCC.Text = row.Cells[0].Value.ToString();
     }
     DAL.DALNhaCungCap.layNCCtheoten(txtTenNCC.Text);
     BUSNhaCungCap bNCC = new BUSNhaCungCap();
     var NCC = bNCC.layNCCtheoten(txtTenNCC.Text);
     if (NCC == null)
     {
         MessageBox.Show("Không tồn tại nhà cung cấp");
     }
     else
     {
         txtDiaChi.Text = NCC.DiaChi;
         txtEmail.Text = NCC.Email;
         txtSoDT.Text = NCC.SoDienThoai;
         txtTaiKhoan.Text = NCC.IDTaiKhoan;
         txtChuTK.Text = NCC.TenChuTK;
         dateTimePicker1.Text = Convert.ToString(NCC.NgayMoTK);
         txtChitietkhac.Text = NCC.ChiTietKhac;
     }
 }
        /// <summary>
        /// セルの中身がクリックされた時(削除ボタン押された時)
        /// </summary>
        private void EntryDataList_CellContentClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            try
            {
                // データグリッドビュー本体取得
                DataGridView dgv = (DataGridView)sender;

                // クリックしたセル取得
                DataGridViewCell cell = dgv.CurrentCell;

                // 削除ボタンが押された
                if (cell.OwningColumn.Name == "DELETE")
                {
                    // 受付番号の列位置取得
                    int ColIndex = dgv.Columns["rECEIPTIDDataGridViewTextBoxColumn"].Index;
                    // 受付番号取得
                    int ReceiptID = (int)dgv.Rows[cell.RowIndex].Cells[ColIndex].Value;

                    // 受付番号をDB操作モジュールへ渡し削除を行う
                    var TableData = new NEW_RECEIPT_LIST_Module();
                    TableData.Delete(ReceiptID);
                    TableData = null;

                    // データグリッドビューの表示を更新
                    this.nEW_RECEIPT_LISTTableAdapter.Fill(this.pluspointDBDataSet.NEW_RECEIPT_LIST);
                }
            }
            catch
            {
                throw;
            }

            return;
        }
Example #33
0
 private void dgLedger_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     sResult = dgLedger.SelectedRows[0].Cells[0].Value.ToString();
     sDescription = dgLedger.SelectedRows[0].Cells[1].Value.ToString();
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Example #34
0
 private void dataGridView1_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     /*
      * select fishId 鱼粉ID,billName 提单号,codeNum 采购编号,codeNumContract 采购合同号,a.price 采购价格,c.salermb 市场价格,a.applyDate 入库日期,c.selfstorageweight 重量,c.selfstoragequantity 数量,pileNum 桩角号,db 蛋白,tvn TVN,za 组胺,shy 沙和盐,hf 灰份,domestic_sour 酸价,zf 脂肪,domestic_lysine 赖氨酸,domestic_methionine 蛋氨酸,domestic_aminototal 氨基酸总和,a.remark 备注,country 国别,a.brand 品牌,shipName 船名,b.State4 状态 ,b.type 港口,a.code 入库申请单单号 from t_storageofrequisition a inner join t_product b on a.fishId=b.code inner join t_productex c on b.id=c.id
      */
     if (e.ColumnIndex < 0 && e.RowIndex < 0)
     {
         return;
     }
     _models                 = new FishEntity.BatchSheetsEntity( );
     _models.fishId          = dataGridView1.Rows [e.RowIndex].Cells ["鱼粉ID"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["鱼粉ID"].Value.ToString( );
     _models.codeNum         = dataGridView1.Rows [e.RowIndex].Cells ["采购编号"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["采购编号"].Value.ToString( );
     _models.codeNumContract = dataGridView1.Rows [e.RowIndex].Cells ["采购合同号"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["采购合同号"].Value.ToString( );
     _models.country         = dataGridView1.Rows [e.RowIndex].Cells ["国别"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["国别"].Value.ToString( );
     _models.brand           = dataGridView1.Rows [e.RowIndex].Cells ["品牌"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["品牌"].Value.ToString( );
     _models.protein         = dataGridView1.Rows [e.RowIndex].Cells ["蛋白"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["蛋白"].Value.ToString( );
     _models.tvn             = dataGridView1.Rows [e.RowIndex].Cells ["TVN"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["TVN"].Value.ToString( );
     _models.salt            = dataGridView1.Rows [e.RowIndex].Cells ["沙和盐"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["沙和盐"].Value.ToString( );
     _models.acid            = dataGridView1.Rows [e.RowIndex].Cells ["酸价"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["酸价"].Value.ToString( );
     _models.ash             = dataGridView1.Rows [e.RowIndex].Cells ["灰份"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["灰份"].Value.ToString( );
     _models.histamine       = dataGridView1.Rows [e.RowIndex].Cells ["组胺"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["组胺"].Value.ToString( );
     _models.las             = dataGridView1.Rows [e.RowIndex].Cells ["赖氨酸"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["赖氨酸"].Value.ToString( );
     _models.das             = dataGridView1.Rows [e.RowIndex].Cells ["蛋氨酸"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["蛋氨酸"].Value.ToString( );
     _models.tons            = dataGridView1.Rows [e.RowIndex].Cells ["重量"].Value == null ? 0 : Convert.ToDecimal(dataGridView1.Rows [e.RowIndex].Cells ["重量"].Value);
     _models.rkCode          = dataGridView1.Rows [e.RowIndex].Cells ["入库申请单单号"].Value.ToString( );
     this.DialogResult       = DialogResult.OK;
 }
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == ColDelete.Index)
     {
         dataGridView1.Rows.RemoveAt(e.RowIndex);
     }
 }
 /*Function which select the location of the error on double click */
 void dataGrid_Validation1_CellContentDoubleClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     //if second column is selected
     if (e.ColumnIndex == 1)
     {
         //Getting error message from first column
         String str = this.dataGrid_Validation.Rows[e.RowIndex].Cells[e.ColumnIndex - 1].Value.ToString();
         for (int i = 0; i < error.Count; i++)
         {
             string[] index      = error[i].ToString().Split(':');
             string[] messageKey = index[1].Split('|');
             if (str == messageKey[0].ToString())
             {
                 //showing help file
                 Help.ShowHelp(dataGrid_Validation, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + "Help.chm", HelpNavigator.KeywordIndex, index[0]);
             }
         }
     }
     //if first column is selected
     else if (e.ColumnIndex == 0)
     {
         string[] messageKey = this.error[e.RowIndex].ToString().Split('|');
         //checking for bookmark
         foreach (object item in pdoc.Bookmarks)
         {
             if (((MSword.Bookmark)item).Name == messageKey[1])
             {
                 //selecting the location of the bookmark
                 ((MSword.Bookmark)item).Select();
                 //activating the word document
                 pdoc.Application.Activate();
             }
         }
     }
 }
Example #37
0
        private void dataGridViewDTE_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            _pin.command(String.Format("{0}", dataGridViewDTE[0, e.RowIndex].Value));

            dataGridViewDTE.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = Color.FromArgb(245, 242, 203);
            dataGridViewDTE.Rows[e.RowIndex].DefaultCellStyle.SelectionForeColor = Color.FromArgb(23, 36, 47);
        }
        private void grd_CellContentClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            int    id   = int.Parse(grd.Rows[e.RowIndex].Cells["Id"].Value.ToString());
            string type = grd.Rows[e.RowIndex].Cells["TypeName"].Value.ToString();

            if (type.Equals("Nhập kho", StringComparison.OrdinalIgnoreCase))
            {
                frmImportDetail frmImportDetail = new frmImportDetail(id);
                frmImportDetail.StartPosition = FormStartPosition.CenterParent;
                frmImportDetail.ShowDialog();
            }
            else
            {
                frmExportDetail frmExportDetail = new frmExportDetail(id);
                frmExportDetail.StartPosition = FormStartPosition.CenterParent;
                frmExportDetail.ShowDialog();
                if (frmExportDetail.Status)
                {
                    LoadData();
                }
            }
        }
Example #39
0
 private void grid_reply_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 0)
     {
         grb_mess.Text = grid_reply.CurrentRow.Cells[2].Value.ToString();
         txt_sub.Text = grid_reply.CurrentRow.Cells[3].Value.ToString();
         txt_content.Text = grid_reply.CurrentRow.Cells[1].Value.ToString();
         if (Convert.ToBoolean(grid_reply.CurrentRow.Cells[5].Value) == false)
         {
             txt_reply.Text = "Chưa có trả lời";
         }
         else
         {
             //lbl_reply.Text = "Trả lời: " + grid_reply.CurrentRow.Cells[4].Value.ToString();
             txt_reply.Text = grid_reply.CurrentRow.Cells[4].Value.ToString();
         }
         /*MaMH = grib_All_Subject.CurrentRow.Cells[1].Value.ToString();
         TenMH = grib_All_Subject.CurrentRow.Cells[2].Value.ToString();
         Hocky = grib_All_Subject.CurrentRow.Cells[3].Value.ToString();
         try
         {
             frmDS = new GV_DanhSachLopMH(MaGV, MaMH, TenMH, Hocky);
             frmDS.Show();
         }
         catch (Exception)
         {
             MessageBox.Show("Service not response", "Error");
         }*/
     }
 }
        private void dataGridViewMachines_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            string machine = dataGridViewMachines.Rows[e.RowIndex].Cells[ColumnName.Index].Value?.ToString();

            if (e.ColumnIndex == ColumnDelete.Index)
            {
                DeleteMachine(machine);
            }
            else if (e.ColumnIndex == ColumnStartStop.Index)
            {
                dataGridViewMachines.Rows[e.RowIndex].Cells[ColumnStartStop.Index].Value = Tools.Utilities.UI.Resources.ResourceIconSet16Default.arrow_rotate_clockwise;
                StopStartMachine(machine);
            }
            else if (e.ColumnIndex == ColumnActive.Index)
            {
                ChangeActiveMachine(machine);
            }
            else if (e.ColumnIndex == ColumnRegenerateCert.Index)
            {
                RegenerateCert(machine);
            }
            else if (e.ColumnIndex == ColumnResetEnv.Index)
            {
                ResetEnv(machine);
            }
            if (e.ColumnIndex == ColumnInspect.Index)
            {
                InspectMachine(machine);
            }
        }
 private void dgvRecordList_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     int columnIndex = e.ColumnIndex;
     int rowIndex = e.RowIndex;
     //AddCode
     if (rowIndex == -1)
     {
         return;
     }
     //AddCode
     if (this.dgvRecordList.Columns[columnIndex] == this.dgvRecordList.Columns[_delColumnName]) {
         var dialogResult = MessageBox.Show("确定要删除吗?", SystemInfo.ReminderStr, MessageBoxButtons.OKCancel);
         if (dialogResult == DialogResult.OK) {
             var RecordID = (int)dgvRecordList.Rows[rowIndex].Cells["RecordID"].Value;
             var result = new TrainingTestRecordBLL().DeleteTrainingTestRecordByID(RecordID);
             if (result.Code > 0) {
                 MessageBox.Show(result.Message, SystemInfo.ErrorReminderStr, MessageBoxButtons.OK);
             }
             BindDataList();
         }
     } else if (this.dgvRecordList.Columns[columnIndex] == this.dgvRecordList.Columns[_editColumName]) {
         var RecordID = (int)dgvRecordList.Rows[rowIndex].Cells["RecordID"].Value;
         var form = new TrainingTestRecordInfoForm(true, RecordID, null);
         form.callbackEvent += delegate {
             BindDataList();
         };
         form.ShowDialog();
     }
 }
Example #42
0
 private void dataGridProducto_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     dataGridProducto.Rows[e.RowIndex].Selected = true;
     textoNombre.Text     = dataGridProducto.CurrentRow.Cells[1].Value.ToString();
     numericPrecio.Text   = dataGridProducto.CurrentRow.Cells[2].Value.ToString().Replace(".", ",");
     numericCantidad.Text = dataGridProducto.CurrentRow.Cells[3].Value.ToString().Replace(".", ",");
 }
Example #43
0
 private void dgvClients_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1 && e.ColumnIndex == dgvClient.Columns["Add"].Index)
     {
         AddPayment();
     }
 }
Example #44
0
        /// <summary>
        /// Evento de entrada do mouse em uma gridview
        /// </summary>
        void dgvImg_CellMouseEnter(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            //Se não tem datasource ou não tem linhas, então sai daqui
            if (((DataGridView)sender).DataSource == null)
            {
                return;
            }
            if (((DataGridView)sender).Rows[e.RowIndex] == null)
            {
                return;
            }

            //Cria um novo popup de visualização de imagem
            _ImageViewer = new ctrImageViewer();
            //Se for da grid do lado esquerdo, então pega o index da imagem selecionada no lado esquerdo
            Imagem img = ((DataGridView)sender).Name == "dgvImg1" ? _PeriodoPaisLeft.lstImagens[e.RowIndex] : _PeriodoPaisRight.lstImagens[e.RowIndex];

            _ImageViewer.Title       = img.txNomeImagem;
            _ImageViewer.Description = img.txDescricaoImagem;
            _ImageViewer.Image       = img.image;

            //Atribui a posição de exibição
            _ImageViewer.Left = ((DataGridView)sender).Name == "dgvImg1" ? (this.Left + grbImagens1.Width) : ((this.Left + grbImagens2.Left) - _ImageViewer.Width);
            _ImageViewer.Top  = System.Windows.Forms.Control.MousePosition.Y;

            _ImageViewer.Show();
        }
Example #45
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Grados.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            gradoMod = Grados.Text;

            try
            {

                if (con.State != ConnectionState.Open)
                    con.Open();
                SqlCommand cmd2 = new SqlCommand();
                cmd2.Connection = con;
                cmd2.CommandType = System.Data.CommandType.Text;
                cmd2.CommandText = "select ID_GRADO, ID_IND, ID, NOMBRE, VALOR from GRADOS where ID=" + id_eva + " and NOMBRE='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "' group by ID_GRADO, ID_IND, ID, NOMBRE, VALOR ORDER BY ID_GRADO;";
                SqlDataAdapter da = new SqlDataAdapter(cmd2);
                DataTable dt = new DataTable();
                DataSet ds = new DataSet();
                da.Fill(ds);
                dt = ds.Tables[0];
                dataGridView2.DataSource = dt;
            }
            catch (Exception ene)
            {
                MessageBox.Show(ene.ToString());
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                    con.Close();

            }
        }
Example #46
0
 private void keyDataGridView_CellContentDoubleClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         txtKey.Text = keyDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
     }
 }
        private void dataGridViewCSharp_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            DotNetType dotnetType = (DotNetType)((DataGridView)sender).Rows[e.RowIndex].Tag;

            if (dotnetType == null)
            {
                labelUsedBy.Text = "";
                return;
            }
            labelUsedBy.BeginUpdate();

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("<br/><br/>");
            //sb.AppendFormat("<br/>{0}UniType: <b>{1}</b>", SPACE, dotnetType.Name);
            //sb.AppendFormat("<br/>{0}C# type: <b>{1}</b>", SPACE, dotnetType.CSharpType);
            //sb.AppendLine("<br/><br/>");
            sb.AppendFormat("<br/>{0}<b>DB types that map to this:</b><br/><br/>", SPACE);

            sb.Append(GetDisplayTextForTypeUsages("SQL Server Types", Utility.SqlServerTypes, dotnetType));
            sb.Append(GetDisplayTextForTypeUsages("Oracle Types", Utility.OracleTypes, dotnetType));
            sb.Append(GetDisplayTextForTypeUsages("MySQL Types", Utility.MySqlTypes, dotnetType));
            sb.Append(GetDisplayTextForTypeUsages("PostgreSQL Types", Utility.PostgreSqlTypes, dotnetType));
            sb.Append(GetDisplayTextForTypeUsages("Firebird Types", Utility.FirebirdTypes, dotnetType));
            sb.Append(GetDisplayTextForTypeUsages("SQLite Types", Utility.SQLiteTypes, dotnetType));
            labelUsedBy.Text = sb.ToString();
            labelUsedBy.EndUpdate();
        }
Example #48
0
 private void dataGridView1_RowValidated(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     // Save row changes if any were made and release the edited
     // Customer object if there is one.
     if (e.RowIndex >= this.customers.Count &&
         e.RowIndex != this.dataGridView1.Rows.Count - 1)
     {
         // Add the new Customer object to the data store.
         this.customers.Add(this.customerInEdit);
         this.customerInEdit = null;
         this.rowInEdit      = -1;
     }
     else if (this.customerInEdit != null &&
              e.RowIndex < this.customers.Count)
     {
         // Save the modified Customer object in the data store.
         this.customers[e.RowIndex] = this.customerInEdit;
         this.customerInEdit        = null;
         this.rowInEdit             = -1;
     }
     else if (this.dataGridView1.ContainsFocus)
     {
         this.customerInEdit = null;
         this.rowInEdit      = -1;
     }
 }
Example #49
0
        /*Двойное нажатие на пациента в списке пациентов приводит к открытию его протокола*/
        private void SchedulerData_CellContentDoubleClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            //throw new System.NotImplementedException();
            if (user.login == null || user.role == Role.Undefined && (user.role != Role.Administrator || user.role != Role.Doctor) /*|| user.role != Role.Registrator || user.role != Role.SuperAdmin*/)
            {
                MessageBox.Show("У вас нет на это прав!");
            }
            else
            {
                patient.initials.surname = SchedulerData[0, e.RowIndex].Value.ToString();
                patient.sex             = SchedulerData[1, e.RowIndex].Value.ToString();
                patient.birth_date.date = SchedulerData[2, e.RowIndex].Value.ToString();
                patient.amb_card        = SchedulerData[3, e.RowIndex].Value.ToString();
                patient.is_child        = SchedulerData[4, e.RowIndex].Value.ToString();
                study.modality          = SchedulerData[5, e.RowIndex].Value.ToString();
                patient.pid             = Convert.ToInt32(SchedulerData[6, e.RowIndex].Value.ToString());

                shadow.box.patient  = patient;
                shadow.box.study    = study;
                shadow.box.protocol = protocol;
                shadow.box.date     = dt;

                shadow.box.protocol.sid = shadow.box.patient.pid;

                shadow.sql.RetrieveProtocol(shadow.box);
                shadow.box.protocol.sid = 0;
                shadow.win.CreateProtocolWindow(shadow.box);              // запустили окно
                shadow.box.state    = State.WaitForAction;                // поставили состояние на ожидание
                second              = new Thread(shadow.WorkWithWindows); // запустили метод в новом потоке
                second.Name         = "QuickSave";                        // дали потоку имя
                second.IsBackground = true;
                second.Start(shadow.box);                                 // передали объект-коробку с необходимыми данными
            }
        }
Example #50
0
 private void dataGridView1_CellContentClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         int i = e.RowIndex;
         MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
         String            number     = Convert.ToString(dataGridView1.Rows[i].Cells[1].Value);
         int n = Convert.ToInt32(dataGridView1.Rows[i].Cells[6].Value);
         Console.Write(number);
         DialogResult dr = MessageBox.Show("审核是否通过?", "提交", messButton);
         if (dr == DialogResult.OK)
         {
             if (num < n)
             {
                 dataGridView1.Rows[i].Cells[7].Value = "审核已通过";
                 shenheDao.update(number, "审核已通过");
                 num++;
             }
             else
             {
                 MessageBox.Show("通过人数已达上限!");
             }
         }
         else
         {
             dataGridView1.Rows[i].Cells[7].Value = "审核未通过";
             shenheDao.update(number, "审核未通过");
         }
     }
 }
Example #51
0
        private void dgvGerente_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1 && e.ColumnIndex > -1)
            {
                if (dgvGerente.Columns[e.ColumnIndex] == dgvGerente.Columns["Deletar"])
                {
                    var dialog =
                        MessageBox.Show(
                            string.Format("Você irá deletar o usuário {0}. Confirma?",
                                dgvGerente.Rows[e.RowIndex].Cells["nome"].Value), "DELETAR",
                            MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (dialog == DialogResult.Yes)
                    {
                        if (
                            DaoUsuario.Deletar(new Usuario
                            {
                                idusuario = (int) dgvGerente.Rows[e.RowIndex].Cells["id"].Value
                            }) != null)
                        {
                            MessageBox.Show("Deletado com sucesso.");
                            carregaAdmin();
                        }
                        else
                        {
                            MessageBox.Show("Erro ao deletar.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("O usuário não foi deletado.");
                    }
                }
            }
        }
        private void dgvSchedules_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dgvSchedules.Columns["Show"].Index && e.RowIndex != -1)
            {
                NavigationTool.OpenNewTab(new frmScheduleDetail(schedules[e.RowIndex]));
            }
            else if (e.ColumnIndex == dgvSchedules.Columns["Edit"].Index && e.RowIndex != -1)
            {
                NavigationTool.OpenNewTab(new frmEditSchedule(schedules[e.RowIndex]));
                LoadSchedules(scheduleService.GetAll(Session.currentUser));
            }
            else if (e.ColumnIndex == dgvSchedules.Columns["Delete"].Index && e.RowIndex != -1)
            {
                Schedule schedule = schedules[e.RowIndex];

                DialogResult dialogResult = MessageBox.Show(schedule.ScheduleName +
                                                            " adlı programı silmek istediğinizden emin misiniz?", "Programı Sil", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    try
                    {
                        scheduleService.Delete(schedule, Session.currentUser);
                        MessageBox.Show("Program başarıyla silindi!", "Başarılı!");
                    } catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Hata!");
                    }
                    schedules.Remove(schedule);
                    LoadSchedules(schedules);
                }
            }
        }
Example #53
0
 private void dgvDatos_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (this.dgvDatos.Columns[e.ColumnIndex].Name == "Costo")
     {
         this.dgvDatos.CurrentCell = this.dgvDatos["Cantidad", e.RowIndex];
     }
 }
 private void OnGridCellEnter(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == FILE_NAME_COLUMN_INDEX)
     {
         this.Session.MainForm.BeginInvoke(new DelegateNoArgs(this.OnNewCellEnterAsync), null);
     }
 }
Example #55
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                Label lb = new Label();
                lb.AutoSize = true;
                lb.Margin = new Padding(3, 3, 3, 3);
                lb.BorderStyle = BorderStyle.FixedSingle;
                lb.Text = string.Format("{0} - {1}", this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString());
                lb.Tag = string.Format("{0} {1}", this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), this.dataGridView1.SelectedRows[0].Cells[2].Value.ToString());
                OnButtonClick lbClick = (object sender1, EventArgs e1) =>
                {
                    lb.Dispose();
                };
                lb.DoubleClick += new EventHandler(lbClick);

                this.flowLayoutPanel1.Controls.Add(lb);
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());
                MessageBox.Show(ex.Message);
                return;
            }
        }
Example #56
0
        private void dgvThongTin_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            //if (dgvThongTin[colGia.Name, e.RowIndex].Value != null)
            //{
            //    long money = ConvertUtil.ConvertToLong(dgvThongTin[colGia.Name, e.RowIndex].Value.ToString().Replace(Constant.SYMBOL_LINK_MONEY, string.Empty));
            //    dgvThongTin[colGia.Name, e.RowIndex].Value = money.ToString(Constant.DEFAULT_FORMAT_MONEY);
            //}

            //bool isValidated = true;

            //if (ConvertUtil.ConvertToDouble(dgvThongTin[colGia.Name, e.RowIndex].Value) < 0)
            //{
            //    MessageBox.Show("Giá thấp hơn quy định!", Constant.CAPTION_WARNING, MessageBoxButtons.OK, MessageBoxIcon.Warning);

            //    isValidated = false;
            //}

            //if (!isValidated)
            //{
            //    pbSua.Enabled = false;
            //    pbSua.Image = Image.FromFile(ConstantResource.CHUC_NANG_ICON_EDIT_DISABLE);

            //    return;
            //}

            //pbSua.Enabled = true;
            //pbSua.Image = Image.FromFile(ConstantResource.CHUC_NANG_ICON_EDIT);
        }
Example #57
0
        private void dgvPRPlanInfo_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvPRPlanInfo.RowCount > 0)
            {
                string strPRPlanCode = dgvPRPlanInfo["PRPlanCode", dgvPRPlanInfo.CurrentRow.Index].Value.ToString();
                DataGridViewRowCollection dgvrc = formPRProduce.dgvPRProduceInfo.Rows;

                //判断该笔主生产计划单是否已经制定了生产单
                foreach (DataGridViewRow dgvr in dgvrc)
                {
                    if (strPRPlanCode == dgvr.Cells["PRPlanCode"].Value.ToString())
                    {
                        MessageBox.Show("该主生产计划已制定相应的生产单!", "软件提示");
                        return;
                    }
                }

                formPRProduce.txtPRPlanCode.Text =
                    dgvPRPlanInfo["PRPlanCode", dgvPRPlanInfo.CurrentCell.RowIndex].Value.ToString();
                formPRProduce.cbxInvenCode.SelectedValue =
                    dgvPRPlanInfo["InvenCode", dgvPRPlanInfo.CurrentCell.RowIndex].Value;
                formPRProduce.txtQuantity.Text =
                    dgvPRPlanInfo["Quantity", dgvPRPlanInfo.CurrentCell.RowIndex].Value.ToString();
                formPRProduce.dtpEndDate.Value =
                    Convert.ToDateTime(dgvPRPlanInfo["FinishDate", dgvPRPlanInfo.CurrentCell.RowIndex].Value);
                Close();
            }
        }
Example #58
0
 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     History.pid = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
     History.pname = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
     History h = new History();
     h.ShowDialog();
 }
Example #59
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == colRun.Index)
     {
         try
         {
             DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
             IIronPlugin plugin = (IIronPlugin)row.Tag;
             plugin.RunPlugin();
             // Display a list of variables now in the plugin's context
             IronPlugins.Context.VariableList variables = plugin.GetContextVariables();
             string variableList = "Variables on context:\r\n**************************************************\r\n";
             foreach (IronPlugins.Context.Variable var in variables)
             {
                 string varString = string.Format("{0} : {1}\r\n", var.Name, var.Value);
                 variableList += varString;
             }
             MessageBox.Show(variableList);
         }
         catch (Exception ex)
         {
             MessageBox.Show(new IronPlugins.Plugin.PythonPluginException(ex).Message);
         }
     }
     else if (e.ColumnIndex == colRemPlugin.Index)
     {
         DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
         IIronPlugin plugin = (IIronPlugin)row.Tag;
         plugin.Dispose();
         _pluginManager.RemovePlugin(plugin);
         dataGridView1.Rows.Remove(row);
     }
 }
Example #60
0
        private void DataGridView1_CellEndEdit(System.Object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            SqlControl sql = new SqlControl();

            if (this.DataGridView1.CurrentCell.ColumnIndex == 2)
            {
                Type numberType = this.DataGridView1.CurrentCell.Value.IsNumber();
                if (numberType == null)
                {
                    MessageBox.Show("Please Enter A Number", "Wrong input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                double value = Convert.ToDouble(this.DataGridView1.CurrentCell.Value);
                if (value < 0 || value > 100)
                {
                    MessageBox.Show("Enter a number between 1 to 100", "Wrong input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    bnload_Click(sender, e);
                    return;
                }
                sql.addprams("@name", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[0].Value);
                sql.addprams("@sub", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[1].Value);
                sql.addprams("@date", dtp.Value);
                sql.addprams("@mark", this.DataGridView1.CurrentCell.Value);
                sql.ExecProc("exec update_marks @name,@sub,@date,@mark");
                bnload_Click(sender, e);
                if (sql.exep != "")
                {
                    MessageBox.Show(sql.exep);
                    return;
                }
            }
        }