コード例 #1
0
        private void bUpdata_Click(object sender, EventArgs e)
        {
            String res = "";

            try
            {
                for (int i = 0; i < dgvSelected.Rows.Count; i++)
                {
                    bandSelected = dgvSelected.Rows[i];
                    if (bandSelected.Visible)
                    {
                        row    = dgvSelected.Rows[i];
                        SQL    = "UPDATE showcase SET rent=" + row.Cells[1].Value.ToString() + " ,genre ='" + row.Cells[2].Value.ToString() + "' ,category='" + row.Cells[3].Value.ToString() + "' WHERE showcaseid='" + row.Cells[0].Value.ToString() + "';";
                        res   += "Showcase:" + row.Cells[0].Value.ToString() + " IN " + branchName + " rent : " + row.Cells[1].Value.ToString() + ", genre : " + row.Cells[2].Value.ToString() + ", category : " + row.Cells[3].Value.ToString() + " Is updated \n";
                        cmd    = new MySqlCommand(SQL, FormContainer.conn);
                        myData = cmd.ExecuteReader();
                        myData.Close();
                    }
                }

                //reset table
                dgvShowcaseList.Rows.Clear();
                dgvSelected.Rows.Clear();
                initializeShowcaseRecord(formID);
                initializeAvailibility();
            }catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show("Error " + ex.Number + " : " + ex.Message);
            }
            MessageBox.Show(res);
        }
コード例 #2
0
        public void initializeShowcaseRecord(String id)
        {
            try
            {
                SQL    = "select showcaseid,rent,genre,category from showcase WHERE branchid ='" + id + "';";
                cmd    = new MySqlCommand(SQL, FormContainer.conn);
                myData = cmd.ExecuteReader();
                while (myData.Read())
                {
                    dgvShowcaseList.Rows.Add(myData.GetString(0), myData.GetInt64(1), myData.GetString(2), myData.GetString(3));
                    dgvSelected.Rows.Add(myData.GetString(0), myData.GetInt64(1), myData.GetString(2), myData.GetString(3), id);
                }

                myData.Close();

                for (int i = 0; i < dgvSelected.Rows.Count; i++)
                {
                    bandSelected         = dgvSelected.Rows[i];
                    bandSelected.Visible = false;
                }
                tbSid.ResetText();
                tbRent.ResetText();
                cmbCategory.ResetText();
                cbPrivate.Checked = false;
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show("Error " + ex.Number + " : " + ex.Message);
            }
        }
コード例 #3
0
    private static void FreezeBand(DataGridViewBand band)
    {
        band.Frozen = true;
        DataGridViewCellStyle style = new DataGridViewCellStyle();

        style.BackColor       = Color.WhiteSmoke;
        band.DefaultCellStyle = style;
    }
コード例 #4
0
        private static void FixedColumn(DataGridViewBand band)
        {
            band.Frozen = true;
            DataGridViewCellStyle style = new DataGridViewCellStyle();

            style.BackColor       = Color.Wheat;
            band.DefaultCellStyle = style;
        }
コード例 #5
0
        //---------------------------------------------------------------------
        protected bool AddExcludedColumn(TFind findValue, TFind columnFindValue, DataGridViewBand column)
        {
            if (column == null || findValue.Equals(columnFindValue))
            {
                return(false);
            }

            _cacheExcludedColumnIndexCollectionByTypeFind.Add(column.Index);
            return(true);
        }
コード例 #6
0
        private void sUpdata_Click(object sender, EventArgs e)
        {
            if (row != null)
            {
                String  supdataSCid, supdataGenre, supdatacategory, supdataBranchid;
                decimal supdataRent;
                supdataSCid     = tbSid.Text;
                supdataGenre    = row.Cells[2].Value.ToString();
                supdatacategory = cmbCategory.Text;
                supdataRent     = tbRent.Value;
                supdataBranchid = row.Cells[4].Value.ToString();
                if (supdataSCid != "")
                {
                    try
                    {
                        SQL = "UPDATE showcase SET rent=" + supdataRent + " ,genre ='" + supdataGenre + "' ,category='" + supdatacategory + "' WHERE showcaseid='" + supdataSCid + "';";

                        cmd    = new MySqlCommand(SQL, FormContainer.conn);
                        myData = cmd.ExecuteReader();
                        myData.Close();
                        dgvShowcaseList.Sort(dgvShowcaseList.Columns[0], ListSortDirection.Ascending);
                        //get eachrow visible
                        ArrayList rowVisible = new ArrayList();
                        for (int i = 0; i < dgvShowcaseList.Rows.Count; i++)
                        {
                            DataGridViewBand getVisrow = dgvShowcaseList.Rows[i];
                            rowVisible.Add(getVisrow.Visible);
                        }
                        //reset table
                        dgvShowcaseList.Rows.Clear();
                        //SQL=>select showcaseid,rent,genre,category from showcase WHERE branchid ='branchid';
                        SQL    = "select showcaseid,rent,genre,category from showcase WHERE branchid ='" + supdataBranchid + "';";
                        cmd    = new MySqlCommand(SQL, FormContainer.conn);
                        myData = cmd.ExecuteReader();
                        while (myData.Read())
                        {
                            dgvShowcaseList.Rows.Add(myData.GetString(0), myData.GetInt64(1), myData.GetString(2), myData.GetString(3));
                        }
                        myData.Close();
                        initializeAvailibility();
                        for (int i = 0; i < dgvShowcaseList.Rows.Count; i++)
                        {
                            DataGridViewBand getVisrow = dgvShowcaseList.Rows[i];
                            getVisrow.Visible = (Boolean)rowVisible[i];
                        }
                    }
                    catch (MySql.Data.MySqlClient.MySqlException ex)
                    {
                        MessageBox.Show("Error " + ex.Number + " : " + ex.Message);
                    }
                    MessageBox.Show("Showcase:" + supdataSCid + " IN " + branchName + " rent : " + supdataRent + ", genre : " + supdataGenre + ", category : " + supdatacategory + " Is updated");
                }
            }
        }
コード例 #7
0
 private string GetSelectedValue(DataGridViewBand item)
 {
     try
     {
         var rowindex    = dataGridView1.CurrentCell.RowIndex;
         var selectedVal = dataGridView1.Rows[rowindex].Cells[item.Index].Value.ToString();
         return(string.IsNullOrEmpty(selectedVal) ? null : selectedVal);
     }
     catch
     {
         MessageBox.Show(@"Не выбрана строка");
         return(null);
     }
 }
コード例 #8
0
ファイル: LogWindowUtils.cs プロジェクト: sungaoyong/ProSuite
        public static void SetBackColor([NotNull] DataGridViewBand band,
                                        [NotNull] LogEventItem item)
        {
            Assert.ArgumentNotNull(band, nameof(band));
            Assert.ArgumentNotNull(item, nameof(item));

            Color backColor = GetBackColor(item);

            if (backColor.IsEmpty)
            {
                return;
            }

            SetBackColor(band, backColor);
        }
コード例 #9
0
        private void dgvSelected_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            row = this.dgvSelected.Rows[e.RowIndex];
            String sclSCid      = row.Cells[0].Value.ToString();
            int    i            = 0;
            String selectedSCid = "";

            do
            {
                selectedSCid = dgvShowcaseList.Rows[i].Cells[0].Value.ToString();
                i++;
            } while (sclSCid != selectedSCid);
            bandlist             = dgvShowcaseList.Rows[i - 1];
            bandlist.Visible     = true;
            bandSelected         = dgvSelected.Rows[e.RowIndex];
            bandSelected.Visible = false;
        }
コード例 #10
0
        private void dgvShowcaseList_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            string showcaseIDselected;
            string colname;

            try
            {
                showcaseIDselected = dgvShowcaseList[0, e.RowIndex].Value.ToString();
            }
            catch (ArgumentOutOfRangeException)
            {
                showcaseIDselected = null;
            }
            colname = dgvShowcaseList.Columns[e.ColumnIndex].Name;
            if (colname == "Select")
            {
                try
                {
                    if (e.RowIndex != -1)
                    {
                        if (dgvShowcaseList[availability.Index, e.RowIndex].Style.BackColor == Color.LimeGreen)
                        {
                            row = this.dgvShowcaseList.Rows[e.RowIndex];
                            String sclSCid      = row.Cells[0].Value.ToString();
                            int    i            = 0;
                            String selectedSCid = "";
                            do
                            {
                                selectedSCid = dgvSelected.Rows[i].Cells[0].Value.ToString();
                                i++;
                            } while (sclSCid != selectedSCid);
                            bandlist             = dgvShowcaseList.Rows[e.RowIndex];
                            bandlist.Visible     = false;
                            bandSelected         = dgvSelected.Rows[i - 1];
                            bandSelected.Visible = true;
                            //dgvSelected.Rows.Add(row.Cells[0].Value.ToString(), row.Cells[1].Value.ToString(), row.Cells[2].Value.ToString(), row.Cells[3].Value.ToString());
                        }
                    }
                }
                catch (ArgumentNullException)
                {
                    //cancel event when clicking on column header
                }
            }
        }
コード例 #11
0
ファイル: LogWindowUtils.cs プロジェクト: sungaoyong/ProSuite
 private static void SetBackColor(DataGridViewBand band, Color color)
 {
     band.DefaultCellStyle.BackColor = color;
 }
コード例 #12
0
 private static void SetBandColor(DataGridViewBand band, Color color)
 {
     band.Tag = color;
 }
コード例 #13
0
    // Turn off user's ability to resize a column.
    private void Button7_Click(object sender, EventArgs e)
    {
        DataGridViewBand band = dataGridView.Columns[0];

        band.Resizable = DataGridViewTriState.False;
    }
コード例 #14
0
    // Hide a band of cells.
    private void Button6_Click(object sender, System.EventArgs e)
    {
        DataGridViewBand band = dataGridView.Rows[3];

        band.Visible = false;
    }
コード例 #15
0
        private static LogEventItem GetLogEventItem(DataGridViewBand row)
        {
            Assert.ArgumentNotNull(row, nameof(row));

            return(row.Tag as LogEventItem);
        }