Example #1
0
        public ClsGroup GetGroupByGroupId(long lgGroupId)
        {
            ClsGroup objClsGroup = new ClsGroup();

            try
            {
                using (this.objDataContext = new GroupsDataContext(Functions.StrConnection))
                {
                    GetGroupByIdResult item = this.objDataContext.GetGroupById(lgGroupId).FirstOrDefault();
                    if (item != null)
                    {
                        objClsGroup.lgId            = item.Id;
                        objClsGroup.strGroupName    = item.GroupName;
                        objClsGroup.lgCompanyId     = item.CompanyId;
                        objClsGroup.lgParentGroupId = item.ParentGroupId;
                        objClsGroup.hdnstrUserIds   = item.UserIds;
                    }
                }
            }
            catch (Exception ex)
            {
                Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.Group, mySession.Current.UserId);
            }

            return(objClsGroup);
        }
Example #2
0
 public long SaveGroup(ClsGroup objSave)
 {
     try
     {
         using (this.objDataContext = new GroupsDataContext(Functions.StrConnection))
         {
             var result = this.objDataContext.InsertOrUpdateGroup(objSave.lgId, objSave.strGroupName, objSave.lgCompanyId, objSave.lgParentGroupId, objSave.hdnstrUserIds, mySession.Current.UserId, PageMaster.Group).FirstOrDefault();
             if (result != null)
             {
                 return(result.InsertedId);
             }
             else
             {
                 return(0);
             }
         }
     }
     catch (Exception ex)
     {
         Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.Group, mySession.Current.UserId);
         return(0);
     }
 }