Exemplo n.º 1
0
        public void InsertData(string objecname, string controlname, string controltype, string word_def, string word_eng, string word_loc, string word_korea)
        {
            string pathfile    = Application.StartupPath + @"\option.ini";
            string servername_ = Read(pathfile, "DataBase", "Server");
            string database_   = Read(pathfile, "DataBase", "DataBase");
            string user_       = Read(pathfile, "DataBase", "User");

            conn = new ConnectSQL(servername_, database_, user_);
            string sql = "insert into tb_language values('" + objecname + "','" + controlname + "','" + controltype + "',N'" + word_def + "',N'" + word_eng + "',N'" + word_loc + "',N'" + word_korea + "')";

            conn.ExecuteNonQuery(sql);
        }
Exemplo n.º 2
0
        public void TranslateControl(Control tmp, Control tmp1, string language)
        {
            string pathfile    = Application.StartupPath + @"\option.ini";
            string servername_ = Read(pathfile, "DataBase", "Server");
            string database_   = Read(pathfile, "DataBase", "DataBase");
            string user_       = Read(pathfile, "DataBase", "User");

            conn = new ConnectSQL(servername_, database_, user_);
            if (tmp1 is DataGridView)
            {
                DataGridView tmp2 = (DataGridView)tmp1;
                for (int i = 0; i < tmp2.Columns.Count; i++)
                {
                    try
                    {
                        string    headername = tmp2.Columns[i].Name;
                        string    sql        = "select  " + language + " as language from tb_language where obj_name='" + tmp.Name + "' and control_name='" + headername + "'";
                        DataTable dt         = conn.GetDataTable(sql);
                        tmp2.Columns[i].HeaderText = dt.Rows[0]["language"].ToString();
                    }
                    catch (Exception ex)
                    {
                        string s = ex.ToString();
                    }
                }
            }
            else
            {
                if (tmp1 is MenuStrip)
                {
                    MenuStrip tmp2 = (MenuStrip)tmp1;
                    foreach (ToolStripMenuItem tmp3 in tmp2.Items)
                    {
                        string    sql = "select  " + language + " as language from tb_language where obj_name='" + tmp.Name + "' and control_name='" + tmp3.Name + "'";
                        DataTable dt  = conn.GetDataTable(sql);
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            tmp3.Text = dt.Rows[0]["language"].ToString();
                        }
                    }
                }
                else
                {
                    string    sql = "select  " + language + " as language from tb_language where obj_name='" + tmp.Name + "' and control_name='" + tmp1.Name + "'";
                    DataTable dt  = conn.GetDataTable(sql);
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        tmp1.Text = dt.Rows[0]["language"].ToString();
                    }
                }
            }
        }