private void Btn_Add_Click(object sender, EventArgs e) { try { LanguageClass language = new LanguageClass(); language.functionGroup = txt_functionGroup.Text; language.functionName = txt_functionName.Text; language.Tiengviet = txt_tiengViet.Text; language.English = txt_english.Text; language.Chinese = txt_Chinese.Text; LanguageSetting languageSetting = new LanguageSetting(); languageSetting.InsertLanguageSetting(language); // languageClasses.Add(language); string sqlQuerry = "select FunctionGroup,FunctionName,TiengViet,English,Chinese from t_language "; sqlCON sqlcon = new sqlCON(); DataTable dt = new DataTable(); sqlcon.sqlDataAdapterFillDatatable(sqlQuerry, ref dt); dtgv_SettingLanguage.DataSource = null; dtgv_SettingLanguage.DataSource = dt; } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "Add Language ", ex.Message); } }
private void Btn_uploadfile_Click(object sender, EventArgs e) { try { if (txt_SettingFile.Text != "") { DataTable dt = new DataTable(); Class.ToolSupport toolSupport = new Class.ToolSupport(); dt = toolSupport.ReadexcelToDatatable("SettingLanguage", txt_SettingFile.Text); for (int i = 0; i < dt.Rows.Count; i++) { LanguageClass language = new LanguageClass(); language.functionGroup = dt.Rows[i][0].ToString(); language.functionName = dt.Rows[i][1].ToString(); language.Tiengviet = dt.Rows[i][2].ToString(); language.English = dt.Rows[i][3].ToString(); language.Chinese = dt.Rows[i][4].ToString(); LanguageSetting languageSetting = new LanguageSetting(); languageSetting.InsertLanguageSetting(language); // languageClasses.Add(language); string sqlQuerry = "select FunctionGroup,FunctionName,TiengViet,English,Chinese from t_language "; sqlCON sqlcon = new sqlCON(); DataTable dta = new DataTable(); sqlcon.sqlDataAdapterFillDatatable(sqlQuerry, ref dta); dtgv_SettingLanguage.DataSource = null; dtgv_SettingLanguage.DataSource = dta; } // toolSupport.openExcelList("SettingLanguage", txt_SettingFile.Text, ref dt); } } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "Btn_uploadfile_Click(object sender, EventArgs e)", ex.Message); } }