Example #1
0
        public bool InactivateProfile(LakeProfile item)
        {
            bool result = false;

            try
            {
                using (RCID_DWHEntities context = new RCID_DWHEntities())
                {
                    Lake_Profile efItem = context.Lake_Profile.Where(b => b.ProfileID == item.ProfileID).FirstOrDefault();

                    if (efItem == null)
                    {
                        return(result);
                    }

                    efItem.ProfileActive = false;

                    if (context.SaveChanges() > 0)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception) { }
            return(result);
        }
Example #2
0
        public int CreateProfile(LakeProfile item)
        {
            int newid = 0;

            try
            {
                using (RCID_DWHEntities context = new RCID_DWHEntities())
                {
                    var lastItem = context.Lake_Profile.OrderByDescending(u => u.ProfileID).FirstOrDefault();

                    if (lastItem != null)
                    {
                        newid = lastItem.ProfileID;
                        newid++;
                    }

                    Lake_Profile efItem = new Lake_Profile()
                    {
                        ProfileDate   = item.ProfileDate,
                        ProfileID     = newid,
                        ProfileActive = item.ProfileActive,
                        SourceID      = LIMS_SOURCEID,
                        SamplePointID = item.SamplePointID
                    };

                    context.Lake_Profile.Add(efItem);

                    if (context.SaveChanges() > 0)
                    {
                        return(newid);
                    }
                }
            }
            catch (Exception e) { throw e; }
            return(newid);
        }