コード例 #1
0
        public long GetMaxMenuRightsId()
        {
            POS_MENU_RIGHTS entity = new POS_MENU_RIGHTS();
            long            id     = 0;

            try
            {
                entity = _objEntityModel.POS_MENU_RIGHTS.OrderByDescending(x => x.MENU_RIGHTS_ID).FirstOrDefault();
                if (entity == null)
                {
                    id = 1;
                }
                else
                {
                    id = entity.MENU_RIGHTS_ID + 1;
                }

                return(id);
            }
            catch (Exception ex)
            {
                ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error);
                throw new DALException();
            }
        }
コード例 #2
0
 public POS_MENU()
 {
     MenuRights       = new POS_MENU_RIGHTS();
     Menus            = new List <ParentMenu>();
     MenuRightsList   = new List <POS_MENU_RIGHTS>();
     ReportRightsList = new List <POS_REPORT_RIGHTS>();
 }
コード例 #3
0
        public int UpdateMenuRights(List <POS_MENU_RIGHTS> lstMenuRights, long userId)
        {
            int isRowsCreated = 0;

            try
            {
                foreach (var item in lstMenuRights)
                {
                    if (item.INSERTION_FLAG == true || item.UPDATION_FLAG == true || item.DELETION_FLAG == true || item.SELECTION_FLAG == true)
                    {
                        POS_MENU_RIGHTS entity = new POS_MENU_RIGHTS();
                        entity.MENU_RIGHTS_ID = GetMaxMenuRightsId();
                        entity.MENU_ID        = item.MENU_ID;
                        entity.USER_ID        = userId;
                        entity.INSERTION_FLAG = item.INSERTION_FLAG;
                        entity.UPDATION_FLAG  = item.UPDATION_FLAG;
                        entity.DELETION_FLAG  = item.DELETION_FLAG;
                        entity.SELECTION_FLAG = item.SELECTION_FLAG;
                        entity.ISPOSTED_FLAG  = false;
                        entity.CREATEDBY      = item.CREATEDBY;
                        entity.CREATEDWHEN    = item.CREATEDWHEN;

                        _objEntityModel.POS_MENU_RIGHTS.Add(entity);
                        isRowsCreated = _objEntityModel.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                // ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error);
                throw new DALException(ex.Message.ToString());
            }
            return(isRowsCreated);
        }