public static void SetConnectionString(string CompanyName) { try { var res = ConnectionList.Where(x => x.COMPANYNAME == CompanyName).DefaultIfEmpty(ConnectionList.First()).First(); _SaUser = res.USER; _SaPassword = res.PASSWORD; _SERVER = res.SERVER; _DATABASE = res.DATABASE; _TERMINAL = res.TERMINAL; _DIVISION = res.DIVISION; _WAREHOUSE = res.WAREHOUSE; PRINTER = res.PRINTER; DOBACKUP = res.DOBACKUP; DODBUPDATE = res.DODBUPDATE; var ver = res.VERSION; if (ver != null) { if (ver == "New") { _SaPassword = HexadecimalEncoding.FromHexString(res.PASSWORD); } } _connectionstring = _CS = GetConnectionString(); } catch (Exception ex) { //IMSErrorHandler.OnErrorCaught(new ImsExceptionArgs("SetConnectionString", ex.Message, ex)); } }
private static void JsonWrite() { try { string P = HexadecimalEncoding.ToHexString(Encrypt("tebahal")); JObject jobjFile = new JObject(); jobjFile.Add("USER", "sa"); jobjFile.Add("PASSWORD", P); jobjFile.Add("DATABASE", "CHYAPASA"); jobjFile.Add("SERVER", "IMS007-PC\\TEBAHAL"); jobjFile.Add("TERMINAL", "BBB"); jobjFile.Add("DIVISION", "MMX"); jobjFile.Add("WAREHOUSE", "MAIN STORE"); jobjFile.Add("PRINTER", ""); System.IO.File.WriteAllText(AppDataPath + conDllName, jobjFile.ToString()); } catch (Exception ex) { } }