public bool SynTerminal(string customerID, int typeID, string terminalInfo) { this.log(LogLevel.DEBUG, FunctionName.WS_SYS_TERMINAL, MessageType.PARAMATER, "customerID: " + customerID); this.log(LogLevel.DEBUG, FunctionName.WS_SYS_TERMINAL, MessageType.PARAMATER, "typeID: " + typeID.ToString()); this.log(LogLevel.DEBUG, FunctionName.WS_SYS_TERMINAL, MessageType.PARAMATER, "terminalInfo: " + terminalInfo); //验证参数 bool ret = ArgumentHelper.Validate("customerID", customerID, false); if (!ret) { this.log(LogLevel.ERROR, FunctionName.WS_SYS_TERMINAL, "customerID", "参数不正确"); this.log(LogLevel.INFO, FunctionName.WS_SYS_TERMINAL, MessageType.RESULT, ret.ToString()); return(ret); } CustomerConnectInfo cConnect = this.GetCustomerService().GetCustomerConnectByID(customerID); if (cConnect == null) { this.log(LogLevel.ERROR, FunctionName.WS_SYS_TERMINAL, "CustomerConnect", "未找到"); this.log(LogLevel.INFO, FunctionName.WS_SYS_TERMINAL, MessageType.RESULT, "false"); return(false); } if (typeID < 1 || typeID > 2) { this.log(LogLevel.ERROR, FunctionName.WS_SYS_TERMINAL, "typeID", "参数不正确"); this.log(LogLevel.INFO, FunctionName.WS_SYS_TERMINAL, MessageType.RESULT, "false"); return(false); } //解密 cPos.Admin.Service.BaseService base_service = this.GetCustomerService() as cPos.Admin.Service.BaseService; string s = base_service.DecryptStringByCustomer(customerID, terminalInfo); this.log(LogLevel.DEBUG, FunctionName.WS_SYS_TERMINAL, "DecryptCustomerTerminal", s); CustomerTerminalInfo terminal = (CustomerTerminalInfo)XMLGenerator.Deserialize(typeof(CustomerTerminalInfo), s); terminal.Customer.ID = customerID; switch (typeID) { case 1: //新建 ret = this.GetCustomerService().InsertCustomerTerminalFromCP(terminal); break; case 2: //修改 ret = this.GetCustomerService().ModifyCustomerTerminalFromCP(terminal); break; default: ret = false; break; } this.log(LogLevel.INFO, FunctionName.WS_SYS_TERMINAL, MessageType.RESULT, ret.ToString()); return(ret); }
public bool SynUser(string customerID, int typeID, string userInfo) { this.log(LogLevel.DEBUG, FunctionName.WS_SYN_USER, MessageType.PARAMATER, "customerID: " + customerID); this.log(LogLevel.DEBUG, FunctionName.WS_SYN_USER, MessageType.PARAMATER, "typeID: " + typeID.ToString()); this.log(LogLevel.DEBUG, FunctionName.WS_SYN_USER, MessageType.PARAMATER, "userInfo: " + userInfo); //验证参数 bool ret = ArgumentHelper.Validate("customerID", customerID, false); if (!ret) { this.log(LogLevel.ERROR, FunctionName.WS_SYN_USER, "customerID", "参数不正确"); this.log(LogLevel.INFO, FunctionName.WS_SYN_USER, MessageType.RESULT, ret.ToString()); return(ret); } //获取连接 CustomerConnectInfo cConnect = this.GetCustomerService().GetCustomerConnectByID(customerID); if (cConnect == null) { this.log(LogLevel.ERROR, FunctionName.WS_SYN_USER, "CustomerConnect", "未找到"); this.log(LogLevel.INFO, FunctionName.WS_SYN_USER, MessageType.RESULT, "false"); return(false); } if (typeID < 1 || typeID > 5) { this.log(LogLevel.ERROR, FunctionName.WS_SYN_USER, "typeID", "参数不正确"); this.log(LogLevel.INFO, FunctionName.WS_SYN_USER, MessageType.RESULT, "false"); return(false); } //解密 cPos.Admin.Service.BaseService base_service = this.GetCustomerService() as cPos.Admin.Service.BaseService; string s = base_service.DecryptStringByCustomer(customerID, userInfo); this.log(LogLevel.DEBUG, FunctionName.WS_SYN_USER, "DecryptCustomerUser", s); CustomerUserInfo user = (CustomerUserInfo)XMLGenerator.Deserialize(typeof(CustomerUserInfo), s); user.Customer.ID = customerID; switch (typeID) { case 1: //新建 ret = this.GetCustomerService().InsertCustomerUserFromCP(user); break; case 2: //修改 ret = this.GetCustomerService().ModifyCustomerUserFromCP(user); break; case 3: //启用 ret = this.GetCustomerService().EnableCustomerUserFromCP(user); break; case 4: //停用 ret = this.GetCustomerService().DisableCustomerUserFromCP(user); break; case 5: //修改密码 ret = this.GetCustomerService().ModifyCustomerUserPasswordFromCP(user); break; default: ret = false; break; } this.log(LogLevel.INFO, FunctionName.WS_SYN_USER, MessageType.RESULT, ret.ToString()); return(ret); }