Example #1
0
        public List<sp_Volunteer_DM> ListGroupFindVols(sp_Group_DM Group)
        {
            List<sp_Volunteer_DM> list = new List<sp_Volunteer_DM>();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    list = (from result in context.sp_GroupVol_Select_FindNewVols(Group.GroupID)
                            select new sp_Volunteer_DM
                            {
                                ActiveFlg = result.VolActive,
                                VolFirstName = result.VolFirstName,
                                VolMiddleName = result.VolMiddleName,
                                VolLastName = result.VolLastName,
                                VolID = result.VolID
                            }).ToList();
                } // Guaranteed to close the Connection
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return list;
        }
Example #2
0
        public sp_Group_DM InsertGroupContext(sp_Group_DM _cGroup)
        {
            BLL.InsertGroupContext(ref _cGroup);
            System.Web.Caching.Cache cache = HttpRuntime.Cache;
            cache.Insert(_cGroup.GroupID.ToString(), _cGroup, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);

            return _cGroup;
        }
Example #3
0
        public void DeleteGroupContext(sp_Group_DM _cGroup)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                var GroupToRemove = (from n in context.tblGroups where n.GroupID == _cGroup.GroupID select n).FirstOrDefault();
                context.tblGroups.Remove(GroupToRemove);
                context.SaveChanges();

            }
        }
    protected void GetGroupData()
    {
        GroupDM = GroupBLL.ListGroups(Convert.ToInt32(PassedGroupID));

        HDDGroupID.Value = GroupDM.GroupID.ToString();

        chkActive.Checked = (bool)GroupDM.ActiveFlg;
        rTBShortDesc.Text = GroupDM.ShortDesc;
        rTBGroupName.Text = GroupDM.GroupName;
        RadEditor1.Content = GroupDM.LongDesc;
    }
Example #5
0
        public void DeleteGroupContext(sp_Group_DM _cGroup)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_Group_DM cacheVol;
            cacheVol = (sp_Group_DM)cache[_cGroup.GroupID.ToString()];

            if (cacheVol != null)
            {
                cache.Remove(_cGroup.GroupID.ToString());
            }
            BLL.DeleteGroupContext(_cGroup);
        }
Example #6
0
        public void UpdateGroupContext(sp_Group_DM _cGroup)
        {
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_Group_DM cacheVol;
            cacheVol = (sp_Group_DM)cache[_cGroup.GroupID.ToString()];

            if (cacheVol != null)
            {
                cache.Remove(_cGroup.GroupID.ToString());
            }

            cache.Insert(_cGroup.GroupID.ToString(), _cGroup, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            BLL.UpdateGroupContext(_cGroup);
        }
Example #7
0
        public void TestGroupCreate()
        {
            string groupName = "TestGroup";
            string shortDesc = "We Rock!";
            string longDesc = "We will, we will, rock you!";
            int levelID = 5;
            var group_bll = new sp_Group_BLL();
            var group_dm = new sp_Group_DM();
            group_dm.GroupName = groupName;
            group_dm.ShortDesc = shortDesc;
            group_dm.LongDesc = longDesc;
            group_dm.ParticipationLevelID = levelID;
            var groupID = group_bll.InsertGroupContext(ref group_dm).GroupID;
            group_dm.GroupID = groupID;

            var group_dm_selected = group_bll.ListGroups(groupID);
            Assert.IsTrue(Equals(group_dm, group_dm_selected));
        }
Example #8
0
        /// <summary>
        /// ListGroups - There's a good chance the same record may be requested often.  Cache the vol object...
        /// 
        /// </summary>
        /// <param name="Group"></param>
        /// <returns></returns>
        public sp_Group_DM ListGroups(int IGroupID)
        {
            sp_Group_DM cGroup = new sp_Group_DM();

            //Cache cache = HttpRuntime.Cache;
            System.Web.Caching.Cache cache = HttpRuntime.Cache;

            sp_Group_DM cacheGroup;
            cacheGroup = (sp_Group_DM)cache[IGroupID.ToString()];

            if (cacheGroup == null)
            {
                cGroup = BLL.ListGroups(IGroupID);
                cache.Insert(cGroup.GroupID.ToString(), cGroup, null, DateTime.Now.AddSeconds(60), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }
            else
            {
                cGroup = cacheGroup;
            }

            return cGroup;
        }
Example #9
0
        public sp_Group_DM InsertGroupContext(ref sp_Group_DM _cGroup)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                var cGroup = new tblGroup
                {
                    GroupID = _cGroup.GroupID,
                    GroupName = _cGroup.GroupName,
                    ParticipationLevelID = _cGroup.ParticipationLevelID,
                    ActiveFlg = _cGroup.ActiveFlg,
                    ShortDesc = _cGroup.ShortDesc,
                    LongDesc = _cGroup.LongDesc

                };
                context.tblGroups.Add(cGroup);
                context.SaveChanges();

                // pass VolID back to BLL
                _cGroup.GroupID = cGroup.GroupID;

                return _cGroup;
            }
        }
Example #10
0
 public void DeleteGroupContext(sp_Group_DM _cGroup)
 {
     DAL.DeleteGroupContext(_cGroup);
 }
Example #11
0
 public void UpdateGroupContext(sp_Group_DM _cGroup)
 {
     DAL.UpdateGroupContext(_cGroup);
 }
        protected void rGridVolInvite_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                sp_Group_DM Group = new sp_Group_DM();

                Group.GroupID = 1;
                rGridVolInvite.DataSource = GroupVolBLL.ListGroupFindVols(Group);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                string errMethod = sf.GetMethod().Name.ToString();  // Get the current method name
                string errMsg = "600";                              // Gotta pass something, we're retro-fitting an existing method
                Session["LastException"] = ex;                      // Throw the exception in the session variable, will be used in error page
                string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL
                Response.Redirect(url);                             // Go to the error page.

            }
        }
Example #13
0
 public List<sp_Volunteer_DM> ListGroupFindVols(sp_Group_DM Group)
 {
     return DAL.ListGroupFindVols(Group);
 }
Example #14
0
 private static List<sp_Group_DM> DMsFrom(DataTable dataTable)
 {
     var DMs = new List<sp_Group_DM>();
     for (int i = 0; i < dataTable.Rows.Count; i++)
     {
         var returnGroup = new sp_Group_DM();
         returnGroup.GroupID = Convert.ToInt32(dataTable.Rows[i]["GroupID"]);
         returnGroup.GroupName = (String)dataTable.Rows[i]["GroupName"];
         returnGroup.LongDesc = (String)dataTable.Rows[i]["LongDesc"];
         returnGroup.ShortDesc = (String)dataTable.Rows[i]["ShortDesc"];
         returnGroup.ParticipationLevelID = Convert.ToInt32(dataTable.Rows[i]["ParticipationLevelID"]);
         returnGroup.ActiveFlg = Convert.ToBoolean(dataTable.Rows[i]["ActiveFlg"]);
         DMs.Add(returnGroup);
     }
     return DMs;
 }
Example #15
0
 bool Equals(sp_Group_DM dm1, sp_Group_DM dm2)
 {
     return (dm1.GroupID == dm2.GroupID &&
             dm1.GroupName == dm2.GroupName &&
             dm1.LongDesc == dm2.LongDesc &&
             dm1.ShortDesc == dm2.ShortDesc &&
             dm1.ActiveFlg == dm2.ActiveFlg &&
             dm1.ParticipationLevelID == dm2.ParticipationLevelID
             );
 }
Example #16
0
        public void UpdateGroupContext(sp_Group_DM _cGroup)
        {
            using (VolTeerEntities context = new VolTeerEntities())
            {
                var cGroup = context.tblGroups.Find(_cGroup.GroupID);

                if (cGroup != null)
                {
                    cGroup.GroupName = _cGroup.GroupName;
                    cGroup.ParticipationLevelID = _cGroup.ParticipationLevelID;
                    cGroup.ActiveFlg = _cGroup.ActiveFlg;
                    cGroup.ShortDesc = _cGroup.ShortDesc;
                    cGroup.LongDesc = _cGroup.LongDesc;
                    context.SaveChanges();
                }
            }
        }
Example #17
0
 public sp_Group_DM InsertGroupContext(ref sp_Group_DM _cGroup)
 {
     return DAL.InsertGroupContext(ref _cGroup);
 }