Esempio n. 1
0
        public IActionResult Create(ConcernViewModel newConcern)
        {
            if (ModelState.IsValid)
            {
                var concernToCreate = new Concern()
                {
                    ConcernId = Guid.NewGuid(),
                    // EmployeeId = newConcern.EmployeeId,
                    // Guid.NewGuid(),
                    // newConcern.EmployeeId,
                    ConcernDate = DateTime.Now,
                    // newConcern.ConcernDate,
                    ConcernType    = newConcern.ConcernType,
                    ConcernRemarks = newConcern.ConcernRemarks,
                    ConcernStatus  = newConcern.ConcernStatus
                };
                _employee.AddNewConcern(concernToCreate);

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("Form", newConcern));
            }
        }
        [Authorize(Policy = "AllRoles")]                //Rolesystem, you have to be logged in, but the Role is not important
        //Ein Anliegen
        public IActionResult ShowConcern(int concernId) //Only one concern, called by his id
        {
            Concern      concern  = db.Concern.SingleOrDefault(c => c.Id == concernId);
            Category     category = db.Category.SingleOrDefault(c => c.Id == concern.CategoryId);
            List <Image> images   = db.Image.Where(i => i.ConcernId == concernId).Select(ii => new Image
            {
                Id = ii.Id
            }).ToList();
            List <Comment>     comments     = db.Comment.Where(c => c.ConcernId == concernId).ToList();
            List <UserConcern> userConcerns = db.UserConcern.Where(uc => uc.ConcernId == concern.Id).ToList();

            concern.UserConcern = userConcerns;
            concern.Comment     = comments;
            concern.Category    = category;
            concern.Image       = images;

            List <SelectListItem> categoriesList = new List <SelectListItem>();
            List <Category>       categories     = db.Category.ToList();

            ViewData["Categories"] = categories;
            foreach (Category c in categories)
            {
                categoriesList.Add(new SelectListItem {
                    Value = c.Id.ToString(), Text = c.Description
                });
            }

            ViewData["CategoriesList"] = categoriesList;

            return(View("ConcernView", concern));
        }
        private static void WriteConcern(Concern concern, StringBuilder reportBuilder)
        {
            reportBuilder.AppendFormat(
                "{0} specifications {1}",
                concern,
                new string(' ', 4));

            reportBuilder.AppendFormat(
                "({0} {1}, {2} {3})",
                concern.AmountOfContexts,
                Pluralizer.Pluralize("context", concern.AmountOfContexts),
                concern.AmountOfObservations,
                Pluralizer.Pluralize("observation", concern.AmountOfObservations));

            reportBuilder.AppendLine();
            reportBuilder.AppendLine(new string('-', 100));
            reportBuilder.AppendLine();

            foreach (var context in concern)
            {
                WriteContext(context, reportBuilder);
            }

            reportBuilder.AppendLine();
        }
Esempio n. 4
0
        protected override void Context()
        {
            _concern = new Concern(typeof(Context_with_concern).GetConcernName());
            _concern.AddContextFor(typeof(Context_with_concern));

            _testFixtureType = typeof(Context_with_some_other_concern);
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtConcern.Text) || !_concernMap.ContainsKey(txtConcern.Text))
            {
                txtConcern.Select(0, txtConcern.TextLength);
                MessageBox.Show(string.Format(Messages.SelectForceDialogConcernDoesNotExist, txtConcern.Text));
                return;
            }
            if (string.IsNullOrEmpty(txtForce.Text) || !_forcesMap.ContainsKey(txtForce.Text))
            {
                txtConcern.Select(0, txtForce.TextLength);
                MessageBox.Show(string.Format(Messages.SelectForceDialogForceDoesNotExist, txtForce.Text));
                return;
            }

            Force   = new Force(_forcesMap[txtForce.Text]);
            Concern = new Concern(_concernMap[txtConcern.Text]);
            var forceExists = (from x in _forces
                               where x.Force.ForceGUID.Equals(Force.ForceGUID) && x.Concern.ConcernGUID.Equals(Concern.ConcernGUID)
                               select x).Any();

            if (forceExists)
            {
                MessageBox.Show(string.Format(Messages.ForcesViewForceExists, Force.Name, Concern.Name));
                return;
            }

            DialogResult = DialogResult.OK;
            Close();
        }
        public void Update(Concern concernToUpdate)
        {
            var concernDb = ConvertToDb(concernToUpdate);

            _context.Concern.Update(concernDb);
            _context.SaveChanges();
        }
        // Methods
        public void Create(Concern newConcern)
        {
            var concernModel = ConvertToDb(newConcern);

            _context.Concern.Add(concernModel);
            _context.SaveChanges();
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            #region noUL
            User user = new User()
            {
                UserName = "******"
            };
            Console.Write("Please input your problem: ");
            string  concernInput = Console.ReadLine();
            Concern concern      = new Concern()
            {
                ConcernBody = concernInput, DateFiled = DateTime.Now
            };

            UserServices userServices = new UserServices();

            userServices.FileUsersConcern(concern, user);
            #endregion

            #region UL
            //Console.Write("Please input your problem: ");
            //string ticketInput = Console.ReadLine();
            //Ticket ticket = new Ticket() { TicketBody = ticketInput, DateFiled = DateTime.Now };

            //ULUserServices userServicesUL = new ULUserServices();

            //userServicesUL.FileUsersTicket(ticket, user);
            #endregion
        }
Esempio n. 9
0
        /// <summary>
        /// 取消关注
        /// </summary>
        /// <param name="concernID"></param>
        /// <returns>"未关注" "取消关注成功" "取消关注失败"</returns>
        public static string UnConcern(string concernMember, string concernTo)
        {
            Concern concern = new Concern()
            {
                ConcernMember = concernMember,
                ConcernTo     = concernTo
            };

            if (concern.IsError)
            {
                return(concern.GetErrorMsg());
            }
            if (!ifconcern(concernMember, concernTo))
            {
                return("您还未关注该会员");
            }
            if (ICS.delete(concernMember, concernTo) > 0)
            {
                return("取消关注成功");
            }
            else
            {
                return("取消关注失败");
            }
        }
Esempio n. 10
0
        private static void WriteConcern(Concern concern, StringBuilder reportBuilder)
        {
            reportBuilder.AppendFormat(
                "{0} specifications {1}",
                concern,
                new string(' ', 4));

            reportBuilder.AppendFormat(
                "({0} {1}, {2} {3})",
                concern.AmountOfContexts,
                Pluralizer.Pluralize("context", concern.AmountOfContexts),
                concern.AmountOfObservations,
                Pluralizer.Pluralize("observation", concern.AmountOfObservations));

            reportBuilder.AppendLine();
            reportBuilder.AppendLine(new string('-', 100));
            reportBuilder.AppendLine();

            foreach (var context in concern)
            {
                WriteContext(context, reportBuilder);
            }

            reportBuilder.AppendLine();
        }
Esempio n. 11
0
 public static bool ConcernCheck(Concern concern)
 {
     if (String.IsNullOrEmpty(concern.ConcernBody))
     {
         return(false);
     }
     return(true);
 }
        public void Update(Concern updateConcern)
        {
            var concern = GetById(updateConcern.ConcernId);

            concern.ConcernType    = updateConcern.ConcernType;
            concern.ConcernRemarks = updateConcern.ConcernRemarks;
            concern.ConcernStatus  = updateConcern.ConcernStatus;
        }
        public void should_exclude_contexts_whose_conerns_do_not_match_the_filter()
        {
            var concerns = _specificationDataset.Concerns.Where(c => c.Name == "SomeOtherConcern");

            Concern concern = concerns.FirstOrDefault();

            concern.ShouldBeNull();
        }
Esempio n. 14
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Goal;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (TargetDateElement != null)
                {
                    dest.TargetDateElement = (Hl7.Fhir.Model.Date)TargetDateElement.DeepCopy();
                }
                if (DescriptionElement != null)
                {
                    dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.Goal.GoalStatus>)StatusElement.DeepCopy();
                }
                if (StatusDateElement != null)
                {
                    dest.StatusDateElement = (Hl7.Fhir.Model.Date)StatusDateElement.DeepCopy();
                }
                if (Author != null)
                {
                    dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopy();
                }
                if (Priority != null)
                {
                    dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopy();
                }
                if (Concern != null)
                {
                    dest.Concern = new List <Hl7.Fhir.Model.ResourceReference>(Concern.DeepCopy());
                }
                if (NotesElement != null)
                {
                    dest.NotesElement = (Hl7.Fhir.Model.FhirString)NotesElement.DeepCopy();
                }
                if (Outcome != null)
                {
                    dest.Outcome = new List <Hl7.Fhir.Model.Goal.GoalOutcomeComponent>(Outcome.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Esempio n. 15
0
        public JsonResult GetConcernJson(int concernId)
        {
            Concern concern = db.Concern.Where(c => c.Id == concernId).SingleOrDefault();

            Status[] statuses     = db.Status.Where(s => s.Id >= concern.StatusId).ToArray();
            string   statusesJson = Newtonsoft.Json.JsonConvert.SerializeObject(statuses);

            return(Json(new { concernId, title = concern.Title, text = concern.Text, statusId = concern.StatusId, date = concern.Date.ToString(), statuses }));
        }
 public ConcernViewModel(Concern item)
 {
     if (item != null)
     {
         Id     = item.Id;
         Active = item.Active;
         Name   = item.Name;
     }
 }
Esempio n. 17
0
        public IActionResult ShowConcern(int concernId)
        {
            Concern            concern      = db.Concern.Where(c => c.Id == concernId).SingleOrDefault();
            List <Comment>     comments     = db.Comment.Where(c => c.ConcernId == concernId).ToList();
            List <UserConcern> userConcerns = db.UserConcern.Where(uc => uc.ConcernId == concern.Id).ToList();

            concern.UserConcern = userConcerns;
            concern.Comment     = comments;
            return(View("ConcernView", concern));
        }
        public async Task <IActionResult> CreateConcernAsync(Concern concern, List <IFormFile> files)
        {
            if (ModelState.IsValid)
            {
                // Image[] files = concern.Image.ToArray();
                concern.UserId = (await userManager.GetUserAsync(HttpContext.User)).Id;
                concern.Date   = DateTime.UtcNow;

                long size = files.Sum(f => f.Length);

                // full path to file in temp location
                var filePath = Path.GetTempFileName();
                foreach (var formFile in files)
                {
                    File  file  = new File();
                    Image image = new Image();
                    if (formFile.Length > 0)
                    {
                        using (var stream = new MemoryStream())
                        {
                            await formFile.CopyToAsync(stream);

                            if (string.Equals(formFile.ContentType, "application/pdf",
                                              StringComparison.OrdinalIgnoreCase)) /*"\"application/pdf\"")*/
                            {
                                file.File1     = stream.ToArray();
                                file.ConcernId = concern.Id;
                                file.PollId    = null;
                                file.Name      = formFile.FileName;
                                file.Ending    = formFile.ContentType;
                                concern.File.Add(file);
                            }
                            else
                            {
                                image.Img       = stream.ToArray();
                                image.ConcernId = concern.Id;
                                image.PollId    = null;
                                image.Name      = formFile.FileName;
                                image.Ending    = formFile.ContentType;
                                concern.Image.Add(image);
                            }
                        }
                    }
                }


                concern.StatusId = 1;
                db.Add(concern);
                await db.SaveChangesAsync();

                return(RedirectToAction("ShowConcern", "Home", new { concernId = concern.Id }));
            }

            return(View("CreateConcernView"));
        }
Esempio n. 19
0
        public string Concern(int UsrB)
        {
            Concern us = new Concern();

            us.UsrA = Convert.ToInt32(Session["UsrId"].ToString());
            us.UsrB = UsrB;
            userinfomanager.Concern(us);
            string aa = userinfomanager.CountConcern2ById(UsrB).Count().ToString();

            return(aa);
        }
Esempio n. 20
0
 public void FileUsersConcern(Concern concern, User user)
 {
     if (Helper.ConcernCheck(concern))
     {
         Console.WriteLine("{1} has filed his concern : {0}", concern.ConcernBody, user.UserName);
     }
     else
     {
         Console.WriteLine("Your input is invalid");
     }
 }
Esempio n. 21
0
        public string QuXiaoGuanZhu(int UsrB)
        {
            Concern us   = new Concern();
            int     UsrA = Convert.ToInt32(Session["UsrId"].ToString());

            userinfomanager.QuCiaoGuanZhu(UsrA, UsrB);

            string aa = userinfomanager.CountConcern2ById(UsrB).Count().ToString();

            return(aa);
        }
Esempio n. 22
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="con"></param>
        /// <returns></returns>
        public int insertConcern(Concern con)
        {
            string sql = "insert into Concern(concern_id,concern_member,concern_to) values(@concernId,@concernMember,@concernTo)";

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@concernId", con.ConcernId),
                new SqlParameter("@concernMember", con.ConcernMember),
                new SqlParameter("@concernTo", con.ConcernTo)
            };
            return(SqlHelper.ExecuteNonQuery(sql, parameters));
        }
Esempio n. 23
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as CarePlan;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.CarePlan.CarePlanStatus>)StatusElement.DeepCopy();
                }
                if (Period != null)
                {
                    dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
                }
                if (ModifiedElement != null)
                {
                    dest.ModifiedElement = (Hl7.Fhir.Model.FhirDateTime)ModifiedElement.DeepCopy();
                }
                if (Concern != null)
                {
                    dest.Concern = new List <Hl7.Fhir.Model.ResourceReference>(Concern.DeepCopy());
                }
                if (Participant != null)
                {
                    dest.Participant = new List <Hl7.Fhir.Model.CarePlan.CarePlanParticipantComponent>(Participant.DeepCopy());
                }
                if (Goal != null)
                {
                    dest.Goal = new List <Hl7.Fhir.Model.CarePlan.CarePlanGoalComponent>(Goal.DeepCopy());
                }
                if (Activity != null)
                {
                    dest.Activity = new List <Hl7.Fhir.Model.CarePlan.CarePlanActivityComponent>(Activity.DeepCopy());
                }
                if (NotesElement != null)
                {
                    dest.NotesElement = (Hl7.Fhir.Model.FhirString)NotesElement.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Esempio n. 24
0
        public async Task <IActionResult> Edit(Guid id, EditConcernViewModel model)
        {
            if (id != model.Id)
            {
                return(NotFound());
            }

            if (await ConcernNameExistsAsync(model.Name, id))
            {
                ModelState.AddModelError("Name", "The name already exists.");
            }

            string msg;

            if (ModelState.IsValid)
            {
                var item = new Concern()
                {
                    Id     = model.Id,
                    Name   = model.Name,
                    Active = model.Active
                };

                try
                {
                    _cache.Remove(CacheKeys.AreasOfConcernSelectList);

                    _context.Update(item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!(await ConcernExists(model.Id)))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                msg = string.Format("The {0} was updated.", objectDisplayName);
                TempData.SaveAlertForSession(msg, AlertStatus.Success, "Success");

                return(RedirectToAction("Details", new { id = model.Id }));
            }

            msg = string.Format("The {0} was not updated. Please fix the errors shown below.", objectDisplayName);
            ViewData["AlertMessage"] = new AlertViewModel(msg, AlertStatus.Error, "Error");

            return(View(model));
        }
Esempio n. 25
0
        public IActionResult ChangeConcernStatus(string concernModalStatus, string concernModalId)
        {
            int     concernId = Convert.ToInt32(concernModalId);
            int     statusId  = Convert.ToInt32(concernModalStatus);
            Concern concern   = db.Concern.Where(c => c.Id == concernId).SingleOrDefault();
            int     oldStatus = concern.StatusId;

            concern.StatusId = statusId;
            db.Concern.Update(concern);
            db.SaveChanges();
            return(this.ShowConcerns(oldStatus));
        }
Esempio n. 26
0
        public void CreateConcern(string concern, Patient patient)
        {
            using var db = new PatientRecordsContext();
            var newConcern = new Concern
            {
                Concern1    = concern,
                ConcernDate = DateTime.Now,
                PatientId   = patient.PatientId
            };

            db.Concerns.Add(newConcern);
            db.SaveChanges();
        }
 public static EFModels.Concern ConvertToDb(Concern concern)
 {
     return(new EFModels.Concern()
     {
         ConcernId = concern.ConcernId,
         EmployeeId = concern.EmployeeId,
         // mployeeId = concern.EmployeeId,
         ConcernDate = concern.ConcernDate,
         ConcernType = concern.ConcernType,
         ConcernRemarks = concern.ConcernRemarks,
         ConcernStatus = concern.ConcernStatus
     });
 }
        public JsonResult ChangeConcernStatus(string status, string concern)
        {
            int     concernId = Convert.ToInt32(concern);
            int     statusId  = Convert.ToInt32(status);
            Concern con       = db.Concern.Where(c => c.Id == concernId).SingleOrDefault();
            int     oldStatus = con.StatusId;

            con.StatusId = statusId;
            db.Concern.Update(con);
            int result = db.SaveChanges();

            return(Json(new { result }));
        }
Esempio n. 29
0
 public ActionResult <Concern> AddConcern(Concern concern)
 {
     try
     {
         applicationDb.Concerns.Add(concern);
         applicationDb.SaveChanges();
     }
     catch (Exception e)
     {
         return(BadRequest(e.InnerException.Message));
     }
     return(concern);
 }
        public ActionResult getConcern(QuestionDTO data)
        {
            Concern con = new Concern();

            con.Studentnum = data.Studentnum;
            con.Email      = data.Email;
            con.Subject    = data.Subject;
            con.Content    = data.Content;


            db.Concerns.Add(con);
            db.SaveChanges();
            return(View("Profile"));
        }
        public override int GetHashCode()
        {
            unchecked
            {
                int hash = 17;
                hash = hash * 29 + (Name != null ? Name.GetHashCode() : 0);
                hash = hash * 29 + (Concern != null ? Concern.GetHashCode() : 0);
                hash = hash * 29 + (TypeName != null ? TypeName.GetHashCode() : 0);
                hash = hash * 29 + (Namespace != null ? Namespace.GetHashCode() : 0);
                hash = hash * 29 + (AssemblyName != null ? AssemblyName.GetHashCode() : 0);

                return(hash);
            }
        }