public void TestCheckConnection() { string account = "dungvq"; string password = ""; //Load all setting common.Settings.sysProductOwner = Consts.constProductOwner; common.Settings.sysProductCode = Consts.constProductCode; common.Settings.sysConfigFile = "client.xml"; //common.Settings.myWsConInfos = new common.wsConnectionInfo(); common.wsConnectionInfo ws = new common.wsConnectionInfo(); ws.account = "test"; ws.password = "******"; ws.isWindowAuthentication = true; ws.proxyAddress = "http://127.0.0.1"; ws.proxyPort = "9666"; ws.timeoutInSecs = 120; //ws.URI = "http://210.211.116.4:8080/datalibs.svc"; ws.URI = "http://locahost/datalibs.svc"; ws.useDefaultProxy = true; ws.useProxy = false; DataAccess.Libs.OpenConnection(ws); //if (!DataAccess.Libs.Load_Global_Settings()) // throw new Exception("Webservice configuration failed"); databases.baseDS.investorDataTable investorTbl = DataAccess.Libs.GetInvestor_ByAccount(account); if (investorTbl == null) throw new Exception("investor table cannot be connected"); if (investorTbl.Count == 0) { throw new Exception("Invalid login"); } if (investorTbl[0].password.Trim() != password.Trim()) { throw new Exception("Invalid Password"); } if (!commonClass.SysLibs.isSupperAdminLogin(investorTbl[0].account) && investorTbl[0].expireDate < DataAccess.Libs.GetServerDateTime()) { throw new Exception("Account Expired"); } }
public static bool OpenConnection() { //if (common.Settings.myWsConInfos.Length <= 0) return false; if (common.Settings.myWsConInfos.Length <= 0) { common.wsConnectionInfo temp = new common.wsConnectionInfo(); temp.account = "test"; temp.isWindowAuthentication = true; temp.password = "******"; temp.proxyAddress = "http://127.0.0.1"; temp.proxyPort = "9666"; temp.timeoutInSecs = 120; temp.URI = "http://test01.cesti.gov.vn/dataLibs.svc"; temp.useDefaultProxy = true; temp.useDefaultProxy = false; string a = ""; TestConnection(temp,out a); return OpenConnection(temp); } return OpenConnection(common.Settings.myWsConInfos[0]); }