Example #1
0
        private void dgvacpass_CellContentClick_1(object sender, DataGridViewCellEventArgs e)//活动dgv点击事件
        {
            if (e.RowIndex >= 0)
            {
                DataGridViewColumn column = dgvacpass.Columns[e.ColumnIndex];

                if (column is DataGridViewButtonColumn)
                {
                    DataGridViewRow            dgvrow = dgvacpass.Rows[e.RowIndex];
                    DataGridViewCellCollection dgvCC  = dgvrow.Cells;
                    ActivityCheck up = new ActivityCheck(dgvCC, label_number.Text);
                    up.ShowDialog();
                    if (up.DialogResult == DialogResult.OK)
                    {
                        Adminpage_Load(null, null);
                    }
                }
            }
        }
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            DataGridViewRow            db = dtgvStock.CurrentRow;
            DataGridViewCellCollection coleccionCeldas = db.Cells;

            {
                if (!CargarProductoAListaCarrito(coleccionCeldas))
                {
                    MessageBox.Show("No hay stock", "Stock", MessageBoxButtons.OK, MessageBoxIcon.Warning);//exception
                }
                else
                {
                    dtgvStock.DataSource   = null;
                    dtgvStock.DataSource   = Showroom.listaStockProductos;
                    dtgvCarrito.DataSource = null;
                    dtgvCarrito.DataSource = miCliente.carritoCliente;
                }
            }
        }
Example #3
0
        private Empleado empleadoSeleccionado(DataGridViewCellCollection cells)
        {
            Empleado empleado = new Empleado();

            empleado.dni       = (decimal)cells[1].Value;
            empleado.nombre    = cells[2].Value.ToString();
            empleado.apellido  = cells[3].Value.ToString();
            empleado.mail      = cells[4].Value.ToString();
            empleado.telefono  = cells[5].Value.ToString();
            empleado.direccion = cells[6].Value.ToString();
            empleado.provincia = (byte)cells[7].Value;
            empleado.tipo      = (byte)cells[8].Value;
            empleado.sucursal  = (byte)cells[9].Value;

            empleado.habilitado = (byte)cells[10].Value > 0;


            return(empleado);
        }
Example #4
0
 private void button4_Click_1(object sender, EventArgs e)
 {
     if (client.GetSongList().Count > 0)
     {
         DataGridViewCellCollection currentRow = dataGridView1.CurrentRow.Cells; // Get the selected song information
         string    name   = currentRow[0].Value.ToString();                      // Name of the song
         string    author = currentRow[1].Value.ToString();                      // Author of the song
         AudioFile audio  = client.GetAudio(name, author);                       // Get the AudioFile object from the audio list available in the client
         client.DeleteSong(audio.Name, audio.Author);
         if (Playing != null)                                                    // If the song to delete is playing
         {
             if (Playing.Equals(audio))
             {
                 Stop();
             }
         }
         UpdateDisplay();
     }
 }
Example #5
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                if (dataGridView1.SelectedCells.Count > 0)
                {
                    DataGridViewCellCollection Cells = dataGridView1.SelectedRows[0].Cells;
                    button3.Enabled = true;

                    for (int i = 0; i < dataGridView1.SelectedRows[0].Cells.Count; i++)
                    {
                        if (Cells[i].Value != null)
                        {
                            guestData[i] = dataGridView1.SelectedRows[0].Cells[i].Value.ToString();
                        }
                    }
                }
            }
        }
Example #6
0
 private void button5_Click_1(object sender, EventArgs e)
 {
     if (client.GetSongList().Count > 0)
     {
         DataGridViewCellCollection currentRow = dataGridView1.CurrentRow.Cells; // Get the selected song information
         string    name   = currentRow[0].Value.ToString();                      // Name of the song
         string    author = currentRow[1].Value.ToString();                      // Author of the song
         AudioFile audio  = client.GetAudio(name, author);                       // Get the AudioFile object from the audio list available in the client
         if (client.GetMetadataOnline(audio))
         {
             MessageBox.Show("Song updated successfully!");
         }
         else
         {
             MessageBox.Show("Song was not found :(");
         }
         UpdateDisplay();
     }
 }
Example #7
0
        private byte extractPF2(DataGridViewCellCollection cells, int v1, int v2)
        {
            byte   data = 0;
            string bits = "";

            for (int i = v1; i <= v2; i++)
            {
                if (cells[i].Tag != null && ((int)cells[i].Tag == 1))
                {
                    bits = "1" + bits;
                }
                else
                {
                    bits = "0" + bits;
                }
            }
            data = Convert.ToByte(bits, 2);
            return(data);
        }
Example #8
0
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            DataGridViewCellCollection celdasFilaActual = dataGridView1.CurrentRow.Cells;
            Int32  idSeleccionado    = (Int32)celdasFilaActual[0].Value;
            String libroSeleccionado = (string)celdasFilaActual[1].Value;

            string       mensaje   = "¿Está seguro que desea eliminar el libro: " + libroSeleccionado + "?";
            string       titulo    = "Eliminación de un libro";
            DialogResult respuesta = MessageBox.Show(mensaje, titulo, MessageBoxButtons.YesNo, MessageBoxIcon.Stop);

            if (respuesta == DialogResult.Yes)
            {
                var libro = bibliotecaContext.Libros.Find(idSeleccionado);
                bibliotecaContext.Libros.Remove(libro);
                bibliotecaContext.SaveChanges();

                dataGridView1.DataSource = bibliotecaContext.Libros.ToList();
            }
        }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            DataGridViewCellCollection celdasFilaActual = grid.CurrentRow.Cells;
            int    idSeleccionado       = (int)celdasFilaActual[0].Value;
            string inmuebleSeleccionado = (string)celdasFilaActual[1].Value;

            string       mensaje   = "¿Está seguro que desea eliminar el inmueble: " + inmuebleSeleccionado + "?";
            string       titulo    = "Eliminación de un inmueble";
            DialogResult respuesta = MessageBox.Show(mensaje, titulo, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (respuesta == DialogResult.Yes)
            {
                Inmueble inmueble = db.Inmuebles.Find(idSeleccionado);
                db.Inmuebles.Remove(inmueble);
                db.SaveChanges();
                //recargamos el listado de categorias
                actualizarGrilla();
            }
        }
Example #10
0
 protected void modi()
 {
     try
     {
         DataGridViewRow            row    = grd_view.CurrentRow;
         DataGridViewCellCollection celdas = row.Cells;
         int    idCurso = (int)celdas["idCurso"].Value;
         string nombre  = celdas["nombre"].Value.ToString();
         int    cupo    = (int)celdas["cupo"].Value;
         Business.Entities.Curso curso = new Business.Entities.Curso(nombre, cupo);
         curso.IdCurso = idCurso;
         new frm_AltaCurso(curso).ShowDialog();
         grd_view.DataSource = Business.Logic.ABMcurso.listarCursos();
     }
     catch (Exception e)
     {
         MessageBox.Show("No ha seleccionado ningun curso", "Cuidado", MessageBoxButtons.OK);
     }
 }
        public void FailureMechanismResultsView_AllDataSet_DataGridViewCorrectlyInitialized()
        {
            // Setup
            FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1");

            var failureMechanism = new TestNonAdoptableWithProfileProbabilityFailureMechanism();

            FailureMechanismTestHelper.SetSections(failureMechanism, new[]
            {
                section
            });

            var sectionAssemblyResult = new FailureMechanismSectionAssemblyResultWrapper(
                new FailureMechanismSectionAssemblyResult(0.01, 0.1, 10, FailureMechanismSectionAssemblyGroup.I),
                AssemblyMethod.BOI0A1, AssemblyMethod.BOI0B1);

            // Call
            using (new AssemblyToolCalculatorFactoryConfig())
                using (ShowFailureMechanismResultsView(failureMechanism, sr => sectionAssemblyResult))
                {
                    DataGridView dataGridView = GetDataGridView();

                    // Assert
                    DataGridViewRowCollection rows = dataGridView.Rows;
                    Assert.AreEqual(1, rows.Count);

                    DataGridViewCellCollection cells = rows[0].Cells;
                    Assert.AreEqual(columnCount, cells.Count);
                    Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue);
                    Assert.AreEqual(true, cells[isRelevantIndex].Value);
                    Assert.AreEqual(NonAdoptableInitialFailureMechanismResultType.Manual, cells[initialFailureMechanismResultTypeIndex].Value);
                    Assert.AreEqual("-", cells[initialFailureMechanismResultProfileProbabilityIndex].FormattedValue);
                    Assert.AreEqual("-", cells[initialFailureMechanismResultSectionProbabilityIndex].FormattedValue);
                    Assert.AreEqual(FailureMechanismSectionResultFurtherAnalysisType.NotNecessary, cells[furtherAnalysisTypeIndex].Value);
                    Assert.AreEqual("-", cells[refinedProfileProbabilityIndex].FormattedValue);
                    Assert.AreEqual("-", cells[refinedSectionProbabilityIndex].FormattedValue);
                    Assert.AreEqual("1/100", cells[profileProbabilityIndex].FormattedValue);
                    Assert.AreEqual("1/10", cells[sectionProbabilityIndex].FormattedValue);
                    Assert.AreEqual("10,00", cells[sectionNIndex].FormattedValue);
                    Assert.AreEqual("+I", cells[assemblyGroupIndex].FormattedValue);
                }
        }
Example #12
0
        public static ExInfoData Construct(DataGridView dgv, int rowIndex)
        {
            ExInfoData data = new ExInfoData();

            if (dgv.Rows.Count < rowIndex + 1)
            {
                return(null);
            }

            DataGridViewCellCollection dr = dgv.Rows[rowIndex].Cells;

            if (dr == null)
            {
                return(null);
            }

            try { data.ID = Convert.ToInt32(dr["ID"]); }
            catch { }

            try { data.Title = Convert.ToString(dr["Title"]); }
            catch { }

            try { data.SampleRete = Convert.ToInt32(dr["SampleRete"]); }
            catch { }

            try { data.Samples2Read = Convert.ToInt32(dr["Samples2Read"]); }
            catch { }

            try { data.SaveNS = Convert.ToInt32(dr["SaveNS"]); }
            catch { }

            try { data.ETime = Convert.ToDateTime(dr["ETime"]); }
            catch { }

            try { data.Worker = Convert.ToString(dr["Worker"]); }
            catch { }

            try { data.NI9188Mod = Convert.ToString(dr["NI9188Mod"]); }
            catch { }

            return(data);
        }
Example #13
0
        private void View_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (View.CurrentCell == null)
            {
                return;
            }
            if (e.RowIndex == -1)
            {
                return;
            }
            if (mode != null)
            {
                return;
            }

            DataGridViewCellCollection cells = View.Rows[e.RowIndex].Cells;

            IdBox.Text      = Convert.ToString(cells[teacherIdDataGridViewTextBoxColumn.Index].Value);
            NameBox.Text    = Convert.ToString(cells[nameDataGridViewTextBoxColumn.Index].Value);
            AddressBox.Text = Convert.ToString(cells[addressDataGridViewTextBoxColumn.Index].Value);

            switch (Convert.ToString(cells[genderDataGridViewTextBoxColumn.Index].Value))
            {
            case "Male":
                MaleButton.Checked   = true;
                FemaleButton.Checked = false;
                break;

            case "Female":
                MaleButton.Checked   = false;
                FemaleButton.Checked = true;
                break;
            }

            DobBox.Value = Program.Entities.Teachers
                           .Where(s => s.TeacherId == IdBox.Text)
                           .FirstOrDefault()
                           .DateofBirth
                           .GetValueOrDefault(DateTime.Today);

            PhoneBox.Text = Convert.ToString(cells[phoneNumberDataGridViewTextBoxColumn.Index].Value);
        }
Example #14
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridDelete_Click(object sender, EventArgs e)
        {
            if (dgvData.DataSource != null)
            {
                DataGridViewCellCollection row = dgvData.CurrentRow.Cells;
                if (MessageBox.Show("您确认要删除标题为【" + row[1].Value + "】的数据吗?", "删除提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    string       path         = _provider.filePath("gridPath");
                    DataTable    dtGrid       = _provider.GetReadXml(path);
                    DataColumn[] myPrimaryKey = new DataColumn[1];
                    myPrimaryKey[0]   = dtGrid.Columns["AccountCode"];
                    dtGrid.PrimaryKey = myPrimaryKey;
                    DataRow myEditDataRow = dtGrid.Rows.Find(row[0].Value);
                    myEditDataRow.Delete();
                    dtGrid.AcceptChanges();
                    string gridXml  = _provider.CDataToXml(dtGrid);
                    string filePath = System.IO.Path.Combine(Application.StartupPath, path);
                    if (System.IO.File.Exists(filePath))
                    {
                        System.IO.StreamWriter sw = new System.IO.StreamWriter(filePath, false);
                        sw.WriteLine(gridXml);
                        sw.Close();//写入
                    }


                    myTreeNode tn     = tvNodes.SelectedNode as myTreeNode;
                    string     _path  = _provider.filePath("treePath");
                    DataTable  dtTree = _provider.GetReadXml(_path);
                    //当前节点下的所有子节点ID
                    List <string> listCode = new List <string>();
                    if (dtTree != null)
                    {
                        listCode.Add(tn.NodeCode.ToString());
                        DataRow[] dr_arr = dtTree.Select("parentNode='" + tn.NodeCode + "'");
                        //获取当前选中节点下的所有节点ID
                        _provider.SelectedTreeChild(dtTree, dr_arr, listCode);
                    }

                    LoadGridView(listCode);
                }
            }
        }
Example #15
0
        private async void DashButtonsTable_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex == DashButtonsTable.Columns["Test"].Index)
            {
                DataGridViewCellCollection rowCells = DashButtonsTable.Rows[e.RowIndex].Cells;
                string buttonDescription            = rowCells["Description"].Value?.ToString();
                string url = rowCells["ActionUrl"].Value?.ToString();
                if (!string.IsNullOrWhiteSpace(url))
                {
                    try
                    {
                        Log($"Testing action for {buttonDescription} button.");
                        await WebActionHelpers.SendGetRequestAsync(url);
                    }
                    catch (Exception ex)
                    {
                        _ = Task.Run(() => Log($"An error has occurred while running the action: '{url}' \n" + ex.Message));
                    }
                }
            }
            else if (DashButtonsTable.ReadOnly)
            {
                DialogResult dialogResult = MessageBox.Show("You need Administrative rights in order to modify values in this table. " +
                                                            "Would you like to restart the program with Administrative rights?",
                                                            "Missing Rights", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dialogResult == DialogResult.Yes)
                {
                    try
                    {
                        Process.Start(new ProcessStartInfo()
                        {
                            FileName        = Assembly.GetExecutingAssembly().Location,
                            UseShellExecute = true,
                            Verb            = "runas"
                        });
                        Application.Exit();
                    }
                    catch (Win32Exception) { }
                }
            }
        }
Example #16
0
        public void Constructor_DataGridViewCorrectlyInitialized()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            ConfigureHydraulicBoundaryDatabase(assessmentSection);
            mocks.ReplayAll();

            // Call
            ShowCalculationsView(ConfigureCalculationGroup(assessmentSection), new TestCalculatableFailureMechanism(), assessmentSection);

            var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;

            // Assert
            Assert.IsFalse(dataGridView.AutoGenerateColumns);
            Assert.AreEqual(2, dataGridView.ColumnCount);
            Assert.AreEqual("Naam", dataGridView.Columns[nameColumnIndex].HeaderText);
            Assert.AreEqual("Hydraulische belastingenlocatie", dataGridView.Columns[selectableHydraulicBoundaryLocationsColumnIndex].HeaderText);

            foreach (DataGridViewComboBoxColumn column in dataGridView.Columns.OfType <DataGridViewComboBoxColumn>())
            {
                Assert.AreEqual("DisplayName", column.DisplayMember);
                Assert.AreEqual("This", ((IReadOnlyList <DataGridViewComboBoxColumn>)dataGridView.Columns.OfType <DataGridViewComboBoxColumn>().ToArray())[0].ValueMember);
            }

            DataGridViewRowCollection rows = dataGridView.Rows;

            Assert.AreEqual(2, rows.Count);

            DataGridViewCellCollection cells = rows[0].Cells;

            Assert.AreEqual(2, cells.Count);
            Assert.AreEqual("Calculation 1", cells[nameColumnIndex].FormattedValue);
            Assert.AreEqual("Location 1 (2 m)", cells[selectableHydraulicBoundaryLocationsColumnIndex].FormattedValue);

            cells = rows[1].Cells;
            Assert.AreEqual(2, cells.Count);
            Assert.AreEqual("Calculation 2", cells[nameColumnIndex].FormattedValue);
            Assert.AreEqual("Location 2 (6 m)", cells[selectableHydraulicBoundaryLocationsColumnIndex].FormattedValue);
            mocks.VerifyAll();
        }
Example #17
0
        private void The_Passengers_grid_CurrentCellChanged(object sender, EventArgs e)
        {
            if (Group_Wagons_grid.CurrentCell == null)
            {
                return;
            }
            DataGridViewCellCollection cells = Group_Wagons_grid.CurrentCell.OwningRow.Cells;

            cellDatas = new object[cells.Count];

            //string af = "";
            for (int i = 0; i < cells.Count; i++)
            {
                cellDatas[i] = cells[i].Value;
                // af = af + " " + cellDatas[i];
            }

            Id_for_     = cellDatas[0].ToString();
            column_2    = cellDatas[1].ToString();
            column_data = cellDatas[3].ToString();

            now_id_box.Text = Group_Wagons_grid.CurrentCell.RowIndex.ToString();

            if (Panel_with_update.Enabled != false)
            {
                Number_train_box1.Text     = cellDatas[0].ToString();
                Number_wagon_box1.Text     = cellDatas[1].ToString();
                Type_wagon_box1.Text       = cellDatas[2].ToString();
                Data_Otbitiya_Picker1.Text = cellDatas[3].ToString();
            }
            execute_Train_and_wagons();

            execute_plase();
            ///////////////////////////

            //for (int i = 0; i < cellDatas.Length; i++)
            //{
            //    af = af + " " + cellDatas[i];
            //}
            //Console.WriteLine(cellDatas[0]);
            //Console.WriteLine(af);
        }
        public void Indexer_Index_Negative()
        {
            Form form = new Form();

            form.ShowInTaskbar = false;
            form.Controls.Add(_dataGridView);
            form.Show();

            DataGridViewCellCollection cells = _dataGridView.Rows [0].Cells;

            try
            {
                DataGridViewCell cell = cells [-1];
                Assert.Fail("#A1:" + cell);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                // Index was out of range. Must be non-negative
                // and less than the size of the collection
                Assert.AreEqual(typeof(ArgumentOutOfRangeException), ex.GetType(), "#A2");
                Assert.IsNull(ex.InnerException, "#A3");
                Assert.IsNotNull(ex.Message, "#A4");
                Assert.IsNotNull(ex.ParamName, "#A5");
                Assert.AreEqual("index", ex.ParamName, "#A6");
            }

            try
            {
                cells [-1] = new MockDataGridViewCell();
                Assert.Fail("#B1");
            }
            catch (ArgumentOutOfRangeException ex)
            {
                // Index was out of range. Must be non-negative
                // and less than the size of the collection
                Assert.AreEqual(typeof(ArgumentOutOfRangeException), ex.GetType(), "#B2");
                Assert.IsNull(ex.InnerException, "#B3");
                Assert.IsNotNull(ex.Message, "#B4");
                Assert.IsNotNull(ex.ParamName, "#B5");
                Assert.AreEqual("index", ex.ParamName, "#B6");
            }
        }
Example #19
0
 private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     txtSearch.Text          = "";
     comboBox1.SelectedIndex = 0;
     if (counter == 0)
     {
         panel2.Visible = false;
         DataGridViewCellCollection CellCollection = dataGridView2.Rows[e.RowIndex].Cells;
         setDetails(CellCollection);
     }
     else if (counter == 1)
     {
         panel2.Visible = false;
         DataGridViewCellCollection CellCollection = dataGridView2.Rows[e.RowIndex].Cells;
         setDetails1(CellCollection);
     }
     if (counter == 2)
     {
         panel2.Visible = false;
         DataGridViewCellCollection CellCollection = dataGridView2.Rows[e.RowIndex].Cells;
         string s  = CellCollection[0].Value.ToString();
         string s1 = CellCollection[1].Value.ToString();
         txtRef.Text = s;
         //MessageBox.Show(" "+s +" "+s1);
         string selectqurry = "select venderId,vName,vCompName,vAddress,vPhone,vMobile,vFax from VendorDetails where venderId='" + s1 + "'";
         makeBlnk(selectqurry);
         //DataTable dt = dbMainClass.getDetailByQuery(selectqurry);
         //foreach (DataRow dr in dt.Rows)
         //{
         //    textVendercod.Text = dr[0].ToString();
         //    txtVendorName.Text = dr[1].ToString();
         //    txtCompanyName.Text = dr[2].ToString();
         //    txtAddress.Text = dr[3].ToString();
         //    txtPhone.Text = dr[4].ToString();
         //    txtMobile.Text = dr[5].ToString();
         //    txtFax.Text = dr[6].ToString();
         //}
         string    selectqurry1 = "select vodd.ItemId,td.ItemName, vodd.Quantity,vodd.Price,vodd.TotalPrice from VendorOrderDetails vod join VendorOrderDesc vodd on vod.Orderid=vodd.Orderid join ItemDetails td on td.ItemId=vodd.ItemId where vod. Orderid='" + s + "'";
         DataTable dt1          = dbMainClass.getDetailByQuery(selectqurry1);
         dataGridView1.DataSource = dt1;
     }
 }
        /// <summary>
        /// 获得教育培训数据集
        /// </summary>
        /// <returns></returns>
        List <HR_EducatedHistory> GetEducatedHistory()
        {
            List <HR_EducatedHistory> educatedList = new List <HR_EducatedHistory>();

            for (int i = 0; i < dgvEducatedHistory.Rows.Count; i++)
            {
                HR_EducatedHistory         educatedHistory = new HR_EducatedHistory();
                DataGridViewCellCollection cells           = dgvEducatedHistory.Rows[i].Cells;

                educatedHistory.Diploma    = dgvEducatedHistory.Rows[i].Cells["学历"].Value.ToString();
                educatedHistory.StartTime  = dgvEducatedHistory.Rows[i].Cells["学习开始时间"].Value.ToString();
                educatedHistory.EndTime    = dgvEducatedHistory.Rows[i].Cells["学习截止时间"].Value.ToString();
                educatedHistory.Major      = dgvEducatedHistory.Rows[i].Cells["专业"].Value.ToString();
                educatedHistory.SchoolName = dgvEducatedHistory.Rows[i].Cells["学校"].Value.ToString();

                educatedList.Add(educatedHistory);
            }

            return(educatedList);
        }
        /// <summary>
        /// 获得工作经验数据集
        /// </summary>
        /// <returns></returns>
        List <HR_WorkHistory> GetWorkHistory()
        {
            List <HR_WorkHistory> workList = new List <HR_WorkHistory>();

            for (int i = 0; i < dgvWorkHistory.Rows.Count; i++)
            {
                HR_WorkHistory             workHistory = new HR_WorkHistory();
                DataGridViewCellCollection cells       = dgvWorkHistory.Rows[i].Cells;

                workHistory.CompanyName = dgvWorkHistory.Rows[i].Cells["公司名称"].Value.ToString();
                workHistory.Pay         = dgvWorkHistory.Rows[i].Cells["月酬"].Value.ToString();
                workHistory.Post        = dgvWorkHistory.Rows[i].Cells["工作岗位"].Value.ToString();
                workHistory.StartTime   = dgvWorkHistory.Rows[i].Cells["工作开始时间"].Value.ToString();
                workHistory.EndTime     = dgvWorkHistory.Rows[i].Cells["截止时间"].Value.ToString();

                workList.Add(workHistory);
            }

            return(workList);
        }
Example #22
0
        private void view_data_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            progresbar.Show();
            DataGridViewCellCollection a = view_data.Rows[e.RowIndex].Cells;

            MessageBox.Show(a[0].Value.ToString());
            fourniseur_model model = new fourniseur_model();

            model.Ref             = int.Parse(a[0].Value.ToString());
            model.Code_fourniseur = int.Parse(a[1].Value.ToString());
            model.Nom             = a[2].Value.ToString();
            model.Email           = a[3].Value.ToString();
            model.Adress          = a[4].Value.ToString();
            model.Numerophone     = a[5].Value.ToString();
            model.Fax             = a[6].Value.ToString();
            if (!update.IsBusy)
            {
                update.RunWorkerAsync(model);
            }
        }
Example #23
0
 //Загрузка нового выбранного параметра из таблицы
 private void LoadParam()
 {
     _cells = TemplateGrid.CurrentRow == null ? null : TemplateGrid.CurrentRow.Cells;
     try
     {
         var dic = (_cells == null ? "" : _cells.Get("Props")).ToPropertyDictionary();
         LinkCellAction.Text  = dic.Get("CellAction", CellActionType.Link.ToRussian());
         LinkCodeForming.Text = WriteText.Text = dic.Get("CodeForming", "<Полный код>");
         ApplyCellAction();
         CellField.Text = dic.Get("Field", "Значение");
         ApplyLinkField();
         LinkX.Text = dic.Get("X", "0");
         LinkY.Text = dic.Get("Y", "0");
         if (LinkPropsPanel.Visible)
         {
             LinkPropsPanel.PropsFromDic(dic);
         }
     }
     catch { }
 }
Example #24
0
        private Sach createSach(DataGridViewCellCollection r)
        {
            Sach s = new Sach();

            try
            {
                s.MaSach     = int.Parse(r["masach"].Value.ToString());
                s.TenSach    = r["tensach"].Value.ToString();
                s.TacGia     = r["tacgia"].Value.ToString();
                s.NamXuatBan = int.Parse(r["namxuatban"].Value.ToString());
                s.SoLuong    = int.Parse(r["soluong"].Value.ToString());
                s.TomTat     = r["tomtat"].Value.ToString();
                s.TheLoai    = r["theloai"].Value.ToString();
            }
            catch
            {
                return(null);
            }
            return(s);
        }
Example #25
0
 private void dtGVShow_Click(object sender, EventArgs e)
 {
     if (dtGVShow.SelectedRows.Count > 0)
     {
         rowClick        = dtGVShow.SelectedRows[0].Cells[0].Value.ToString();
         dataRowSendForm = dtGVShow.SelectedRows[0].Cells;
     }
     else
     {
         //dataRowSendForm = dtGVShow.Rows[0].Cells;
     }
     if (btnUpdateSBD && btnClick == 5)
     {
         tx_SBDInsert.Text = rowClick;
     }
     else
     {
         tx_SBDInsert.Text = "";
     }
 }
Example #26
0
        private void Init()
        {
            dgvCommandAndNames.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders;
            DataGridViewRowCollection rows = dgvCommandAndNames.Rows;

            rows.Clear();
            for (var i = 0; i < sameCommandTable.Count; i++)
            {
                rows.Add();
                DataGridViewCellCollection cells         = rows[i].Cells;
                CurrentAndImportCommand    sharedCommand = sameCommandTable[i];
                cells[0].Value = true;
                cells[1].Value = sharedCommand.CurrentCommand;
                cells[2].Value = sharedCommand.Name;
                cells[3].Value = sharedCommand.ImportCommand;
                cells[4].Value = false;
            }
            dgvCommandAndNames.ClearSelection();
            ResizeHeader();
        }
        // Store all courses the student has taken
        private void submitBtn_Click(object sender, EventArgs e)
        {
            Dictionary <string, Course> courseList = new Dictionary <string, Course>();

            // Parse data from each row of the data grid
            foreach (DataGridViewRow row in takenDataGrid.Rows)
            {
                DataGridViewCellCollection cells = row.Cells;
                if (cells[0].Value == null)
                {
                    break;
                }

                string courseName = cells[0].Value.ToString();
                char   grade      = cells[1].Value.ToString()[0];
                courseList[courseName] = new Course("Course", courseName, grade);
            }

            takenCourseList = courseList;
        }
Example #28
0
        private void buttonChiTiet_Click(object sender, EventArgs e)
        {
            DataGridViewCellCollection cell = dataGridViewQuyetDinhKyLuat.CurrentRow.Cells;

            Trace.WriteLine(cell);
            DTO.KyLuat kyLuat = new DTO.KyLuat(
                cell[0].Value.ToString(),
                DateTime.Parse(cell[1].Value.ToString()),
                DateTime.Parse(cell[2].Value.ToString()),
                cell[3].Value.ToString(),
                cell[4].Value.ToString(),
                cell[5].Value.ToString(),
                cell[6].Value.ToString()
                );
            this.Hide();
            ChiTietQuyetDinhKyLuat formChiTietQuyetDinhKyLuat = new ChiTietQuyetDinhKyLuat(kyLuat);

            formChiTietQuyetDinhKyLuat.FormClosed += FormChiTietQuyetDinhKyLuat_FormClosed;
            formChiTietQuyetDinhKyLuat.Show();
        }
Example #29
0
        //
        //学生管理
        //
        private void StuDGV_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewRow            dgvRow = StuDGV.Rows[e.RowIndex];
            DataGridViewCellCollection dgvCC  = dgvRow.Cells;

            stuXH.Text = dgvCC[0].Value.ToString();
            stuXM.Text = dgvCC[1].Value.ToString();
            stuZY.Text = dgvCC[2].Value.ToString();
            if (dgvCC[3].Value.ToString() == "男")
            {
                male.Checked = true;
            }
            else
            {
                female.Checked = true;
            }
            stuCS.Text  = dgvCC[4].Value.ToString();
            stuZXF.Text = dgvCC[5].Value.ToString();
            stuBZ.Text  = dgvCC[6].Value.ToString();
        }
Example #30
0
        private void dataGridViewClosedRooms_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridViewCellCollection CellCol = dataGridViewClosedRooms.CurrentRow.Cells;
                int apart = (int)CellCol[0].Value;

                DataRow row = lockHistoryTableAdapter1.LastLockGet(apart).Rows[0];

                labelTime.Text = row[0].ToString();
                string key = row[1].ToString();
                labelKey.Text = key;
                string PC = queriesTableAdapter1.GetLastPCforKey(key);

                DataRow client = clientTableAdapter1.GetDataBy(PC).Rows[0];


                labelHolder.Text = client[1].ToString() + " " + client[2].ToString();
            }catch (Exception ex) { }
        }
Example #31
0
		public int Compare(DataGridViewCellCollection lhs, DataGridViewCellCollection rhs)
		{
			foreach (SortColDefn colDefn in _sortedColumns)
			{
				int retval = Comparer<object>.Default.Compare(
					lhs[colDefn.colNum].Value,
					rhs[colDefn.colNum].Value);

				if (retval != 0)
					return (colDefn.ascending ? retval : -retval);
			}

			// These two rows are indistinguishable.
			return 0;
		}