/// <summary> /// 保存数据 /// </summary> protected void btnSave_Click(object sender, EventArgs e) { if (!Utils.Validate.IsPositiveInt(txtDBPort.Text)) { ShowError("端口不规范,端口只能为正整数"); return; } string address = CtrlHelper.GetText(txtDBAddr); DataBaseInfo dataBaseInfo = new DataBaseInfo(); if (IntParam > 0) { if (!AuthUserOperationPermission(Permission.Edit)) { return; } dataBaseInfo = FacadeManage.aidePlatformFacade.GetDataBaseInfo(IntParam); } else { if (!AuthUserOperationPermission(Permission.Add)) { return; } DataBaseInfo info = FacadeManage.aidePlatformFacade.GetDataBaseInfo(address); if (info != null) { ShowError("地址已经存在"); return; } } dataBaseInfo.DBAddr = address; dataBaseInfo.DBPort = CtrlHelper.GetInt(txtDBPort, 0); dataBaseInfo.DBUser = CWHEncryptNet.XorEncrypt(CtrlHelper.GetText(txtDBUser)); if (CtrlHelper.GetText(hdfDBPassword) == "********") { dataBaseInfo.DBPassword = CWHEncryptNet.XorEncrypt(CtrlHelper.GetText(txtDBPassword)); } else { dataBaseInfo.DBPassword = CtrlHelper.GetText(hdfDBPassword); } dataBaseInfo.MachineID = CtrlHelper.GetText(txtMachineID); dataBaseInfo.Information = CtrlHelper.GetText(txtInformation); int result = IntParam > 0 ? FacadeManage.aidePlatformFacade.UpdateDataBase(dataBaseInfo) : FacadeManage.aidePlatformFacade.InsertDataBase(dataBaseInfo); if (result > 0) { ShowInfo("机器信息操作成功", "DataBaseInfoList.aspx", 1200); } else { ShowError("机器信息失败成功"); } }
/// <summary> /// 获取加密后的用户标识 /// </summary> /// <param name="userID"></param> /// <returns></returns> public static string GetStrUserID(int userID) { return(CWHEncryptNet.XorEncrypt(userID.ToString())); }
private void ProcessData() { if (!Utils.Validate.IsPositiveInt(txtDBPort.Text)) { ShowError("端口不规范,端口只能为正整数"); return; } DataBaseInfo dataBaseInfo = new DataBaseInfo(); dataBaseInfo.DBAddr = CtrlHelper.GetText(txtDBAddr); dataBaseInfo.DBPort = CtrlHelper.GetInt(txtDBPort, 0); dataBaseInfo.DBUser = CWHEncryptNet.XorEncrypt(CtrlHelper.GetText(txtDBUser)); if (CtrlHelper.GetText(hdfDBPassword) == "********") { dataBaseInfo.DBPassword = CWHEncryptNet.XorEncrypt(CtrlHelper.GetText(txtDBPassword)); } else { dataBaseInfo.DBPassword = CtrlHelper.GetText(hdfDBPassword); } dataBaseInfo.MachineID = CtrlHelper.GetText(txtMachineID); dataBaseInfo.Information = CtrlHelper.GetText(txtInformation); Message msg = new Message(); if (StrCmd == "add") { //判断权限 AuthUserOperationPermission(Permission.Add); if (FacadeManage.aidePlatformFacade.IsExistsDBAddr(dataBaseInfo.DBAddr)) { ShowError("地址已经存在"); return; } msg = FacadeManage.aidePlatformFacade.InsertDataBase(dataBaseInfo); } else { //判断权限 AuthUserOperationPermission(Permission.Edit); dataBaseInfo.DBInfoID = IntParam; msg = FacadeManage.aidePlatformFacade.UpdateDataBase(dataBaseInfo); } if (msg.Success) { if (StrCmd == "add") { ShowInfo("机器信息增加成功", "DataBaseInfoList.aspx", 1200); } else { ShowInfo("机器信息修改成功", "DataBaseInfoList.aspx", 1200); } } else { ShowError(msg.Content); } }