public void UpdateRoutesData(User user) { if (user.AuthSuccess == true) { System.Data.DataTable tempTable = DatabaseWork.ExecuteQuery("SELECT * FROM Routes ORDER BY [Route status] DESC, [Departure date] DESC, [Name]"); List <ClassResource.Route> tempList = new List <ClassResource.Route>(); for (int i = 0; i < tempTable.Rows.Count; ++i) { tempList.Add(new ClassResource.Route( tempTable.Rows[i]["ID route"].ToString(), tempTable.Rows[i]["Name"].ToString(), tempTable.Rows[i]["Departure date"].ToString(), tempTable.Rows[i]["Car type"].ToString(), tempTable.Rows[i]["Return date"].ToString(), tempTable.Rows[i]["Route status"].ToString(), tempTable.Rows[i]["City / Country departure"].ToString(), tempTable.Rows[i]["Note"].ToString(), tempTable.Rows[i]["ID forwarder"].ToString())); } user.SendMessage("UpdateRoutesData", new String[] { JsonConvert.SerializeObject(tempList) }); } else { Functions.AddJournalEntry($": __ATTENTION__ {user.UserID} {user.UserName} Попытка доступа без соответствующих прав."); } }
public void UpdateRequestsData(User user) { if (user.AuthSuccess == true) { System.Data.DataTable tempTable = DatabaseWork.ExecuteQuery("SELECT * FROM Requests ORDER BY Date DESC"); List <ClassResource.Request> tempList = new List <ClassResource.Request>(); for (int i = 0; i < tempTable.Rows.Count; ++i) { tempList.Add(new ClassResource.Request( tempTable.Rows[i]["ID request"].ToString(), tempTable.Rows[i]["Number"].ToString(), tempTable.Rows[i]["Product name"].ToString(), tempTable.Rows[i]["Product weight"].ToString(), tempTable.Rows[i]["Product dimensions"].ToString(), tempTable.Rows[i]["Quantity"].ToString(), tempTable.Rows[i]["ID company"].ToString(), tempTable.Rows[i]["ID engineer"].ToString(), tempTable.Rows[i]["Note"].ToString(), tempTable.Rows[i]["Date"].ToString())); } user.SendMessage("UpdateRequestsData", new String[] { JsonConvert.SerializeObject(tempList) }); } else { Functions.AddJournalEntry($": __ATTENTION__ {user.UserID} {user.UserName} Попытка доступа без соответствующих прав."); } }
public void UpdateCompaniesData(User user) { if (user.AuthSuccess == true) { System.Data.DataTable tempTable = DatabaseWork.ExecuteQuery("SELECT * FROM Companies ORDER BY Name"); List <ClassResource.Company> tempList = new List <ClassResource.Company>(); for (int i = 0; i < tempTable.Rows.Count; ++i) { tempList.Add(new ClassResource.Company( tempTable.Rows[i]["ID company"].ToString(), tempTable.Rows[i]["Name"].ToString(), tempTable.Rows[i]["Country"].ToString(), tempTable.Rows[i]["City"].ToString(), tempTable.Rows[i]["Address"].ToString(), tempTable.Rows[i]["Name contact person"].ToString(), tempTable.Rows[i]["Phone contact person"].ToString())); } user.SendMessage("UpdateCompaniesData", new String[] { JsonConvert.SerializeObject(tempList) }); } else { Functions.AddJournalEntry($": __ATTENTION__ {user.UserID} {user.UserName} Попытка доступа без соответствующих прав."); } }
public void RequestDistribute(String requesID, String routeID, User user) { if (user.AuthSuccess == true && (user.UserRole == "Руководитель экспедиторов" || user.UserRole == "Администратор")) { DatabaseWork.ExecuteUpdate("INSERT INTO [Destinations] ([ID route], [ID request], [Number]) VALUES (" + "'" + routeID + "'," + "'" + requesID + "'," + "'" + (DatabaseWork.ExecuteQuery("SELECT * FROM [Destinations] WHERE [ID route] = '" + routeID + "'").Rows.Count + 1).ToString() + "')"); Server.UpdateDestinations(); Server.UpdateRoutes(); } else { Functions.AddJournalEntry($": __ATTENTION__ {user.UserID} {user.UserName} Попытка доступа без соответствующих прав."); } }
public void AuthenticationAttempt(String login, String password, User user) { System.Data.DataTable tempTable = DatabaseWork.ExecuteQuery("SELECT * FROM [Users] WHERE Login = '******' AND Password = '******'"); if (DatabaseWork.ExecuteQuery("SELECT * FROM [Users] WHERE Login = '******' AND Password = '******'").Rows.Count > 0) { user.SendMessage("AuthenticationAttempt", new String[] { "Yes" }); user.SendMessage("AccountData", new String[] { login, tempTable.Rows[0]["FIO User"].ToString(), tempTable.Rows[0]["Role"].ToString(), tempTable.Rows[0]["Snapping"].ToString() }); user.Authentication(tempTable.Rows[0]["Login"].ToString(), tempTable.Rows[0]["FIO User"].ToString(), tempTable.Rows[0]["Role"].ToString(), tempTable.Rows[0]["Snapping"].ToString()); Functions.AddJournalEntry($": {user.UserID} {user.UserName} Авторизация. Роль: {tempTable.Rows[0]["Role"].ToString()}."); } else { user.SendMessage("AuthenticationAttempt", new String[] { "No" }); Functions.AddJournalEntry($": {user.UserID} Неудачная попытка авторизации."); } }
public void UpdateDestinationsData(User user) { if (user.AuthSuccess == true) { System.Data.DataTable tempTable = DatabaseWork.ExecuteQuery("SELECT * FROM [Destinations]"); List <ClassResource.Destination> tempList = new List <ClassResource.Destination>(); for (int i = 0; i < tempTable.Rows.Count; ++i) { tempList.Add(new ClassResource.Destination( tempTable.Rows[i]["ID destination"].ToString(), tempTable.Rows[i]["Arrival date"].ToString(), tempTable.Rows[i]["Note"].ToString(), tempTable.Rows[i]["ID route"].ToString(), tempTable.Rows[i]["ID request"].ToString(), tempTable.Rows[i]["Number"].ToString())); } user.SendMessage("UpdateDestinationsData", new String[] { JsonConvert.SerializeObject(tempList) }); } else { Functions.AddJournalEntry($": __ATTENTION__ {user.UserID} {user.UserName} Попытка доступа без соответствующих прав."); } }