public void CreateListLoadGroup() { foreach (LoadGroup loadGroup in listLoadGroup) { User user = new User(); user.LastName = loadGroup.name; user.Id = loadGroup.id; UserGroupRedmine userGroupRedmine = new UserGroupRedmine(loadGroup.name, loadGroup.id); LoadUser loadUserGroup = new LoadUser(redmineData, user); loadUserGroup.listGroup.Add(userGroupRedmine); loadGroup.listLoadUser.Insert(0, loadUserGroup); } foreach (LoadGroup loadGroup in listLoadGroup) { int countWorkUser = loadGroup.CountUser; double maxYearHumansHours = countWorkUser * 12; double maxMonthHumansHours = countWorkUser; foreach (LoadUser loadUser in loadGroup.listLoadUser) { foreach (int year in listYear) { if (loadUser.listLoadYWH.Count < listYear.Count) { loadUser.AddYear(maxYearHumansHours, maxMonthHumansHours, year, redmineData.listProject, loadGroup.listLoadUser); } } } } }
void LoginOnApp(object param) { var passwordBox = param as PasswordBox; if (passwordBox == null) { return; } var password = passwordBox.Password; if (password == null || password == "" || Login == "" || Login == null) { ErrorMessage = "*Для входа необходимо указать логин и пароль"; return; } UResult result = (UResult)loginRegister.CheckUserOnDB(Login, password); if (result == UResult.Access) { LoadUser?.Invoke(); _openFilmFinder(); } else if (result == UResult.PasswordFailed) { ErrorMessage = "*Неправильный пароль"; } else if (result == UResult.UserFailed) { ErrorMessage = "*Такого пользователя нет"; } }
public IssueDayForm(LoadUser loadUser, Manager manager, TypeView typeView, TypeView typeViewSelect, string tracker) { InitializeComponent(); this.IDLoadUser = loadUser.user.Id; this.tracker = tracker; this.manager = manager; this.typeView = typeView; this.typeViewSelect = typeViewSelect; MakeCaptionColumnsDWH(); ShowLoad_TimeDWH(); }
// GET: LoggedIn public ActionResult Index() { using (var _context = new ApplicationDbContext()) { // load in current userId string userId = User.Identity.GetUserId(); // Load in customer ApplicationUser currentUser = LoadUser.GetCurrentUser(_context, userId); return(View(currentUser)); } }
public LoadYWH FindLoadYWH(int numberYear, User user) { LoadYWH loadYWH = null; LoadUser loadUser = null; loadUser = listLoadUser.Find(x => x.user.Id == user.Id); if (loadUser != null) { loadYWH = loadUser.listLoadYWH.Find(x => x.NumberYear == numberYear); } return(loadYWH); }
private void ShowIssueDayForm(LoadUser loadUser, TypeView typeView) { string text = "Просроченные задачи специалиста "; //if (typeView == TypeView.LoadIssueDWH) // text = "Запланировано на "; //if (typeView == TypeView.LoadTimeDWH) // text = "Факт на "; issueMonthForm = new IssueDayForm(loadUser, manager, typeView, typeViewSelect, ""); manager.Update += issueMonthForm.UpdateIssueInfo; //DateTime dateText = new DateTime(year, month, 1); issueMonthForm.Text = text + loadUser.user.LastName + " " + loadUser.user.FirstName; issueMonthForm.Show(); }
void menuState_Enter(object sender, StateEventArgs e) { _screen.Children.Add(new ControlPanel(_emoEngine)); Window newWindow = null; string[] profileNames = _emoEngine.GetProfileNames(); if (profileNames.Length == 0) { newWindow = new CreateUser(_emoEngine); } else { newWindow = new LoadUser(_emoEngine); } _screen.Children.Add(newWindow); }
public void MakeEmailMessages(List <LoadIssue> listLoadOpenIssue, string title) { //listEmailMessage.Clear(); string message; string addrTo; string addrCC; foreach (LoadIssue loadIssue in listLoadOpenIssue) { if (loadIssue.isExperied) { LoadUser loadUser = listLoadUser.Find(x => x.user.Id == loadIssue.issue.AssignedTo.Id); if (loadUser != null) { addrTo = loadUser.user.Email; addrCC = loadIssue.EmailHeadUser; message = "Здравствуйте уважаемый(ая) " + loadUser.user.LastName + " " + loadUser.user.FirstName + "." + "\n"; message += "\n"; message += "У вас есть открытые задания по которым вы являетесь ответственным и по которым есть следующие замечания: " + "\n" + "1. в части задач просрочены сроки выполнения " + " для которых в случае их выполнения необходимо закрыть (поменять статус на - закрыта) или согласовать новую дату завершения;" + "\n" + "2. в части задач необходимо указать актуальные проценты выполнения." + "\n"; message += "\n"; message += loadIssue.Message; EmailMessage emailMessage = listEmailMessage.Find(x => (x.Id == loadUser.user.Id) & (x.Title.Equals(title))); if (emailMessage != null) { emailMessage.Message += loadIssue.Message; } else { emailMessage = new EmailMessage(); emailMessage.ListToEmail.Add(addrTo); emailMessage.ListCCEmail.Add(addrCC); emailMessage.Message = message; emailMessage.Id = loadUser.user.Id; emailMessage.ProjectId = loadIssue.issue.Project.Id; emailMessage.Title = title; listEmailMessage.Add(emailMessage); } } } } }
private void emailSend_Click(object sender, EventArgs e) { if (listLoadMWH.Items.Count > 0) { manager.listEmailMessage.Clear(); if (listLoadMWH.SelectedIndices.Count > 0) { for (int i = 0; i < listLoadMWH.SelectedIndices.Count; i++) { ListViewItem lvi = listLoadMWH.Items[listLoadMWH.SelectedIndices[i]]; if (lvi.Tag is LoadProject) { LoadProject loadProject = (LoadProject)lvi.Tag; string title = "Redmine просроченные задания по проекту " + loadProject.userProject.Name; manager.MakeEmailMessages(loadProject.listLoadOpenIssue, title); ReportForm report = new ReportForm(manager, title, TypeView.ReportEmail); report.Text = title; //foreach (var note in manager.EmailSaveIssue.Journals) //{ // MessageBox.Show(note.Notes); //} report.Show(); } if (lvi.Tag is LoadUser) { LoadUser loadUser = (LoadUser)lvi.Tag; string title = "Redmine просроченные задания специалиста " + loadUser.user.LastName + " " + loadUser.user.FirstName; manager.MakeEmailMessages(loadUser.listLoadOpenIssue, title); ReportForm report = new ReportForm(manager, title, TypeView.ReportEmail); report.Text = title; report.Show(); } } manager.SendEmail(); manager.SaveDateToRedmineEmailIssue(); } } }
private void LoadState() { var initState = new LoadUser { Username = "", Token = "" }; if (Properties.ContainsKey("user")) { var user = Properties["user"]?.ToString(); var token = Properties["token"]?.ToString(); initState = new LoadUser { Username = user, Token = token }; } Store.Dispatch(initState); }
public void teste() { var relationshipReps = new GetRelationshipStatus(); var userSource = new TwitterAPPUser(); var userTarget = new TwitterAPPUser(); var opt = new RepositoryOptions(); var userRep = new LoadUser(); opt.twitterUser.screen_name = "amosbatista"; userSource = userRep.GetUser(opt); opt.twitterUser.screen_name = "oficial_cp"; userTarget = userRep.GetUser(opt); opt.twitterUser = userSource; opt.twitterUser_Target = userTarget; var result = relationshipReps.Get(opt); result.ToString(); }
private void AddLineNameGroup(ref int iLine, int numberYear, int numItem, ListView listOut, LoadYWH loadYWH = null, LoadUser loadUser = null, LoadGroup loadGroup = null, LoadProject loadProject = null) { List <string> listLine = new List <string>(); bool isGroup = false; if (loadGroup != null) { if (loadUser.user.LastName.Equals(loadGroup.name)) { isGroup = true; string[] lineGroup = { numItem.ToString() /*numGroup.ToString()*/, loadUser.user.LastName, "", loadGroup.CountUser.ToString(), "" }; ListViewItem lvi_group = new ListViewItem(lineGroup); lvi_group.Font = new Font(lvi_group.Font, FontStyle.Bold); lvi_group.Tag = loadUser; listOut.Items.Add(lvi_group); iLine++; MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadUser: loadUser); LoadYWH loadYWHcur = loadUser.listLoadYWH.Find(x => x.NumberYear == numberYear); if (loadYWHcur != null) { foreach (string tracker in loadYWHcur.listEstimTracker) { MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadUser: loadUser); } } MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadUser: loadUser); if (loadYWHcur != null) { foreach (string tracker in loadYWHcur.listTimeTracker) { MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadUser: loadUser); } } } } if ((loadUser != null) & (!isGroup) & (loadGroup == null)) { string groupName = ""; if (loadGroup == null) { foreach (UserGroupRedmine group in loadUser.listGroup) { if (groupName == "") { groupName += group.name; } else { groupName += ";" + group.name; } } } string[] lineName = { numItem.ToString() /*numUser.ToString()*/, loadUser.user.LastName + " " + loadUser.user.FirstName, groupName, "", "" }; ListViewItem lvi_name = new ListViewItem(lineName); lvi_name.Font = new Font(lvi_name.Font, FontStyle.Bold); lvi_name.Tag = loadUser; listOut.Items.Add(lvi_name); iLine++; if (typeView != TypeView.LoadExperiedUser) { //вывод на следующей строке данных по факту и плану MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadUser: loadUser); LoadYWH loadYWHcur = loadUser.listLoadYWH.Find(x => x.NumberYear == numberYear); if (loadYWHcur != null) { foreach (string tracker in loadYWHcur.listEstimTracker) { MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadUser: loadUser); } } MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadUser: loadUser); if (loadYWHcur != null) { foreach (string tracker in loadYWHcur.listTimeTracker) { MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadUser: loadUser); } } } } if (loadProject != null) { DateTime startProject = loadProject.StartProject; DateTime finishProject = loadProject.FinishProject; string start, finish; if (startProject.CompareTo(DateTime.MaxValue) == 0) { start = "-"; } else { start = startProject.ToShortDateString(); } if (finishProject.CompareTo(DateTime.MinValue) == 0) { finish = "-"; } else { finish = finishProject.ToShortDateString(); } string[] lineName = { numItem.ToString() /*numUser.ToString()*/, loadProject.userProject.Name, loadProject.userProject.NameHeadUser, start, finish, loadProject.PercentFinance(numberYear).ToString("0") + " %", loadProject.PercentWork(numberYear).ToString("0") + " %", "" }; ListViewItem lvi_name = new ListViewItem(lineName); lvi_name.Font = new Font(lvi_name.Font, FontStyle.Bold); lvi_name.Tag = loadProject; listOut.Items.Add(lvi_name); iLine++; MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadProject: loadProject); LoadYWH loadYWHcur = loadProject.listLoadYWH.Find(x => x.NumberYear == numberYear); if (loadYWHcur != null) { foreach (string tracker in loadYWHcur.listEstimTracker) { MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadProject: loadProject); } } //MakeLineTrackerToListView(ref iLine, numberYear, loadProject); MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadProject: loadProject); if (loadYWHcur != null) { foreach (string tracker in loadYWHcur.listTimeTracker) { MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadProject: loadProject); } } //MakeLineTrackerToListView(ref iLine, numberYear, loadProject); //if (typeView == TypeView.LoadProject) //{ //} if (typeView == TypeView.LoadProjectUser) { foreach (LoadUser lU in loadProject.listLoadUser) { string[] lineNameU = { numItem.ToString() /*numUser.ToString()*/, lU.user.LastName + " " + lU.user.FirstName, lU.GroupName, "", "", "", "", "" }; ListViewItem lvi_nameU = new ListViewItem(lineNameU); lvi_nameU.Font = new Font(lvi_nameU.Font, FontStyle.Bold); lvi_nameU.Tag = lU; listOut.Items.Add(lvi_nameU); iLine++; MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadUser: lU); loadYWHcur = lU.listLoadYWH.Find(x => x.NumberYear == numberYear); if (loadYWHcur != null) { foreach (string tracker in loadYWHcur.listEstimTracker) { MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadUser: lU); } } MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadUser: lU); if (loadYWHcur != null) { foreach (string tracker in loadYWHcur.listTimeTracker) { MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadUser: lU); } } } } } if (loadYWH != null) { string[] lineName = { numItem.ToString(), "Планирование план/факт на " + numberYear.ToString(), "" }; ListViewItem lvi_name = new ListViewItem(lineName); lvi_name.Font = new Font(lvi_name.Font, FontStyle.Bold); listOut.Items.Add(lvi_name); iLine++; MakeLineToListView(ref iLine, numberYear, "план", ref listLine, listOut, loadYWH: loadYWH); if (loadYWH != null) { foreach (string tracker in loadYWH.listEstimTracker) { MakeLineToListView(ref iLine, numberYear, "план " + tracker, ref listLine, listOut, loadYWH: loadYWH); } } MakeLineToListView(ref iLine, numberYear, "факт", ref listLine, listOut, loadYWH: loadYWH); if (loadYWH != null) { foreach (string tracker in loadYWH.listTimeTracker) { MakeLineToListView(ref iLine, numberYear, "факт " + tracker, ref listLine, listOut, loadYWH: loadYWH); } } } }
//private void ShowUser_GroupDWH(int year, int month) //{ // LoadYWH loadYWH; // if (listDescription.Items.Count > 0) // { // for (int i = 0; i < listDescription.SelectedIndices.Count; i++) // { // //MessageBox.Show(((LoadUser)listItems.Items[listItems.SelectedIndices[i]].Tag).user.LastName); // LoadUser loadUser = (LoadUser)listDescription.Items[listDescription.SelectedIndices[i]].Tag; // if (loadUser != null) // { // loadYWH = manager.FindLoadYWH(year, loadUser.listLoadYWH); // if (loadYWH != null) // { // LoadMWH loadMWH = loadYWH.FindLoadMWH(month); // if (loadMWH != null) // { // ShowIssueDayForm(loadMWH, year, month); // } // else // MessageBox.Show(month.ToString() + " месяца не существует!"); // } // } // } // } //} //private void ShowYearDWH(int year, int month) //{ // LoadYWH loadYWH = manager.FindLoadYWH(year, manager.listLoadYWH); // if (loadYWH != null) // { // LoadMWH loadMWH = loadYWH.FindLoadMWH(month); // if (loadMWH != null) // { // ShowIssueDayForm(loadMWH, year, month); // } // else // MessageBox.Show(month.ToString() + " месяца не существует!"); // } //} private void listLoad_ColumnClick(object sender, ColumnClickEventArgs e) { int colIndex; if (typeView == TypeView.LoadExperiedProject | typeView == TypeView.LoadExperiedUser) { colIndex = Convert.ToInt16(e.Column.ToString()); if (listLoadMWH.Items.Count > 0) { if (listLoadMWH.SelectedIndices.Count > 0) { for (int i = 0; i < listLoadMWH.SelectedIndices.Count; i++) { ListViewItem lvi = listLoadMWH.Items[listLoadMWH.SelectedIndices[i]]; if (lvi.Tag is LoadProject) { LoadProject loadProject = (LoadProject)lvi.Tag; ShowIssueDayForm(loadProject, TypeView.LoadShortExpProject); } if (lvi.Tag is LoadUser) { LoadUser loadUser = (LoadUser)lvi.Tag; ShowIssueDayForm(loadUser, TypeView.LoadShortExpUser); } } } } } else { if (comboYear.Items.Count != 0) { colIndex = Convert.ToInt16(e.Column.ToString()); int month = ++colIndex - tabIndex; //MessageBox.Show(colIndex.ToString()); int year = Convert.ToInt16(comboYear.SelectedItem.ToString()); if (listLoadMWH.Items.Count > 0) { if (listLoadMWH.SelectedIndices.Count > 0) { for (int i = 0; i < listLoadMWH.SelectedIndices.Count; i++) { ListViewItem lvi = listLoadMWH.Items[listLoadMWH.SelectedIndices[i]]; if (lvi.Tag is LoadYWH) { LoadYWH loadYWH = (LoadYWH)lvi.Tag; LoadMWH loadMWH = loadYWH.FindLoadMWH(month); if (loadMWH != null) { //loadMWH.GetListLoadProject(); string tracker = listLoadMWH.Items[listLoadMWH.SelectedIndices[i]].SubItems[1].Text; if (tracker.Contains("план")) { //ShowIssueDayForm(loadMWH, year, month, TypeView.LoadShortIssueDWH); //MessageBox.Show("plan"); ShowIssueDayForm(loadMWH, year, month, TypeView.LoadIssueDWH, tracker); } if (tracker.Contains("факт")) { //ShowIssueDayForm(loadMWH, year, month, TypeView.LoadShortTimeDWH); //MessageBox.Show("plan"); ShowIssueDayForm(loadMWH, year, month, TypeView.LoadTimeDWH, tracker); } } //MessageBox.Show("i = " + i.ToString() + "lvi.index = " + lvi.Index.ToString()); } } } } } } }
public void GetUser_GroupFromRedmine() { NameValueCollection parametr; redmineData.listUser.Clear(); listLoadUser.Clear(); listLoadGroup.Clear(); try { parametr = new NameValueCollection { { "user_id", "*" } }; foreach (User user in redmineManager.GetObjects <User>(parametr)) { redmineData.listUser.Add(user); LoadUser loadUser = new LoadUser(redmineData, user); listLoadUser.Add(loadUser); } } catch (Exception ex) { MessageBox.Show("Error - " + ex.Message); } try { parametr = new NameValueCollection { { "group_id", "*" } }; foreach (Group group in redmineManager.GetObjects <Group>(parametr)) { UserGroupRedmine userGroup = new UserGroupRedmine(group.Name, group.Id); LoadGroup loadGroup = new LoadGroup(group.Name, group.Id, redmineData.listIssue); LoadGroup findLoadGroup = listLoadGroup.Find(x => x.id == loadGroup.id); if (findLoadGroup == null) { listLoadGroup.Add(loadGroup); findLoadGroup = loadGroup; } foreach (User user in redmineManager.GetObjects <User>(new NameValueCollection { { "group_id", group.Id.ToString() } })) { LoadUser loadUser = listLoadUser.Find(x => x.user.Id == user.Id); if (loadUser != null) { loadUser.listGroup.Add(userGroup); LoadUser findLoadUser = findLoadGroup.listLoadUser.Find(x => x.user.Id == loadUser.user.Id); if (findLoadUser == null) { findLoadGroup.listLoadUser.Add(loadUser); } } } } } catch (Exception ex) { MessageBox.Show("Error -" + ex.Message); } }
public void GenerateNetWorkStatistics(string twitterName, string deepnessCount) { // Cleaning database var userDB = new UserRepository(); var followerDB = new UserRelationshipRepository(); userDB.EraseAllData(); followerDB.EraseAllData(); // Main list var userListToProcess = new TwitterUserList(); var processedUserList = new TwitterUserList(); // Used in the interaction // Arrays of friends and followers var friendsReps = new FriendsIdList(); var followersReps = new FollowerIdList(); var userLookUp = new UserLookUp(); var followersList = new List<TwitterAPPUser>(); var followersIdList = new UserIdList(); var friendsList = new List<TwitterAPPUser>(); var friendsIdList = new UserIdList(); var opt = new RepositoryOptions(); var newFollowersUser = new TwitterAPPUser(); var newFriendUser = new TwitterAPPUser(); // Setting the user for the first time opt.twitterUser.screen_name = twitterName; // Loading me as the first user var twitterUserRep = new LoadUser(); var firstUser = twitterUserRep.GetUser(opt); // Setting the first array userListToProcess.users.Add(firstUser); opt.twitterUser.screen_name = ""; // Main loop for (int processorCount = 0; processorCount < Int16.Parse(deepnessCount); processorCount++) { foreach (TwitterAPPUser user in userListToProcess.users) { // Setting the user for the first time opt.twitterUser.id_str = user.id_str; // Verify if the user is the same of the first if (user.id_str == firstUser.id_str && userListToProcess.users.Count > 1) continue; // Getting the friends and followers list followersIdList = followersReps.GetFollowers(opt); opt.userList.ids = followersIdList.ids; //followersList = userLookUp.GetUserCompleteList(opt); friendsIdList = friendsReps.GetFriends(opt); opt.userList.ids = friendsIdList.ids; //friendsList = userLookUp.GetUserCompleteList(opt); foreach (decimal followerUserId in followersIdList.ids ) { newFollowersUser = new TwitterAPPUser(); newFollowersUser.id_str = followerUserId.ToString(); newFollowersUser.screen_name = ""; // Saving the the twitters users //if (userDB.LoadUser(newFollowersUser.id_str) == null) userDB.SaveNewUser(newFollowersUser); followerDB.SaveUserFollower(user, newFollowersUser); // Appending these users to the result processedUserList.users.Add(newFollowersUser); } foreach (decimal friendUserId in friendsIdList.ids) { newFriendUser = new TwitterAPPUser(); newFriendUser.id_str = friendUserId.ToString(); newFriendUser.screen_name = ""; // Saving the the twitters users //if (userDB.LoadUser(newFriendUser.id_str) == null) userDB.SaveNewUser(newFriendUser); followerDB.SaveUserFollower(newFriendUser, user); // Appending these users to the result processedUserList.users.Add(newFriendUser); } processedUserList.users.AddRange(friendsList); } // Setting the result to the main list userListToProcess.users.Clear(); userListToProcess.users.AddRange(processedUserList.users); processedUserList.users.Clear(); } }
public void GenerateNetWorkStatistics(NetWorkStatisticsProperties searchProp) { // Cleaning database var userDB = new UserRepository(); var followerDB = new UserRelationshipRepository(); // Main list var processedUserList = new TwitterUserList(); // Used in the interaction // Arrays of friends and followers var friendsReps = new FriendsIdList(); var followersReps = new FollowerIdList(); var userLookUp = new UserLookUp(); var relationshipReps = new GetRelationshipStatus(); var followersList = new List<TwitterAPPUser>(); var followersIdList = new UserIdList(); var friendsList = new List<TwitterAPPUser>(); var friendsIdList = new UserIdList(); var opt = new RepositoryOptions(); var newFollowersUser = new TwitterAPPUser(); var newFriendUser = new TwitterAPPUser(); var newUserToSave = new TwitterAPPUser(); // Lists of FR and FF from each user var actualUserFriendIdList = new UserIdList(); var actualUserFollowerIdList = new UserIdList(); var idListToProcess = new UserIdList(); var userListToProcess = new List<TwitterAPPUser>(); var relationshipStatus = new RelationshipStatus_FinalResult(); // Determine the kind of process if (searchProp.generateNewStatistic == true) { userDB.EraseAllData(); followerDB.EraseAllData(); // Setting the user for the first time opt.twitterUser.screen_name = searchProp.twitterName; // Loading me as the first user var twitterUserRep = new LoadUser(); var mainUser = twitterUserRep.GetUser(opt); // Save the user userDB.SaveNewUser(mainUser); userDB.SetUserAsProcessed(mainUser); // To impeding the first user to be processed again // Generation of FR (friends) and FF (followers) list opt.twitterUser.id_str = mainUser.id_str; // Getting the friends and followers list followersIdList = followersReps.GetFollowers(opt); friendsIdList = friendsReps.GetFriends(opt); opt.userList = followersIdList; followersList = userLookUp.GetUserCompleteList(opt); opt.userList = friendsIdList; friendsList = userLookUp.GetUserCompleteList(opt); // Reading all followers list foreach (TwitterAPPUser user in followersList) { // Save the current user userDB.SaveNewUser(user); // Save the relationship followerDB.SaveUserFollower(mainUser, user); } // Reading all friends list foreach (TwitterAPPUser user in friendsList) { // Save the current user userDB.SaveNewUser(user); // Save the relationship followerDB.SaveUserFollower(user, mainUser); } // Combinning the 2 list userListToProcess.AddRange(friendsList); userListToProcess.AddRange(followersList); } else { // Load the list of the users userListToProcess = userDB.LoadUnprocessedUsers(); } // Reading all this list, to get each contacts foreach (TwitterAPPUser userSource in userListToProcess) { foreach (TwitterAPPUser userTarget in userListToProcess) { opt.twitterUser = userSource; opt.twitterUser_Target = userTarget; relationshipStatus = relationshipReps.Get(opt); // Saving the user relationship, by the result response if (relationshipStatus.relationship.target.following == true) followerDB.SaveUserFollower(userSource, userTarget); if (relationshipStatus.relationship.target.followed_by == true) followerDB.SaveUserFollower(userTarget, userSource); } // After all, indicate the user was processed userDB.SetUserAsProcessed(userSource); } }
private void MakeLineToListView(ref int iLine, int numberYear, string value, ref List <string> listLine, ListView listOut, LoadYWH loadYWH = null, LoadUser loadUser = null, LoadProject loadProject = null) { LoadYWH loadYWHcur; int num = 1; if (loadUser != null) { loadYWHcur = manager.FindLoadYWH(numberYear, loadUser.listLoadYWH); } else { if (loadProject != null) { loadYWHcur = manager.FindLoadYWH(numberYear, loadProject.listLoadYWH); } else { loadYWHcur = loadYWH; } } string sl = ""; string perc = ""; if (value.Contains("план")) { sl = loadYWHcur.EstimatedYHumans(value).ToString("0.0") + "/" + loadYWHcur.EstimatedYWH(value).ToString("0.0"); perc = loadYWHcur.EstimatedPercentYHumans(value).ToString("0") + " %"; } else { sl = loadYWHcur.FactYHumans(value).ToString("0.0") + "/" + loadYWHcur.FactYWH(value).ToString("0.0"); perc = loadYWHcur.FactPercentYHumans(value).ToString("0") + " %"; } listLine = new List <string>(); switch (typeView) { case TypeView.LoadGroup: listLine.Add(""); listLine.Add(value); listLine.Add(perc); listLine.Add(""); listLine.Add(sl); break; case TypeView.LoadProject: listLine.Add(""); listLine.Add(value); listLine.Add(""); listLine.Add(""); listLine.Add(""); listLine.Add(""); listLine.Add(""); listLine.Add(sl); break; case TypeView.LoadProjectUser: listLine.Add(""); listLine.Add(value); listLine.Add(""); listLine.Add(""); listLine.Add(""); listLine.Add(""); listLine.Add(""); listLine.Add(sl); break; case TypeView.LoadExperiedProject: listLine.Add(""); listLine.Add(value); listLine.Add(""); listLine.Add(""); listLine.Add(""); listLine.Add(sl); break; case TypeView.LoadUser: listLine.Add(""); listLine.Add(value); listLine.Add(""); listLine.Add(""); listLine.Add(sl); break; case TypeView.LoadExperiedUser: listLine.Add(""); listLine.Add(value); listLine.Add(""); listLine.Add(""); listLine.Add(sl); break; case TypeView.LoadYWH: listLine.Add(""); listLine.Add(value); listLine.Add(perc); listLine.Add(sl); break; } AddLineLoad(loadYWHcur, ref listLine); SetLineToListView(listLine, loadYWHcur, listOut); //string[] lineLoadColor = listLine.Select(i => i.ToString()).ToArray(); List <Color> listColor = new List <Color>(); if (value.Contains("план")) { listColor.Add(loadYWHcur.YearEstimatedColor(value)); foreach (LoadMWH loadMWH in loadYWHcur.listLoadMWH) { listColor.Add(loadMWH.MonthEstimatedColor(value)); } } if (value.Contains("факт")) { listColor.Add(loadYWHcur.YearFactColor(value)); foreach (LoadMWH loadMWH in loadYWHcur.listLoadMWH) { listColor.Add(loadMWH.MonthFactColor(value)); } } SetColorValue(listOut, iLine, listColor); num++; iLine++; //------------------------------------------------// }
private void ShowLoad_TimeDWH() { List <string> list = new List <string>(); listLoadDWH.Items.Clear(); ListViewItem lvi; string[] array; int iLine = 0; if (item is LoadProject) { LoadProject loadProject = manager.listLoadProject.Find(x => x.Id == this.IDitem); if (loadProject != null) { LoadYWH loadYWH = loadProject.listLoadYWH.Find(x => x.NumberYear == this.year); loadMWH = loadYWH.listLoadMWH.Find(x => x.numberMonth == this.month); } } if (item is LoadUser) { LoadUser loadUser_cur = (item as LoadUser); if (loadUser_cur.GroupName.Trim() == loadUser_cur.Name.Trim()) { LoadGroup loadGroup = manager.listLoadGroup.Find(x => x.Name.Equals(loadUser_cur.GroupName)); if (loadGroup != null) { LoadUser loadUser = loadGroup.listLoadUser.Find(x => x.Id == loadUser_cur.Id); if (loadUser != null) { LoadYWH loadYWH = manager.FindLoadYWH(year, loadUser.listLoadYWH); loadMWH = loadYWH.listLoadMWH.Find(x => x.numberMonth == this.month); } } } else { LoadUser loadUser = manager.listLoadUser.Find(x => x.Id == this.IDitem); if (loadUser != null) { LoadYWH loadYWH = loadUser.listLoadYWH.Find(x => x.NumberYear == this.year); loadMWH = loadYWH.listLoadMWH.Find(x => x.numberMonth == this.month); } } } if (item is LoadYWH) { LoadYWH loadYWH = manager.listLoadYWH.Find(x => x.NumberYear == (item as LoadYWH).NumberYear); if (loadYWH != null) { loadMWH = loadYWH.listLoadMWH.Find(x => x.numberMonth == this.month); } } if (loadMWH != null) { loadMWH.GetListLoadProject(this.tracker); loadMWH.listLoadIssue.Sort(); loadMWH.listLoadTimeEntry.Sort(); } switch (typeView) { case TypeView.LoadShortExpUser: LoadUser loadUser = manager.listLoadUser.Find(x => x.user.Id == IDLoadUser); if (loadUser != null) { foreach (LoadIssue loadIssue in loadUser.listLoadOpenIssue) { if (loadIssue.isExperied) { AddLineLoadExperiedIssue(loadIssue); } } } break; case TypeView.LoadShortExpProject: LoadProject loadProject = manager.listLoadProject.Find(x => x.userProject.Id == IDLoadProject); if (loadProject != null) { foreach (LoadIssue loadIssue in loadProject.listLoadOpenIssue) { if (loadIssue.isExperied) { AddLineLoadExperiedIssue(loadIssue); } iLine++; } } break; case TypeView.LoadShortIssueDWH: foreach (LoadProject loadProject_cur in loadMWH.listLoadProject) { list.Clear(); string[] line = { loadProject_cur.userProject.Id.ToString(), loadProject_cur.userProject.Name, loadProject_cur.EstimatedMWH(this.tracker).ToString("0.0") }; foreach (string s in line) { list.Add(s); } array = list.Select(i => i.ToString()).ToArray(); lvi = new ListViewItem(array); listLoadDWH.Items.Add(lvi); SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal); iLine++; } list.Clear(); string[] lineSumShortIssue = { "", "Итого", loadMWH.EstimatedMonthHours(this.tracker).ToString("0.0") }; foreach (string s in lineSumShortIssue) { list.Add(s); } array = list.Select(i => i.ToString()).ToArray(); lvi = new ListViewItem(array); listLoadDWH.Items.Add(lvi); SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal); AutoFitColumn(listLoadDWH); break; case TypeView.LoadShortTimeDWH: foreach (LoadProject loadProject_cur in loadMWH.listLoadProject) { list.Clear(); string[] line = { loadProject_cur.userProject.Id.ToString(), loadProject_cur.userProject.Name, loadProject_cur.FactMWH(this.tracker).ToString("0.0") }; foreach (string s in line) { list.Add(s); } array = list.Select(i => i.ToString()).ToArray(); lvi = new ListViewItem(array); listLoadDWH.Items.Add(lvi); SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal); iLine++; } list.Clear(); string[] lineSumShortTime = { "", "Итого", loadMWH.FactMonthHours(this.tracker).ToString("0.0") }; foreach (string s in lineSumShortTime) { list.Add(s); } array = list.Select(i => i.ToString()).ToArray(); lvi = new ListViewItem(array); listLoadDWH.Items.Add(lvi); SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal); AutoFitColumn(listLoadDWH); break; case TypeView.LoadIssueDWH: foreach (LoadIssue loadIssue in loadMWH.listLoadIssue) { if (this.tracker.Contains(loadIssue.issue.Tracker.Name) || this.tracker.Equals("план")) { User user = manager.redmineData.listUser.Find(x => x.Id == loadIssue.issue.AssignedTo.Id); list.Clear(); string userName = ""; if (user != null) { userName = user.LastName + " " + user.FirstName; } else { userName = loadIssue.issue.AssignedTo.Name; } string[] line = { loadIssue.issue.Id.ToString(), loadIssue.issue.Project.Name, loadIssue.issue.Subject, loadIssue.dateStartIssue.ToShortDateString(), loadIssue.dateFinishIssue.ToShortDateString(), loadIssue.estimatedIssueHours.ToString("0.0"), userName }; foreach (string s in line) { list.Add(s); } foreach (LoadDWH loadDWH in loadIssue.listLoadDWH) { list.Add(loadDWH.hoursDay.ToString("0.0")); } array = list.Select(i => i.ToString()).ToArray(); lvi = new ListViewItem(array); listLoadDWH.Items.Add(lvi); SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal); if (this.typeViewSelect == TypeView.LoadUser) { SetColorValue(listLoadDWH, iLine, array, 8, Color.Red, Operation.More); } iLine++; } } list.Clear(); string[] lineSum = { "", "Итого в день", "", loadMWH.dateStartMonth.ToShortDateString(), loadMWH.dateFinishMonth.ToShortDateString(), loadMWH.EstimatedMonthHours(this.tracker).ToString("0.0"), "" }; foreach (string s in lineSum) { list.Add(s); } foreach (LoadDWH loadDWH in loadMWH.listLoadDWH) { list.Add(loadDWH.hoursDay.ToString("0.0")); } array = list.Select(i => i.ToString()).ToArray(); lvi = new ListViewItem(array); listLoadDWH.Items.Add(lvi); SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal); if (this.typeViewSelect == TypeView.LoadUser) { SetColorValue(listLoadDWH, iLine, array, 8, Color.Red, Operation.More); } AutoFitColumn(listLoadDWH); break; case TypeView.LoadTimeDWH: foreach (LoadTimeEntry loadTime in loadMWH.listLoadTimeEntry) { if (this.tracker.Contains(loadTime.userTime.time.Activity.Name) || this.tracker.Equals("факт")) { User user = manager.redmineData.listUser.Find(x => x.Id == loadTime.userTime.time.User.Id); list.Clear(); string userName = ""; if (user != null) { userName = user.LastName + " " + user.FirstName; } else { userName = loadTime.userTime.nameUser; } string[] line = { loadTime.userTime.time.Id.ToString(), loadTime.userTime.nameProject, loadTime.userTime.subject, loadTime.dateStart.ToShortDateString(), loadTime.dateFinish.ToShortDateString(), loadTime.factMonthHours.ToString("0.0"), userName }; foreach (string s in line) { list.Add(s); } foreach (LoadDWH loadDWH in loadTime.listLoadDWH) { list.Add(loadDWH.factDayHours.ToString("0.0")); } array = list.Select(i => i.ToString()).ToArray(); lvi = new ListViewItem(array); listLoadDWH.Items.Add(lvi); SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal); if (this.typeViewSelect == TypeView.LoadUser) { SetColorValue(listLoadDWH, iLine, array, 8, Color.Red, Operation.More); } iLine++; } } list.Clear(); string[] lineSumTime = { "", "Итого в день", "", loadMWH.dateStartMonth.ToShortDateString(), loadMWH.dateFinishMonth.ToShortDateString(), loadMWH.FactMonthHours(this.tracker).ToString("0.0"), "" }; foreach (string s in lineSumTime) { list.Add(s); } foreach (LoadDWH loadDWH in loadMWH.listLoadDWH) { list.Add(loadDWH.factDayHours.ToString("0.0")); } array = list.Select(i => i.ToString()).ToArray(); lvi = new ListViewItem(array); listLoadDWH.Items.Add(lvi); SetColorValue(listLoadDWH, iLine, array, 0, Color.Yellow, Operation.Equal); if (this.typeViewSelect == TypeView.LoadUser) { SetColorValue(listLoadDWH, iLine, array, 8, Color.Red, Operation.More); } AutoFitColumn(listLoadDWH); break; } }