コード例 #1
0
ファイル: LakeController.cs プロジェクト: samador013/RC
        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);
        }
コード例 #2
0
ファイル: LakeRepository.cs プロジェクト: samador013/RC
        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);
        }
コード例 #3
0
ファイル: LakeController.cs プロジェクト: samador013/RC
        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);
        }
コード例 #4
0
ファイル: LakeController.cs プロジェクト: samador013/RC
        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);
        }
コード例 #5
0
ファイル: LakeRepository.cs プロジェクト: samador013/RC
        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);
        }
コード例 #6
0
ファイル: LakeService.cs プロジェクト: samador013/RC
 public bool InactivateProfile(LakeProfile item)
 {
     return(_LakeRepo.InactivateProfile(item));
 }
コード例 #7
0
ファイル: LakeService.cs プロジェクト: samador013/RC
 public int CreateProfile(LakeProfile item)
 {
     return(_LakeRepo.CreateProfile(item));
 }
コード例 #8
0
ファイル: LakeService.cs プロジェクト: samador013/RC
 public bool UpdateProfile(LakeProfile item)
 {
     return(_LakeRepo.UpdateProfile(item));
 }