Example #1
0
        /// <summary>
        /// Edit a case, if editing supporter is the one assigned to the case
        /// </summary>
        /// <param name="c">Updated case</param>
        public void CaseEdit(Case c)
        {
            if (c == null)
            {
                throw new CaseEditException("Case can't be null");
            }

            if (c.Id <= 0 ||                                        //Id has to be set and greater than 0
                String.IsNullOrEmpty(c.OperatingSystem) ||          //OperatingSystem has to be set and not empty
                c.Priority < 1 || c.Priority > 5 ||                 //Priority has to be between 1 and 5
                c.Subcategory == null || c.Subcategory.Id <= 0 ||   //Subcategory has to be set and have an Id
                c.Customer == null || c.Customer.Id <= 0 ||         //Customer has to be set and have an Id
                String.IsNullOrEmpty(c.Description))                //Description has to be set and not empty
            {
                throw new CaseEditException("Case is not constructed correctly");
            }

            try
            {
                client.CaseEdit(c, SupporterController.LoggedInSupporter.Id);
            }
            catch (Exception e)
            {
                throw e;
                //throw new CaseEditException("There was an error with the service");
            }
        }