Пример #1
0
        public bool GetOutsourcingCompanyProjects(int hiringCompanyId)
        {
            List <WcfCommon.Data.Project> projects = new List <WcfCommon.Data.Project>();

            CommunicationState cs = ServiceProxy.State;

            try
            {
                projects = ServiceProxy.Instance.GetProjects(hiringCompanyId);
            }
            catch (CommunicationException ce)
            {
                ServiceProxy.Instance = null;
                Log.Error("Connection to Outsourcing company service failed.");
                return(false);
            }
            catch (Exception e)
            {
                ServiceProxy.Instance = null;
                Log.Error("Connection to Outsourcing company service failed.");
                return(false);
            }

            foreach (var p in projects)
            {
                HiringCompanyData.Project pr = new HiringCompanyData.Project();
                pr.Approved    = p.Approved;
                pr.Description = p.Description;
                pr.EndDate     = p.EndDate;
                pr.Ended       = p.Ended;
                pr.Name        = p.Name;
                pr.Progress    = p.Progress;
                pr.EndDate     = p.EndDate;

                bool projectAdded = ProjectDB.Instance.AddProject(pr);

                if (!projectAdded)
                {
                    ProjectDB.Instance.UpdateProject(pr);
                }
            }

            return(true);
        }
Пример #2
0
 public bool AddProjectDefinition(HiringCompanyData.Project project)
 {
     Log.Debug("AddProjectDefinition Servisni poziv");
     Console.WriteLine("AddProjectDefinition...");
     return(ProjectDB.Instance.AddProject(project));
 }
Пример #3
0
        public bool GetUserStories(string projectName)
        {
            List <WcfCommon.Data.UserStory> userStories_common = new List <WcfCommon.Data.UserStory>();


            try
            {
                userStories_common = ServiceProxy.Instance.GetUserStoryes(projectName);
            }
            catch (CommunicationException ce)
            {
                ServiceProxy.Instance = null;
                Log.Error("Connection to Outsourcing company service failed.");
                return(false);
            }
            catch (Exception e)
            {
                ServiceProxy.Instance = null;
                Log.Error("Connection to Outsourcing company service failed.");
                return(false);
            }

            List <HiringCompanyData.UserStory> userStories = new List <HiringCompanyData.UserStory>();

            foreach (WcfCommon.Data.UserStory u in userStories_common)
            {
                HiringCompanyData.UserStory us = new HiringCompanyData.UserStory();
                us.IdFromOcDB  = u.Id;
                us.Description = u.Description;
                us.Name        = u.Name;
                us.Progress    = u.Progress;

                switch (u.UserStoryState)
                {
                case WcfCommon.Enums.UserStoryState.Approved:
                {
                    us.UserStoryState = UserStoryState.Approved;
                    break;
                }

                case WcfCommon.Enums.UserStoryState.Closed:
                {
                    us.UserStoryState = UserStoryState.Closed;
                    break;
                }

                case WcfCommon.Enums.UserStoryState.Finished:
                {
                    us.UserStoryState = UserStoryState.Finished;
                    break;
                }

                case WcfCommon.Enums.UserStoryState.New:
                {
                    us.UserStoryState = UserStoryState.New;
                    break;
                }

                case WcfCommon.Enums.UserStoryState.Open:
                {
                    us.UserStoryState = UserStoryState.Open;
                    break;
                }

                case WcfCommon.Enums.UserStoryState.Proposed:
                {
                    us.UserStoryState = UserStoryState.Pending;
                    break;
                }

                case WcfCommon.Enums.UserStoryState.Rejected:
                {
                    us.UserStoryState = UserStoryState.Rejected;
                    break;
                }
                }

                us.WeightOfUserStory = u.WeightOfUserStory;

                HiringCompanyData.Project p = ProjectDB.Instance.GetProject(projectName);

                us.Project = p;

                bool userStoryAdded = UserStoryDB.Instance.AddUserStory(us);

                if (!userStoryAdded)
                {
                    UserStoryDB.Instance.UpdateUserStory(us);
                }
            }
            return(true);
        }
Пример #4
0
 public bool MarkProjectEnded(HiringCompanyData.Project p)
 {
     Log.Info("MarkProjectEnded");
     return(ProjectDB.Instance.MarkProjectEnded(p));
 }
Пример #5
0
        public bool SendProjectRequest(int hiringCompanyID, int outsourcingCompanyId, HiringCompanyData.Project project)
        {
            WcfCommon.Data.Project pr_data = new WcfCommon.Data.Project();

            pr_data.Approved    = project.Approved;
            pr_data.Description = project.Description;
            pr_data.EndDate     = project.EndDate;
            pr_data.Ended       = project.Ended;
            pr_data.Name        = project.Name;
            pr_data.Progress    = project.Progress;
            pr_data.StartDate   = project.StartDate;


            bool ret = false;

            try
            {
                ret = ServiceProxy.Instance.SendProject(hiringCompanyID, outsourcingCompanyId, pr_data);
            }
            catch (CommunicationException ce)
            {
                ServiceProxy.Instance = null;
                Log.Error("Connection to Outsourcing company service failed.");
            }
            catch (Exception e)
            {
                ServiceProxy.Instance = null;
                Log.Error("Connection to Outsourcing company service failed.");
            }

            if (ret)
            {
                Log.Info("SUCCESSFULLY SENT PROJECT REQUEST!");
            }
            else
            {
                Log.Warn("Failed to sent project request.");
            }

            return(ret);
        }