Ejemplo n.º 1
0
 public frmPostsAC(SqlConnection con, string fun, DataGridView d, DataGridViewSelectedCellCollection _selcells)
 {
     InitializeComponent();
     myConnection = con;
     selcells = _selcells;
     con2 = con;
     dgvP = d;
     switch (fun)
     {
         case "add":
             this.Text = "Добавить должность";
             break;
         case "change":
             this.Text = "Изменить должность";
             break;
     }
 }
Ejemplo n.º 2
0
 public frmEmployeesAC(SqlConnection con, string fun, DataGridView d, DataGridViewSelectedCellCollection _selcells)
 {
     InitializeComponent();
     myConnection = con;
     selcells = _selcells;
     con2 = con;
     dgvP = d;
     fillPostsBox();
     switch (fun)
     {
         case "add":
             this.Text = "Добавить сотрудника";
             break;
         case "change":
             this.Text = "Изменить данные о сотруднике";
             break;
     }
 }
Ejemplo n.º 3
0
 public frmPets(SqlConnection conn, string fun, DataGridView dgv, DataGridViewSelectedCellCollection _selcells)
 {
     InitializeComponent();
     myConnection = conn;
     selcells = _selcells;
     dgvP = dgv;
     fillCombo(cbSpecies, "GET_SPECIES_LIST");//Species
     switch (fun)
     {
         case "add":
             this.Text = "Добавить животное";
             btnAddMore.Visible = true;
             break;
         case "change":
             this.Text = "Изменить данные о животном";
             cbSpecies.Text = selcells[6].Value.ToString();
             pictureBox1.Image = ByteArrayToImage((byte[])selcells[8].Value);
             break;
     }
 }
Ejemplo n.º 4
0
 public frmProvidersACD(SqlConnection con, string fun, DataGridView d, DataGridViewSelectedCellCollection _selcells)
 {
     InitializeComponent();
     myConnection = con;
     selcells = _selcells;
     con2 = con;
     dgvP = d;
     fillCityBox();
     switch (fun)
     {
         case "add":
             this.Text = "Добавить поставщика";
             butAddNext.Visible = true;
             break;
         case "change":
             this.Text = "Изменить данные";
             butAddNext.Visible = false;
             break;
     }
 }
Ejemplo n.º 5
0
 public history(DataGridViewSelectedCellCollection dgvsc)
 {
     //Variable declaration & initialization\\
     InitializeComponent();
     metroLabel1.Text = "History - " + dgvsc[0].Value;
     this.dgvsc = dgvsc;
     query = "SELECT TOP 1 * FROM [CSS].[dbo].[historyIndex] order by historyID DESC";
     sqlConnection();
     sqlCon.Open();
     dt = new DataTable();
     command = new SqlCommand();
     command.CommandText = query;
     command.CommandType = CommandType.Text;
     command.Connection = sqlCon;
     sa = new SqlDataAdapter(command);
     sa.Fill(dt);
     query2 = "SELECT [clusterIndex] ,[recencyCentroid],[frequencyCentroid],[monetaryCentroid],[recencyDOM],[frequencyDOM],[monetaryDOM],[rfmScore],[clusterSegment] from [CSS].[dbo].historyDetail where historyID ='" + dgvsc[0].Value.ToString() + "'";
     command = new SqlCommand(query2, sqlCon);
     command.CommandText = query2;
     command.CommandType = CommandType.Text;
     command.Connection = sqlCon;
     sa = new SqlDataAdapter(command);
     ds = new DataSet();
     sa.Fill(ds, "history");
     //History detail grid filled with records from database\\
     historyDetailGrid.DataSource = ds.Tables[0].DefaultView;
     sqlCon.Close();
     //History detail grid properties setting\\
     historyDetailGrid.Columns[0].HeaderText = "Cluster";
     historyDetailGrid.Columns[1].HeaderText = "Recency Centroid";
     historyDetailGrid.Columns[2].HeaderText = "Frequency Centroid";
     historyDetailGrid.Columns[3].HeaderText = "Monetary Centroid";
     historyDetailGrid.Columns[4].HeaderText = "Recency DOM";
     historyDetailGrid.Columns[5].HeaderText = "Frequency DOM";
     historyDetailGrid.Columns[6].HeaderText = "Monetary DOM";
     historyDetailGrid.Columns[7].HeaderText = "RFM Score";
     historyDetailGrid.Columns[8].HeaderText = "Cluster Segment";
     historyDetailGrid.Columns[1].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
     historyDetailGrid.Columns[2].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
     historyDetailGrid.Columns[3].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
     historyDetailGrid.Columns[4].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
     historyDetailGrid.Columns[5].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
     historyDetailGrid.Columns[6].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
     historyDetailGrid.Columns[7].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
     historyDetailGrid.Columns[1].DefaultCellStyle.Format = "0.0#####";
     historyDetailGrid.Columns[2].DefaultCellStyle.Format = "0.0#####";
     historyDetailGrid.Columns[3].DefaultCellStyle.Format = "0.0#####";
     historyDetailGrid.Columns[4].DefaultCellStyle.Format = "0.0#####";
     historyDetailGrid.Columns[5].DefaultCellStyle.Format = "0.0#####";
     historyDetailGrid.Columns[6].DefaultCellStyle.Format = "0.0#####";
     historyDetailGrid.Columns[7].DefaultCellStyle.Format = "0.0#####";
     historyDetailGrid.Columns[0].Width = 35;
     historyDetailGrid.Columns[1].Width = 60;
     historyDetailGrid.Columns[2].Width = 60;
     historyDetailGrid.Columns[3].Width = 60;
     historyDetailGrid.Columns[4].Width = 60;
     historyDetailGrid.Columns[5].Width = 60;
     historyDetailGrid.Columns[6].Width = 60;
     historyDetailGrid.Columns[7].Width = 70;
     historyDetailGrid.Columns[8].MinimumWidth = 100;
     historyDetailGrid.Columns[8].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
     string criteriaFilePath = "../screenshot/" + dgvsc[0].Value.ToString() + "_Criteria.jpg";
     criteriaPictureBox.ImageLocation = criteriaFilePath;
     string chartFilePath = "../screenshot/" + dgvsc[0].Value.ToString() + "_Chart.jpg";
     chartPictureBox.ImageLocation = chartFilePath;
 }
Ejemplo n.º 6
0
 private DataGridViewCell GetLeftTopMostCell(DataGridViewSelectedCellCollection cells)
 {
     List<DataGridViewCell> leftMostCells = this.GetLeftMostCells(cells);
     return this.GetTopMostCell(leftMostCells);
 }
Ejemplo n.º 7
0
 private List<DataGridViewCell> GetLeftMostCells(DataGridViewSelectedCellCollection cells)
 {
     List<DataGridViewCell> leftMostCells = new List<DataGridViewCell>();
     int columnIndex = cells[0].ColumnIndex;
     leftMostCells.Add(cells[0]);
     foreach (DataGridViewCell cell in cells)
     {
         AddLeftCell(leftMostCells, columnIndex, cell);
     }
     return leftMostCells;
 }
Ejemplo n.º 8
0
 private void FillSelectedCells(DataGridViewCell leftTopMostCell, DataGridViewSelectedCellCollection selectedCells)
 {
     string str = (leftTopMostCell.Value == null) ? string.Empty : leftTopMostCell.Value.ToString();
     int columnIndex = leftTopMostCell.ColumnIndex;
     this.FillColumn(leftTopMostCell, selectedCells);
     while (++columnIndex < this.m_GridCellService.ColumnCount)
     {
         DataGridViewCell topestCell = this.m_GridCellService.Rows[leftTopMostCell.RowIndex].Cells[columnIndex];
         this.FillColumn(topestCell, selectedCells);
     }
 }
Ejemplo n.º 9
0
 private void FillColumn(DataGridViewCell topestCell, DataGridViewSelectedCellCollection selectedCells)
 {
     string str = (topestCell.Value == null) ? string.Empty : topestCell.Value.ToString();
     int rowIndex = topestCell.RowIndex;
     while (++rowIndex < this.m_GridCellService.RowCount)
     {
         DataGridViewCell dataGridViewCell = this.m_GridCellService.Rows[rowIndex].Cells[topestCell.ColumnIndex];
         if (!selectedCells.Contains(dataGridViewCell))
         {
             break;
         }
         dataGridViewCell.Value = str;
     }
 }
Ejemplo n.º 10
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     DataGridView.HitTestInfo info = base.HitTest(e.X, e.Y);
     this._selectCells = base.SelectedCells;
     if ((!this._isControlKey && (info.RowIndex >= 0)) && (info.ColumnIndex >= 0))
     {
         this._firstSelectedCell = base[info.ColumnIndex, info.RowIndex];
     }
     base.OnMouseDown(e);
 }
Ejemplo n.º 11
0
		private int GetSmallestColumnIndex(DataGridViewSelectedCellCollection cells)
		{
			int minColumnIndex = ActiveWS.Spreadsheet.ColumnCount - 1;
			foreach (DataGridViewCell cell in cells)
			{
				if (cell.ColumnIndex < minColumnIndex)
					minColumnIndex = cell.ColumnIndex;
			}
			return minColumnIndex;
		}
Ejemplo n.º 12
0
        private void SetSelectionWish(Teacher teacher, int wishValue, DataGridViewSelectedCellCollection collection, CancellationToken cToken)
        {
            for (int i = 0; i < collection.Count; i++)
            {
                var cell = collection[i];
                var dow = cell.ColumnIndex - 1;

                if (cell.ColumnIndex <= 1)
                {
                    continue;
                }

                var calendars = _repo.Calendars.GetDowCalendars(dow);

                cToken.ThrowIfCancellationRequested();

                var ring = _repo.Rings.GetRing(((List<RingWeekView>)wishesView.DataSource)[cell.RowIndex].RingId);

                cToken.ThrowIfCancellationRequested();

                foreach (var calendar in calendars)
                {
                    cToken.ThrowIfCancellationRequested();

                    var teacherWish = new TeacherWish(teacher, calendar, ring, wishValue);

                    _repo.TeacherWishes.AddOrUpdateTeacherWish(teacherWish);
                }
            }
        }
Ejemplo n.º 13
0
 private void FS_MultiFiles(DataGridViewSelectedCellCollection collections)
 {
     string dir;
     using (FolderBrowserDialog fbd = new FolderBrowserDialog())
     {
         fbd.Description = "Select folder where you want to extract selected files";
         if (fbd.ShowDialog() == DialogResult.OK)
             dir = fbd.SelectedPath;
         else return;
     }
     for (int i = 0; i != collections.Count; i++)
         saveFSfile(dir,
             //collections[i].Cells[2].Value.ToString().Substring(16),
             collections[i].Value.ToString().Substring(16),
             ArchiveWorker.GetBinaryFile(
                 $"{Path.GetDirectoryName(aWorker._path)}\\{Path.GetFileNameWithoutExtension(aWorker._path)}",
                 collections[i].Value.ToString()));
 }