private StandardResultModel upDateRequest(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); List<PackageInfoModel> packageList = null; packageList = dataBase.CheckSoftwareClient(request.Client); result.successful = true; if (packageList.Count == 0) { result.type = ResultType.defaultInfo; } else { result.type = ResultType.sendPackage; } result.result = packageList; return result; }
private void loginClient(StandardRequestModel request) { ClientInfoModel client = request.Client; ClientInfoModel newClient = null; GroupInfoModel newGroup = null; LocalDB oDB = new LocalDB(); newClient = oDB.gbAddClient(client); newGroup = oDB.Converter.GetGroupByClient(newClient); string[] lines = Regex.Split(client.macAddress, "\r\n"); string macAddress = ""; foreach (string line in lines) { macAddress += line; } if (newGroup == null) { Console.WriteLine("Anmeldung Client:" + macAddress + " " + " Gruppe:" + client.group + " " + " Admin:" + client.admin + "\n" + "Request:" + request.request); } else { Console.WriteLine("Anmeldung Client:" + macAddress + " " + " Gruppe:" + newGroup.Name + " " + " Admin:" + client.admin + "\n" + "Request:" + request.request); } }
private StandardResultModel sendSoftwarePackage(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); //List<ClientInfoModel> clientList = null; ClientInfoModel client = null; LocalDB dataBase = new LocalDB(); //clientList = dataBase.Converter.GetClientInfoModels(); //if (client == null) //{ result.message = ""; result.successful = true; result.type = ResultType.readPackage; result.result = client; return result; //} //for (int i = 0; i < clientList.Count; i++) //{ // if (request.Client.macAddress == clientList[i].macAddress) // { // client = clientList[i]; // } //} //result.message = ""; //result.successful = true; //result.type = ResultType.readPackage; //result.result = client; //return result; }
private StandardResultModel getGrupePackages(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); GroupInfoModel groupResult = null; List<PackageInfoModel> packageList = null; groupResult = JsonConvert.DeserializeObject<GroupInfoModel>(request.requestData.ToString()); packageList = dataBase.Converter.GetGroupPackages(groupResult); result.message = ""; result.result = packageList; result.successful = true; result.type = ResultType.GrupePackages; return result; }
private StandardResultModel getResult(StandardRequestModel request) { StandardResultModel result = null; switch (request.request) { case RequestTyp.upDateRequest: result = upDateRequest(request); break; case RequestTyp.getDatabaseGroups: result = getDatabaseGroups(request); break; case RequestTyp.getDatabaseClients: result = getDatabaseClients(request); break; case RequestTyp.getDatabaseSoftwarePackages: result = getDatabaseSoftwarePackages(request); break; case RequestTyp.getGroupClients: result = getGroupClients(request); break; case RequestTyp.getGrupePackages: result = getGrupePackages(request); break; case RequestTyp.getClientPackages: result = getClientPackages(request); break; case RequestTyp.addDatabaseClient: result = addDatabaseClient(request); break; case RequestTyp.addDatabaseGroup: result = addDatabaseGroup(request); break; case RequestTyp.addDatabaseSoftwarePackage: result = addDatabaseSoftwarePackage(request); break; case RequestTyp.delDatabaeClient: result = delDatabaeClient(request); break; case RequestTyp.delDatabaseGroup: result = delDatabaseGroup(request); break; case RequestTyp.delDatabaseSoftwarePackage: result = delDatabaseSoftwarePackage(request); break; case RequestTyp.sendSoftwarePackage: result = sendSoftwarePackage(request); break; default: break; } return result; }
private StandardResultModel getDatabaseGroups(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); List<GroupInfoModel> groupList = null; groupList = dataBase.Converter.GetGroupInfoModels(); result.message = ""; result.result = groupList; result.successful = true; result.type = ResultType.GroupInfo; return result; }
private StandardResultModel getDatabaseSoftwarePackages(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); List<PackageInfoModel> packageList = null; packageList = dataBase.Converter.GetPackageInfoModels(); result.message = ""; result.result = packageList; result.successful = true; result.type = ResultType.SoftwarePackagesInfo; return result; }
private StandardResultModel getDatabaseClients(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); List<ClientInfoModel> clientList = null; clientList = dataBase.Converter.GetClientInfoModels(); result.message = ""; result.result = clientList; result.successful = true; result.type = ResultType.ClientInfo; return result; }
private StandardResultModel delDatabaseSoftwarePackage(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); PackageInfoModel packageResult = null; GroupInfoModel group = null; LocalDB dataBase = new LocalDB(); packageResult = JsonConvert.DeserializeObject<PackageInfoModel>(request.requestData.ToString()); group = dataBase.Converter.GetGroupByPackage(packageResult); result.successful = dataBase.gbDeletePackage(packageResult); fileController.delSoftwarePackage(fileController.getPathFromFile(group.Name, packageResult.Name)); result.message = ""; result.result = packageResult; result.type = ResultType.delDatabaseSoftwarePackage; return result; }
private StandardResultModel delDatabaseGroup(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); GroupInfoModel groupResult = null; groupResult = JsonConvert.DeserializeObject<GroupInfoModel>(request.requestData.ToString()); result.successful = dataBase.gbDeleteGroup(groupResult); fileController.delGroupOrder(groupResult.Name); result.message = ""; result.result = groupResult; result.type = ResultType.delDatabaseGroup; return result; }
private StandardResultModel delDatabaeClient(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); ClientInfoModel clientResult = null; clientResult = JsonConvert.DeserializeObject<ClientInfoModel>(request.requestData.ToString()); result.successful = dataBase.gbDeleteClient(clientResult); result.message = ""; result.result = clientResult; result.type = ResultType.delDatabaeClient; return result; }
private StandardResultModel addDatabaseSoftwarePackage(StandardRequestModel request) { StandardResultModel result = new StandardResultModel(); PackageInfoModel package = null; PackageInfoModel packageResult = null; packageResult = JsonConvert.DeserializeObject<PackageInfoModel>(request.requestData.ToString()); package = dataBase.gbAddPackage(packageResult); result.message = ""; result.result = package; result.successful = true; result.type = ResultType.addPackage; return result; }