Esempio n. 1
0
        public string DeleteProfile(LakeProfile item)
        {
            string msg = string.Empty;

            item.ProfileActive = false;

            try
            {
                if (ModelState.IsValid)
                {
                    _LakeSvc.InactivateProfile(item);
                    msg = "Profile inactivated succesfully";
                }
                else
                {
                    msg = "Data validation not successfull";
                }
            }
            catch (Exception e)
            {
                msg = "Delete Profile. An error has ocurred";
            }

            return(msg);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public string CreateProfile([Bind(Exclude = "ProfileID")] LakeProfile item)
        {
            string msg = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    _LakeSvc.CreateProfile(item);
                    msg = "Profile created succesfully";
                }
                else
                {
                    msg = "Data validation not successfull";
                }
            }
            catch (Exception e)
            {
                msg = "Create Profile. An error has ocurred";
            }

            return(msg);
        }
Esempio n. 4
0
        public string EditProfile(LakeProfile item)
        {
            string msg = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    _LakeSvc.UpdateProfile(item);
                    msg = "Profile saved succesfully";
                }
                else
                {
                    msg = "Data validation not successfull";
                }
            }
            catch (Exception e)
            {
                msg = "Edit Profile. An error has ocurred";
            }

            return(msg);
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
 public bool InactivateProfile(LakeProfile item)
 {
     return(_LakeRepo.InactivateProfile(item));
 }
Esempio n. 7
0
 public int CreateProfile(LakeProfile item)
 {
     return(_LakeRepo.CreateProfile(item));
 }
Esempio n. 8
0
 public bool UpdateProfile(LakeProfile item)
 {
     return(_LakeRepo.UpdateProfile(item));
 }