protected void TestConnect(string strcn, string Code) { var sys_configconnection = new SYS_ConfigConnection(); var isys_configconnection = new SYS_ConfigConnectionServer(); sys_configconnection.connection = strcn; var sysModunService = new SYS_ModunService(); List <SYS_Modun> sysModun = sysModunService.SelectAllSYS_Modun(); for (int i = 0; i < sysModun.Count; i++) { if (Code.Trim() == sysModun[i].Code.Trim()) { throw new Exception(GetLocalResourceObject("strErrMesageCode").ToString()); } } try { if (isys_configconnection.TestConnectSYS_ConfigConnection(sys_configconnection, "KoMH")) { Session["ConnectString"] = sys_configconnection.connection; } else { throw new Exception(GetLocalResourceObject("strErrMesage").ToString()); } } catch (Exception) { throw new Exception(GetLocalResourceObject("strErrMesage").ToString()); } }
public bool TestConnectSYS_ConfigConnection(SYS_ConfigConnection stringconnect, string mahoa) { SqlConnection sqlCn = null; if (mahoa == "MH") { sqlCn = new SqlConnection(DecryptSYS_ConfigConnection(stringconnect.connection)); } else { sqlCn = new SqlConnection(stringconnect.connection); } bool result = false; try { sqlCn.Open(); result = true; } catch (Exception) { return(result); } finally { sqlCn.Close(); } return(result); }
protected void TestConnect(string strcn, string Code) { var sys_configconnection = new SYS_ConfigConnection(); var isys_configconnection = new SYS_ConfigConnectionServer(); sys_configconnection.connection = strcn; var sysModunService = new DM_MODULEService(); List <DM_MODULE> sysModun = sysModunService.SelectAllDM_MODULE(); for (int i = 0; i < sysModun.Count; i++) { if (Code.Trim() == sysModun[i].Code.Trim()) { throw new Exception("Mã không được trùng."); } } try { if (isys_configconnection.TestConnectSYS_ConfigConnection(sys_configconnection, "KoMH")) { Session["ConnectString"] = sys_configconnection.connection; } else { throw new Exception("Không kết nối được đến Server này."); } } catch (Exception) { throw new Exception("Không kết nối được đến Server này."); } }
public void InsertSYS_ConfigConnection(SYS_ConfigConnection sys_configconnection) { Common.SetSectionValue("appSettings", "ConnectionInfo", sys_configconnection.connection); }
public void InsertSYS_ConfigConnection(SYS_ConfigConnection sys_configconnection) { _sys_configconnectdataaccess.InsertSYS_ConfigConnection(sys_configconnection); }
public Boolean TestConnectSYS_ConfigConnection(SYS_ConfigConnection sys_configconnection, string mahoa) { return(_sys_configconnectdataaccess.TestConnectSYS_ConfigConnection(sys_configconnection, mahoa)); }