private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.CurrentCell.ValueType == Type.GetType("System.Boolean"))
            {
                sCell sChange = new sCell();
                if (dataGridView1.CurrentCell.OwningColumn.Name == "TW_State")
                {
                    sChange.strCountryCode = "TW";
                    sChange.bChange        = Convert.ToBoolean(dataGridView1["TW_State", dataGridView1.CurrentCell.RowIndex].Value.ToString());
                }
                else if (dataGridView1.CurrentCell.OwningColumn.Name == "KR_State")
                {
                    sChange.strCountryCode = "KR";
                    sChange.bChange        = Convert.ToBoolean(dataGridView1["KR_State", dataGridView1.CurrentCell.RowIndex].Value.ToString());
                }
                else if (dataGridView1.CurrentCell.OwningColumn.Name == "HK_State")
                {
                    sChange.strCountryCode = "HK";
                    sChange.bChange        = Convert.ToBoolean(dataGridView1["HK_State", dataGridView1.CurrentCell.RowIndex].Value.ToString());
                }
                else if (dataGridView1.CurrentCell.OwningColumn.Name == "JP_State")
                {
                    sChange.strCountryCode = "JP";
                    sChange.bChange        = Convert.ToBoolean(dataGridView1["JP_State", dataGridView1.CurrentCell.RowIndex].Value.ToString());
                }
                sChange.strTableName = dataGridView1["TableName", dataGridView1.CurrentCell.RowIndex].Value.ToString();
                sChange.nIndex       = Convert.ToInt32(dataGridView1["Index", dataGridView1.CurrentCell.RowIndex].Value.ToString());

                m_StateChangeCell.Add(sChange);
                m_bSaveEnd = false;
            }
        }
        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.CurrentCell.ColumnIndex < 2)
            {
                return;
            }
            if (objTemp.Equals(dataGridView1.CurrentCell.Value))
            {
                return;
            }
            if (dataGridView1.CurrentCell.Style.BackColor == Color.Red)
            {
                return;
            }
            if (dataGridView1.CurrentCell.OwningColumn.Name == "TW_State")
            {
                sCell sChange = new sCell();
                sChange.strCountryCode = "TW";
                sChange.nCount         = Convert.ToInt32(dataGridView1["ID", dataGridView1.CurrentCell.RowIndex].Value.ToString());


                for (int i = 0; i < m_tblTW.Rows.Count; i++)
                {
                    if (m_tblTW.Rows[i]["Name"].ToString() == dataGridView1["Name", dataGridView1.CurrentCell.RowIndex].Value.ToString())
                    {
                        m_tblTW.Rows[i]["State"] = dataGridView1["TW_State", dataGridView1.CurrentCell.RowIndex].Value;
                        sChange.strTableName     = m_tblTW.Rows[i]["Name"].ToString();
                        break;
                    }
                }

                m_StateChangeCell.Add(sChange);
            }

            if (dataGridView1.CurrentCell.OwningColumn.Name == "KR_State")
            {
                sCell sChange = new sCell();
                sChange.strCountryCode = "KR";
                sChange.nCount         = Convert.ToInt32(dataGridView1["ID", dataGridView1.CurrentCell.RowIndex].Value.ToString());


                for (int i = 0; i < m_tblKR.Rows.Count; i++)
                {
                    if (m_tblKR.Rows[i]["Name"].ToString() == dataGridView1["Name", dataGridView1.CurrentCell.RowIndex].Value.ToString())
                    {
                        m_tblKR.Rows[i]["State"] = dataGridView1["KR_State", dataGridView1.CurrentCell.RowIndex].Value;
                        sChange.strTableName     = m_tblKR.Rows[i]["Name"].ToString();
                        break;
                    }
                }
                m_StateChangeCell.Add(sChange);
            }
        }
        /*private void ColumnStateChange()
         * {
         *  int nCount;
         *  int ntblCurrentIndex = 0;
         *  if (m_tblKR.Rows.Count > m_tblTW.Rows.Count)
         *  {
         *      nCount = m_tblKR.Rows.Count;
         *  }
         *  else
         *  {
         *      nCount = m_tblTW.Rows.Count;
         *  }
         *
         *  for (int i = 0; i < nCount; i++)
         *  {
         *      DataRow Release_Current = m_tblCurrent.Rows[ntblCurrentIndex];
         *      DataRow Release_KR = m_tblKR.Rows[i];
         *      DataRow Release_TW = m_tblTW.Rows[i];
         *      if (m_tblCurrent.Columns.IndexOf("TW_State") != -1)
         *      {
         *          Release_TW = m_tblTW.Rows[i];
         *          if (Release_KR["TableName"].ToString() == Release_TW["TableName"].ToString() &&
         *              Release_KR["Index"].ToString() == Release_TW["Index"].ToString())
         *          {
         *              Release_Current["TW_State"] = Release_TW["State"];
         *          }
         *          else
         *          {
         *              if (Release_KR["TableName"].ToString() == "" &&
         *                  Release_KR["Index"].ToString() == "")
         *              {
         *                  //우리나라 해당부분이 공백일떄
         *
         *                  Release_Current["ID"] = Release_TW["Index"];
         *                  Release_Current["Name"] = Release_TW["Name"];
         *                  Release_Current["TW_State"] = Release_TW["State"];
         *                  Release_Current["KR_State"] = false;
         *
         *                  sCell sNew = new sCell();
         *                  sNew.strCountryCode = "KR";
         *                  sNew.nCount = ntblCurrentIndex;
         *                  m_NewCell.Add(sNew);
         *              }
         *              else if (Release_TW["TableName"].ToString() == "" &&
         *                   Release_TW["Index"].ToString() == "")
         *              {
         *                  //대만 해당부분이 공백일떄
         *                  Release_Current["TW_State"] = false;
         *
         *                  sCell sNew = new sCell();
         *                  sNew.strCountryCode = "TW";
         *                  sNew.nCount = ntblCurrentIndex;
         *                  m_NewCell.Add(sNew);
         *              }
         *              else
         *              {
         *                  Release_Current["TW_State"] = false;
         *
         *                  sCell sNew = new sCell();
         *                  sNew.strCountryCode = "TW";
         *                  sNew.nCount = ntblCurrentIndex;
         *                  m_NewCell.Add(sNew);
         *
         *                  ntblCurrentIndex++;
         *                  m_tblCurrent.Rows.Add();
         *
         *                  Release_Current = m_tblCurrent.Rows[ntblCurrentIndex];
         *                  Release_Current["ID"] = Release_TW["Index"];
         *                  Release_Current["Name"] = Release_TW["Name"];
         *                  Release_Current["KR_State"] = false;
         *                  Release_Current["TW_State"] = Release_TW["State"];
         *
         *
         *                  sNew.strCountryCode = "KR";
         *                  sNew.nCount = ntblCurrentIndex;
         *                  m_NewCell.Add(sNew);
         *              }
         *
         *          }
         *      }
         *      ntblCurrentIndex++;
         *  }
         *  dataGridView1.DataSource = m_tblCurrent;
         *  dataGridView1.AllowUserToAddRows = false;
         *
         *  for (int i = 0; i < m_NewCell.Count; i++)
         *  {
         *      if (((sCell)m_NewCell[i]).strCountryCode == "TW")
         *      {
         *          dataGridView1["TW_STate", ((sCell)m_NewCell[i]).nCount].Style.BackColor = Color.Red;
         *          dataGridView1["TW_STate", ((sCell)m_NewCell[i]).nCount].ReadOnly = true;
         *      }
         *      else if (((sCell)m_NewCell[i]).strCountryCode == "KR")
         *      {
         *          dataGridView1["KR_STate", ((sCell)m_NewCell[i]).nCount].Style.BackColor = Color.Red;
         *          dataGridView1["KR_STate", ((sCell)m_NewCell[i]).nCount].ReadOnly = true;
         *      }
         *  }
         *
         * }*/

        private void Setting()
        {
            int nCount;
            int ntblCurrentIndex = 0;

            if (m_tblKR.Rows.Count > m_tblTW.Rows.Count)
            {
                nCount = m_tblKR.Rows.Count;
            }
            else
            {
                nCount = m_tblTW.Rows.Count;
            }

            for (int i = 0; i < nCount; i++)
            {
                m_tblCurrent.Rows.Add();

                if (m_tblKR.Rows.Count <= i)
                {
                    m_tblKR.Rows.Add();
                }
                DataRow Release_Current = m_tblCurrent.Rows[ntblCurrentIndex];
                DataRow Release_KR      = m_tblKR.Rows[i];
                //DataRow String_Taiwan = tblString_Tw.Rows[i];

                Release_Current["ID"]       = Release_KR["Index"];
                Release_Current["Name"]     = Release_KR["Name"];
                Release_Current["KR_State"] = Release_KR["State"];

                if (m_tblTW.Rows.Count <= i)
                {
                    m_tblTW.Rows.Add();
                }
                if (m_tblCurrent.Columns.IndexOf("TW_State") != -1)
                {
                    DataRow Release_TW = m_tblTW.Rows[i];
                    if (Release_KR["TableName"].ToString() == Release_TW["TableName"].ToString() &&
                        Release_KR["Index"].ToString() == Release_TW["Index"].ToString())
                    {
                        Release_Current["TW_State"] = Release_TW["State"];
                    }
                    else
                    {
                        if (Release_KR["TableName"].ToString() == "" &&
                            Release_KR["Index"].ToString() == "")
                        {
                            //우리나라 해당부분이 공백일떄

                            Release_Current["ID"]       = Release_TW["Index"];
                            Release_Current["Name"]     = Release_TW["Name"];
                            Release_Current["TW_State"] = Release_TW["State"];
                            Release_Current["KR_State"] = false;

                            sCell sNew = new sCell();
                            sNew.strCountryCode = "KR";
                            sNew.nCount         = ntblCurrentIndex;
                            m_NewCell.Add(sNew);
                        }
                        else if (Release_TW["TableName"].ToString() == "" &&
                                 Release_TW["Index"].ToString() == "")
                        {
                            //대만 해당부분이 공백일떄
                            Release_Current["TW_State"] = false;

                            sCell sNew = new sCell();
                            sNew.strCountryCode = "TW";
                            sNew.nCount         = ntblCurrentIndex;
                            m_NewCell.Add(sNew);
                        }
                        else
                        {
                            Release_Current["TW_State"] = false;

                            sCell sNew = new sCell();
                            sNew.strCountryCode = "TW";
                            sNew.nCount         = ntblCurrentIndex;
                            m_NewCell.Add(sNew);

                            ntblCurrentIndex++;
                            m_tblCurrent.Rows.Add();

                            Release_Current             = m_tblCurrent.Rows[ntblCurrentIndex];
                            Release_Current["ID"]       = Release_TW["Index"];
                            Release_Current["Name"]     = Release_TW["Name"];
                            Release_Current["KR_State"] = false;
                            Release_Current["TW_State"] = Release_TW["State"];


                            sNew.strCountryCode = "KR";
                            sNew.nCount         = ntblCurrentIndex;
                            m_NewCell.Add(sNew);
                        }
                    }
                }
                ntblCurrentIndex++;
            }
            dataGridView1.DataSource         = m_tblCurrent;
            dataGridView1.AllowUserToAddRows = false;

            if (m_tblCurrent.Columns.IndexOf("TW_State") != -1)
            {
                for (int i = 0; i < m_NewCell.Count; i++)
                {
                    if (((sCell)m_NewCell[i]).strCountryCode == "TW")
                    {
                        dataGridView1["TW_STate", ((sCell)m_NewCell[i]).nCount].Style.BackColor = Color.Red;
                        dataGridView1["TW_STate", ((sCell)m_NewCell[i]).nCount].ReadOnly        = true;
                    }
                    else if (((sCell)m_NewCell[i]).strCountryCode == "KR")
                    {
                        dataGridView1["KR_STate", ((sCell)m_NewCell[i]).nCount].Style.BackColor = Color.Red;
                        dataGridView1["KR_STate", ((sCell)m_NewCell[i]).nCount].ReadOnly        = true;
                    }
                }
            }
        }