Exemplo n.º 1
0
        public ActionResult DisplayWarnings()
        {
            List <Warning> ToConfirmList = _pi.GetAllWarningOfmanager(logger.C_ID);

            WarningModel        warn;
            List <WarningModel> warnList = new List <WarningModel>();

            foreach (Warning w in ToConfirmList)
            {
                warn         = new WarningModel();
                warn.Reason  = w.Reason;
                warn.Content = w.Content;
                warn.gravity = w.gravity;
                warn.WId     = w.WId;

                CollaboratorModel Towarn = new CollaboratorModel();
                Towarn.C_Forname    = w.collab.C_Forname;
                Towarn.C_Lastname   = w.collab.C_Lastname;
                warn.collabAffected = Towarn;

                warnList.Add(warn);
            }
            WarningListModel listModel = new WarningListModel();

            listModel.list = warnList;
            var model = listModel;

            return(View("Warnings", model));
        }
        public IActionResult Create()
        {
            var collaboratorModel = new CollaboratorModel();

            collaboratorModel.FillItems(_dataManager);
            return(View("EditCollaborator", collaboratorModel));
        }
        public string AddCollaboratorToNote([FromBody] CollaboratorModel model)
        {
            try
            {
                var data = from t in context.collaborators where t.UserId == model.UserId select t;
                foreach (var datas in data.ToList())
                {
                    if (datas.NoteId == model.NoteId && datas.ReceiverEmail == model.ReceiverEmail)
                    {
                        return(false.ToString());
                    }
                }

                var newdata = new CollaboratorModel()
                {
                    UserId        = model.UserId,
                    NoteId        = model.NoteId,
                    SenderEmail   = model.SenderEmail,
                    ReceiverEmail = model.ReceiverEmail,
                };

                int result = 0;
                context.collaborators.Add(newdata);
                result = context.SaveChanges();
                return(result.ToString());
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds the collaborator.
        /// </summary>
        /// <param name="collaboratorModel">The collaborator model.</param>
        /// <returns>return string result.</returns>
        /// <exception cref="Exception">throw exception.</exception>
        public async Task <int> AddCollaborator(CollaboratorModel collaboratorModel)
        {
            try
            {
                var collaborator = new CollaboratorModel()
                {
                    UserId    = collaboratorModel.UserId,
                    NoteId    = collaboratorModel.NoteId,
                    CreatedBy = collaboratorModel.CreatedBy
                };

                this.context.Collaborator.Add(collaborator);
                var result = await this.context.SaveChangesAsync();

                if (result > 0)
                {
                    return(result);
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 5
0
        public async Task <IActionResult> AddCollabarator(CollaboratorModel collaboratorModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _logger.LogInformation("Could break here :(");
                    ////BusinessManager Layer method call
                    var result = await this._businessManager.AddCollaborator(collaboratorModel);

                    ///return the success result
                    return(this.Ok(new { result }));
                }
                else
                {
                    ////return the failer result
                    return(this.BadRequest(new { message = "data is not valid" }));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(e, "It broke :(");
                ////if exception occure then throw exceptions
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// Adds the collaborator.
        /// </summary>
        /// <param name="collaboratorModel">The collaborator model.</param>
        /// <returns>return the string result.</returns>
        /// <exception cref="Exception">
        /// throw exception.
        /// </exception>
        public async Task <int> AddCollaborator(CollaboratorModel collaboratorModel)
        {
            try
            {
                if (!collaboratorModel.Equals(null))
                {
                    ////repository service method called
                    var result = await this.repositoryManager.AddCollaborator(collaboratorModel);

                    ////result is not null then return the result.
                    if (!result.Equals(null))
                    {
                        return(result);
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Adds the collaborator.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>return true or false</returns>
 /// <exception cref="Exception"></exception>
 public bool AddCollaborator(CollaboratorModel model)
 {
     try
     {
         bool result = this.repository.AddCollaborator(model);
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 /// <summary>
 /// Add New Collaborator
 /// </summary>
 /// <param name="model">CollaboratorModel</param>
 /// <returns></returns>
 public bool AddCollaborator(CollaboratorModel model)
 {
     try
     {
         fundooContext.CollaboratorTable.Add(model);
         var emp = fundooContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 9
0
        public IActionResult Index()
        {
            var collaborators      = _dataManager.CollaboratorRepository.GetAll();
            var collaboratorModels = new List <CollaboratorModel>();

            foreach (var a in collaborators)
            {
                var collaboratorModel = new CollaboratorModel();
                collaboratorModel.SetModel(a, _dataManager);
                collaboratorModels.Add(collaboratorModel);
            }

            return(View(collaboratorModels));
        }
Exemplo n.º 10
0
        public IActionResult Edit(int id)
        {
            var collaborator = _dataManager.CollaboratorRepository.GetById(id);

            if (collaborator == null)
            {
                return(NotFound());
            }

            var collaboratorModel = new CollaboratorModel();

            collaboratorModel.SetModel(collaborator, _dataManager);

            return(View("EditCollaborator", collaboratorModel));
        }
 /// <summary>
 /// Adds the collaborator.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns>return true or false</returns>
 /// <exception cref="Exception"></exception>
 public bool AddCollaborator(CollaboratorModel model)
 {
     try
     {
         if (model != null)
         {
             this.userContext.Collaborator.Add(model);
             this.userContext.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 12
0
        public IActionResult Edit(CollaboratorModel collaboratorModel)
        {
            if (!ModelState.IsValid)
            {
                collaboratorModel.FillItems(_dataManager);
                return(View("EditCollaborator", collaboratorModel));
            }
            var collaborator = new Collaborator();

            if (collaboratorModel.Id != null)
            {
                collaborator = _dataManager.CollaboratorRepository.GetById(collaboratorModel.Id.Value);
            }
            collaboratorModel.ApplyChanges(collaborator);

            _dataManager.CollaboratorRepository.Update(collaborator);
            _dataManager.SaveChanges();

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 13
0
        public ActionResult AddCollaborators([FromBody] CollaboratorModel model)
        {
            try
            {
                bool result = this.collaboratorManager.AddCollaborator(model);
                if (result.Equals(true))
                {
                    return(this.Ok(new ResponseModel <CollaboratorModel>()
                    {
                        Status = true, Message = "New Collaborator Added Sucessfully", Data = model
                    }));
                }

                return(this.BadRequest(new { Status = false, Message = "Failed to Add Collaborator" }));
            }
            catch (Exception ex)
            {
                return(this.NotFound(new { Status = false, Message = ex.Message }));
            }
        }
 public IActionResult AddCoallaborator([FromBody] CollaboratorModel model)
 {
     try
     {
         bool result = manager.AddCollaborator(model);
         if (result)
         {
             return(this.Ok(new ResponseModel <CollaboratorModel>()
             {
                 Status = true, Masseage = "Collaborator added Successfully", Data = model
             }));
         }
         else
         {
             return(BadRequest(new { success = false, Message = "Somthing went wrong..." }));
         }
     }
     catch (Exception ex)
     {
         return(this.NotFound(new { Status = false, Message = ex.Message }));
     }
 }
Exemplo n.º 15
0
        public IActionResult SearchCollaborators(string searchValue)
        {
            if (string.IsNullOrEmpty(searchValue))
            {
                return(RedirectToAction("Index"));
            }

            searchValue = searchValue.ToLower();
            var collaborators = _dataManager.CollaboratorRepository.GetAll()
                                .Where(x => x.FirstName.ToLower() == searchValue ||
                                       x.SecondName.ToLower() == searchValue ||
                                       x.MiddleName.ToLower() == searchValue);

            var collaboratorModels = new List <CollaboratorModel>();

            foreach (var a in collaborators)
            {
                var collaboratorModel = new CollaboratorModel();
                collaboratorModel.SetModel(a, _dataManager);
                collaboratorModels.Add(collaboratorModel);
            }

            return(View("Index", collaboratorModels));
        }
 public string AddCollaboratorToNote([FromBody] CollaboratorModel model)
 {
     throw new NotImplementedException();
 }
 private void OnRemindCollaboratorButtonClick(object sender, CollaboratorModel e)
 {
     //code for remind
 }
 private async void OnGiveCollaboratorButtonClick(object sender, CollaboratorModel e)
 {
     //TODO Change 0 to value
     await ViewModel.MoveUserToInProgressAsync(e.TransactionId, 0);
 }
Exemplo n.º 19
0
        public ActionResult Tests360()
        {
            IEnumerable <t_evaluationtest> list = _sr.DisplayTests(logger, "360");

            RenderList = new List <TestToRender>();


            TestToRender     render;
            Question         question;
            PossibleResponse response;

            foreach (t_evaluationtest test in list)
            {
                render                  = new TestToRender();
                render.ID               = test.ET_ID;
                render.Type             = test.ET_Type;
                render.tType            = test.Et_tType;
                render.globaloNoteSoFar = test.globaloNoteSoFar;
                render.NbreQuestions    = test.t_criteria.Count();
                render.NbreParticipants = test.t_answertestaffectation.Count();

                render.questions = new List <Question>();

                //add target list of the test

                render.targetList = new List <CollaboratorModel>();
                CollaboratorModel colab;

                foreach (t_evaluationtargetaffectation aff in test.t_evaluationtargetaffectation)
                {
                    colab = new CollaboratorModel();
                    t_collaborator target = aff.t_collaborator;
                    colab.C_Lastname = target.C_Lastname;
                    colab.C_Forname  = target.C_Forname;
                    colab.C_ID       = target.C_ID;
                    render.targetList.Add(colab);
                }


                //add the questions
                foreach (t_criteria c in test.t_criteria)
                {
                    question             = new Question();
                    question.ID          = c.Cr_ID;
                    question.coefficient = c.Cr_coefficient;
                    question.Content     = c.Cr_Content;

                    question.PossibleResponses = new List <PossibleResponse>();

                    //add the responses of each question
                    foreach (t_possibleresponse rep in c.t_possibleresponse)
                    {
                        response         = new PossibleResponse();
                        response.ID      = rep.Pr_ID;
                        response.Content = rep.Pr_Content;
                        response.Score   = rep.Pr_score;

                        question.PossibleResponses.Add(response);
                    }


                    render.questions.Add(question);
                }
                RenderList.Add(render);
            }
            RenderTestList model = new RenderTestList();

            model.TestsList = RenderList;

            return(View(model));
        }
 public string AddCollaboratorToNote([FromBody] CollaboratorModel model)
 {
     return(Notes.AddCollaboratorToNote(model));
 }
 private async void OnApproveCollaboratorButtonClick(object sender, CollaboratorModel e)
 {
     await ViewModel.MoveUserToFinishedAsync(e.TransactionId, e.FriendId, 0);
 }