⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 This program is compare the data in sql server. And you can syncronize the table and views this is v
💻 CS
📖 第 1 页 / 共 5 页
字号:
                                ayni[i, sayac, 1] = k;
                                sayac++;
                                break;
                            }
                        }
                        if (sayac == kont)
                        {
                            ayni[i, sayac, 0] = -1;
                            ayni[i, sayac, 1] = j;
                            sayac++;
                        }
                    }

                    for (int j = 0; j < 20; j++)
                    {
                        int fg = 0;
                        for (k = 0; k < 20; k++)
                        {
                            if (ayni[i, k, 1] != -1)
                            {
                                if (kolon1[d1, k] != kolon2[d2, ayni[i, k, 1]])
                                {
                                    fg++;
                                }
                            }
                            else
                            {
                                fg++;
                            }
                        }
                        if (sayac == 20) break;
                        if (fg == 20)
                        {
                            ayni[i, sayac, 0] = j;
                            ayni[i, sayac, 1] = -1;
                            sayac++;
                        }
                    }
                }
                int sd = 0;
                for (int j = 0; j < 20; j++)
                {
                    if ((ayni[i, j, 0] != -1) && (ayni[i, j, 1] != -1))
                    {
                        check[0, i, j] = true;
                        sd++;
                    }
                }
                dataGridView2.Rows[i].Cells[4].Value = Convert.ToString(sd) + " Columns";
                sd = 0;
                for (int j = 0; j < 20; j++)
                {
                    if (kolon1[i, j] == null) break;
                    if (kolon1[i, j] == prikey1[i])
                    {
                        check[1, i, j] = true;
                        sd = 1;
                    }
                }
                if ((sd == 0) || (dataGridView2.Rows[i].Cells[1].Value == null) || (dataGridView2.Rows[i].Cells[3].Value == null))
                {
                    ((DataGridViewCheckBoxCell)(dataGridView2.Rows[i].Cells[2])).ReadOnly = true;
                    dataGridView2.Rows[i].Cells[2].Value = false;
                    nokey[i] = 1;
                    keyset[i] = 1;
                }
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            object o = new object();
            EventArgs ee = new EventArgs();
            comboBox1.SelectedIndex = 0;
            comboBox3.SelectedIndex = 0;
            comboBox1_SelectedIndexChanged(o, ee);
            comboBox3_SelectedIndexChanged(o, ee);
            comboBox2.SelectedIndex = comboBox2.Items.Count - 2;
            comboBox4.SelectedIndex = comboBox4.Items.Count - 1;
        }

        public void farh()
        {

        }

        public void aciklama(int a, int b)
        {
            int d1 = -1;
            int d2 = -1;
            if (radioButton6.Checked == true)
            {
                farh();
            }
            if ((dataGridView2.Rows[a].Cells[1].Value == null) && (radioButton5.Checked==true))
            {
                MessageBox.Show("The object is null.You don't compare this!");
                panel1.Visible = false;
            }
            else if ((dataGridView2.Rows[a].Cells[3].Value == null) && (radioButton5.Checked==true))
            {
                MessageBox.Show("The object is null.You don't compare this!");
                panel1.Visible = false;
            }
            else //if (dataGridView2.Rows[a].Cells[2].Value.ToString() == "True")
            {
                dataGridView1.Rows.Clear();
                int d3 = adtut[a, 1];
                int ad = 0;
                if (b == 0)
                {
                    dataGridView1.Columns[2].HeaderText = "   Pri_Key";
                    ad = 1;
                }
                else if (b == 4)
                {
                    dataGridView1.Columns[2].HeaderText = "  Compare";
                    ad = 0;
                }
                int satir = 0;
                for (int i = 0; i < 20; i++)
                {
                    d1 = ayni[a, i, 0];
                    d2 = ayni[a, i, 1];
                    
                    if ((d1 != -1) && (d2 != -1) && (radioButton5.Checked==true))
                    {
                        DataGridViewRow dr = new DataGridViewRow();
                        dataGridView1.Rows.Insert(i, dr);
                        dataGridView1.Rows[i].Cells[0].Value = tipi1[a, d1];
                        dataGridView1.Rows[i].Cells[1].Value = kolon1[a, d1];
                        dataGridView1.Rows[i].Cells[2].Value = check[ad, a, i];
                        dataGridView1.Rows[i].Cells[3].Value = kolon2[d3, d2];
                        dataGridView1.Rows[i].Cells[4].Value = tipi2[d3, d2];
                        if ((b == 0) && (keyset[d3] == 0))
                        {
                            ((DataGridViewCheckBoxCell)(dataGridView1.Rows[i].Cells[2])).ReadOnly = true;
                        }
                        if ((b == 4) && (prikey1[a] == kolon1[a, i]))
                        {
                            ((DataGridViewCheckBoxCell)(dataGridView1.Rows[i].Cells[2])).ReadOnly = true;
                        }
                    }
                    else if ((radioButton6.Checked == true) && (b == 4))
                    {
                        if ((dataGridView2.Rows[a].Cells[1].Value != null) && (dataGridView2.Rows[a].Cells[3].Value != null))
                        {
                            
                            if (kolon1[a, i] == null)
                            {
                                int inn1 = 0;
                                for (int s = 0; s < 20; s++)
                                {
                                    if (adi1[a] == adi2[s])
                                    {
                                        inn1 = s;
                                    }
                                }
                                for (int q = 0; q < 20; q++)
                                {
                                    int o1 = 0;
                                    for (int t = 0; t < 20; t++)
                                    {
                                        if ((kolon1[a, t] == kolon2[inn1, q]) && (tipi1[a, t] == tipi2[inn1, q]))
                                        {
                                            o1 = 1;
                                            break;
                                        }
                                    }
                                    if (o1 == 0)
                                    {
                                        DataGridViewRow ds = new DataGridViewRow();
                                        dataGridView1.Rows.Insert(dataGridView1.Rows.Count, ds);
                                        dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[4].Value = tipi2[inn1, q];
                                        dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[3].Value = kolon2[inn1,q ];
                                        dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[2].Value = check1[a, dataGridView1.Rows.Count - 1];
                                    }
                                }
                                break;
                            }
                            int inn = 0;
                            int o = 0;
                            for (int s = 0; s < 20; s++)
                            {
                                if (adi1[a] == adi2[s])
                                {
                                    inn = s;
                                }
                            }
                            for (int t = 0; t < 20; t++)
                            {
                                if ((kolon1[a, i] == kolon2[inn, t]) && (tipi1[a, i] == tipi2[inn, t]))
                                {
                                    o = 1;
                                }
                            }
                            if (o == 0)
                            {
                                DataGridViewRow ds = new DataGridViewRow();
                                dataGridView1.Rows.Insert(dataGridView1.Rows.Count, ds);
                                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].Value = tipi1[a, i];
                                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Value = kolon1[a, i];
                                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[2].Value = check1[a, dataGridView1.Rows.Count - 1];
                                //if (kolon1[a, h] == prikey1[a])
                                //{
                                //    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[2].Value = true;
                                //    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].ReadOnly = true;
                                //}
                            }

                        }
                        else if ((dataGridView2.Rows[a].Cells[1].Value != null))
                        {
                            string sar = dataGridView2.Rows[a].Cells[1].Value.ToString();
                            int adm = 0;
                            for (int g = 0; g < 20; g++)
                            {
                                if (sar == adi1[g])
                                {
                                    adm = g;
                                    break;
                                }
                            }
                            if (kolon1[adm, i] == null) break;
                            DataGridViewRow dr = new DataGridViewRow();
                            dataGridView1.Rows.Insert(satir, dr);
                            dataGridView1.Rows[satir].Cells[0].Value = tipi1[adm, i];
                            dataGridView1.Rows[satir].Cells[1].Value = kolon1[adm, i];
                            dataGridView1.Rows[satir].Cells[2].Value = check1[a, satir];
                            satir++;
                        }
                        else if ((dataGridView2.Rows[a].Cells[3].Value != null))
                        {
                            string sar = dataGridView2.Rows[a].Cells[3].Value.ToString();
                            int adm = 0;
                            for (int g = 0; g < 20; g++)
                            {
                                if (sar == adi2[g])
                                {
                                    adm = g;
                                    break;
                                }
                            }
                            if (kolon2[adm, i] == null) break;
                            DataGridViewRow dr = new DataGridViewRow();
                            dataGridView1.Rows.Insert(satir, dr);
                            dataGridView1.Rows[satir].Cells[2].Value = check1[a, satir];
                            dataGridView1.Rows[satir].Cells[3].Value = kolon2[adm, i];
                            dataGridView1.Rows[satir].Cells[4].Value = tipi2[adm, i];
                            satir++;
                        }
                    }
                }
            }
        }

        private void dataGridView2_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int y = e.ColumnIndex;
            int x = e.RowIndex;
            sat = x;
            sut = y;
            Point p = new Point(46, 90 + (x + 1) * 22);
            if ((x >= 0) && (y >= 0))
            {
                if (((y == 0) || (y == 4)) && (panel1.Visible == false) && (panel2.Visible == false))
                {
                    if (y == 4)
                    {
                        p.X = 239;
                    }
                    panel1.Location = p;
                    panel1.Visible = true;
                    aciklama(x, y);
                }
            }
            else
            {
                xkor = x;
                ykor = y;
            }
            dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
            dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            if (sut == 4)
            {
                int sayac = 0;
                if (radioButton5.Checked == true)
                {
                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        if (dataGridView1.Rows[i].Cells[2].Value.ToString() == "True")
                        {
                            check[0, sat, i] = true;
                            sayac++;
                        }
                        else
                        {
                            check[0, sat, i] = false;
                        }
                    }
                }
                else if (radioButton6.Checked == true)
                {
                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        if (dataGridView1.Rows[i].Cells[2].Value.ToString() == "True")
                        {
                            check1[sat, i] = true;
                            sayac++;
                        }
                        else
                        {
                            check1[sat, i] = false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -