Example #1
0
        public IHttpActionResult ServiceProgramInsert(string ServiceProgramName, bool Active)
        {
            int systemID = base.authRepository.GetSystemIDByLoggedInUserRole();

            string[] result = new string[2];


            try
            {
                ServiceProgram objServiceProg = new ServiceProgram();
                objServiceProg.Name        = ServiceProgramName;
                objServiceProg.Active      = Active;
                objServiceProg.CreatedDate = DateTime.Now;
                objServiceProg.SystemID    = systemID;
                objServiceProg.CreatedBy   = User.Identity.Name;
                objServiceProg.UpdatedDate = DateTime.Now;
                objServiceProg.UpdatedBy   = User.Identity.Name;
                context.ServiceProgram.Add(objServiceProg);
                context.SaveChanges();
                //After save pull the id and pass the message with the Id as response.
                var retval = context.ServiceProgram.FirstOrDefault(x => x.Name == ServiceProgramName && x.Active == true);
                result[0] = Convert.ToString(retval.ID);
                result[1] = "s";
                return(Ok(result));
            }
            catch (Exception e)
            {
                string ex = e.Message;
                result[0] = null;
                result[1] = "f";
                return(Ok(result));
            }
        }
Example #2
0
        public IHttpActionResult UpdateAlluniqueIds(UniqidsReq ObjList)
        {
            try

            {
                foreach (Uniqids list in ObjList.list)
                {
                    int    personid = list.PersonId;
                    string Unid     = list.UniqueId;
                    var    result   = context.Person.Where(x => x.UniqueID.Contains(Unid.Trim())).ToList();
                    int    count    = result.Count;
                    int    postfix  = count + 1;
                    string UnqId    = Unid + '-' + postfix.ToString();

                    var record = context.Person.Where(x => x.ID == personid).FirstOrDefault();
                    if (record != null)
                    {
                        record.UniqueID = UnqId;
                        context.SaveChanges();
                    }
                }
                return(Ok("Success"));
            }
            catch (Exception e)
            {
                return(Ok("Failed"));
            }
        }
Example #3
0
        public string DeleteEnrollment(int id)
        {
            string output = "";
            var    req    = context.Enrollment.Where(x => x.ID == id).ToList();

            if (req.Count == 0)
            {
                return(null);
            }
            else
            {
                req.ForEach(x =>
                {
                    context.Enrollment.Remove(x);
                });
            }
            try
            {
                context.SaveChanges();
                output = "Success";
            }
            catch (Exception ex)
            {
                output = "Failed";
            }
            return(output);
        }
Example #4
0
        public IHttpActionResult Delete(int id)
        {
            string result = "";

            if (ModelState.IsValid)
            {
                var record = context.CareerPathway.Where(x => x.ID == id).FirstOrDefault();
                if (record != null)
                {
                    record.Active = false;
                }
                try
                {
                    context.SaveChanges();
                    result = "s";
                    return(Ok(result));
                }
                catch (Exception ex)
                {
                    result = "f";
                    return(Ok(result));
                }
            }

            return(Ok(result));
        }
        public IHttpActionResult Delete(int id)
        {
            string result = "";

            if (ModelState.IsValid)
            {
                var record = context.EducationLevel.Where(x => x.ID == id).FirstOrDefault();
                if (record != null)
                {
                    context.EducationLevel.Remove(record);
                }
                try
                {
                    context.SaveChanges();
                    result = "s";
                    return(Ok(result));
                }
                catch (Exception ex)
                {
                    result = "f";
                    return(Ok(result));
                }
            }

            return(Ok(result));
        }
Example #6
0
        public string DeleteFamilyMember(int id)
        {
            string result = "";
            var    req    = context.FamilyProfile.Where(x => x.FamilyMemberID == id).ToList();

            if (req.Count == 0)
            {
                result = "Member Not Found";
            }
            else
            {
                req.ForEach(r =>
                {
                    context.FamilyProfile.Remove(r);
                });
                try {
                    context.SaveChanges();
                    result = "Success";
                }
                catch (Exception ex) {
                    result = "Failed";
                }
            }

            return(result);
        }
        public int UpdateServiceUnit(ServiceUnit serviceUnit)
        {
            var original = context.ServiceUnit.Find(serviceUnit.ID);

            try
            {
                if (original != null)
                {
                    context.Entry(original).CurrentValues.SetValues(serviceUnit);
                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(serviceUnit.ID);
        }
Example #8
0
        public int UpdateProgressNote(ProgressNote progressNote)
        {
            var original = context.ProgressNote.Find(progressNote.ID);

            try
            {
                if (original != null)
                {
                    context.Entry(original).CurrentValues.SetValues(progressNote);
                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(progressNote.ID);
        }
Example #9
0
        public IHttpActionResult MeargeServiceCategory(int ServiceProgramID, int ServiceCategoryID)
        {
            int    systemID = base.authRepository.GetSystemIDByLoggedInUserRole();
            string result   = String.Empty;

            if ((from t in context.ServiceProgramCategory
                 where t.ServiceCategoryID == ServiceCategoryID &&
                 t.ServiceProgramID == ServiceProgramID && t.Active == true
                 select t).Count() > 0)
            {
                result = "e";
                return(Ok(result));
            }
            else
            {
                try
                {
                    ServiceProgramCategory spCInsert = new ServiceProgramCategory();
                    spCInsert.ServiceCategoryID = ServiceCategoryID;
                    spCInsert.ServiceProgramID  = ServiceProgramID;
                    spCInsert.Active            = true;
                    spCInsert.SystemID          = systemID;
                    spCInsert.CreatedDate       = DateTime.Now;
                    spCInsert.CreatedBy         = User.Identity.Name;
                    spCInsert.UpdatedDate       = DateTime.Now;
                    spCInsert.UpdatedBy         = User.Identity.Name;
                    context.ServiceProgramCategory.Add(spCInsert);
                    context.SaveChanges();
                    result = "s";
                    return(Ok(result));
                }
                catch (Exception e)
                {
                    string ex = e.Message;
                    result = "f";
                    return(Ok(result));
                }
            }
        }
Example #10
0
        public IHttpActionResult Delete(int id)
        {
            var placementOffense = context.PlacementOffense.FirstOrDefault(x => x.ID == id);

            if (placementOffense != null)
            {
                //placementOffense.Active = false;
                context.PlacementOffense.Remove(placementOffense);

                context.SaveChanges();

                return(Ok());
            }

            return(NotFound());
        }
Example #11
0
        public int UpdateActionPlan(ActionPlan actionPlan)
        {
            var original = context.ActionPlan.Find(actionPlan.ID);

            try
            {
                if (original != null)
                {
                    context.Entry(original).CurrentValues.SetValues(actionPlan);
                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(actionPlan.ID);
        }
Example #12
0
        public int UpdateEnrollment(Enrollment enrollment)
        {
            var original = context.Enrollment.Find(enrollment.ID);

            try
            {
                if (original != null)
                {
                    context.Entry(original).CurrentValues.SetValues(enrollment);
                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(enrollment.ID);
        }
        public async Task <int> Delete(int id)
        {
            if (ModelState.IsValid)
            {
                var record = context.FundingSource.Where(x => x.ID == id).FirstOrDefault();
                if (record != null)
                {
                    record.Active = false;
                }
                try
                {
                    context.SaveChanges();
                    return(1);
                }
                catch (Exception ex)
                {
                    return(0);
                }
            }

            return(0);
        }