Example #1
0
 public ResponseDTO GetListModule(string orgCode)
 {
     try
     {
         var data = common.GetAllModule().ToList();
         List <TblMasterMenu> lstMenu = new List <TblMasterMenu>();
         foreach (var item in data[0])
         {
             TblMasterMenu tblMasterMenu = new TblMasterMenu();
             tblMasterMenu = item as TblMasterMenu;
             if (tblMasterMenu.MenuName == EncryptionConstant.ADMIN_USER_NAME)
             {
                 tblMasterMenu.MenuCode = EncryptionConstant.CIMS;
                 lstMenu.Add(tblMasterMenu);
             }
             else
             {
                 lstMenu.Add(tblMasterMenu);
             }
         }
         return(new ResponseDTO()
         {
             StatusCode = 200, Response = lstMenu
         });
     }
     catch (Exception ex)
     {
         return(new ResponseDTO()
         {
             StatusCode = 500, Response = ex.Message
         });
     }
 }
Example #2
0
        public async Task <ResponseDTO> GetListAttributesWithParentCode(string parentCode, string orgCode)
        {
            try
            {
                var moduleName = GetListModule(EncryptionConstant.MASTER).Response;
                List <TblMasterMenu> lstMenu = new List <TblMasterMenu>();
                foreach (var item in moduleName)
                {
                    TblMasterMenu tblMasterMenu = new TblMasterMenu();
                    tblMasterMenu = item as TblMasterMenu;
                    lstMenu.Add(tblMasterMenu);
                }
                if (parentCode == EncryptionConstant.ADMIN_USER)
                {
                    List <AttributeDTO> lstTblMasterMenus = new List <AttributeDTO>();
                    for (int i = 0; i < lst.Count; i++)
                    {
                        AttributeDTO tblMasterMenu = new AttributeDTO();
                        tblMasterMenu.AttributeCode  = (i + 1).ToString();
                        tblMasterMenu.AttributeLabel = lst[i];
                        tblMasterMenu.ModuleName     = lstMenu.Where(x => x.MenuCode == EncryptionConstant.ADMIN_USER).FirstOrDefault().MenuName;
                        lstTblMasterMenus.Add(tblMasterMenu);
                    }
                    var lstMenuAdminUser = lstTblMasterMenus.Where(x => !db.TblEncryption.Where(c => c.AttributeCode == x.AttributeCode && c.OrgCode == orgCode).Select(c => c.AttributeCode).Contains(x.AttributeCode)).ToList();
                    return(new ResponseDTO()
                    {
                        StatusCode = 200, Response = lstMenuAdminUser
                    });
                }
                else
                {
                    var lstAttribute = await db.TblVocattributes.Where(x => x.ModuleParent == parentCode && x.IsReuse != true).AsNoTracking().ToListAsync();

                    var data = lstAttribute.Where(x => !db.TblEncryption.Where(c => c.AttributeCode == x.AttributeCode && c.ParentCode == x.ModuleParent).Select(c => c.AttributeCode).Contains(x.AttributeCode)).Select(x => new AttributeDTO()
                    {
                        AttributeCode  = x.AttributeCode,
                        AttributeLabel = x.AttributeLabel,
                        ModuleName     = lstMenu.Where(c => c.MenuCode == parentCode).FirstOrDefault().MenuName
                    }).ToList();
                    return(new ResponseDTO()
                    {
                        StatusCode = 200, Response = data
                    });
                }
            }
            catch (Exception ex)
            {
                return(new ResponseDTO()
                {
                    StatusCode = 500, Response = ex.Message
                });
            }
        }
Example #3
0
        public async Task <ResponseDTO> GetListAttributesEncryption(string orgCode)
        {
            try
            {
                MenuDTO menuDTO = new MenuDTO();
                List <TblEncryption> tblEncryptions = new List <TblEncryption>();
                menuDTO.SchedulerTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 02, 00, 00);
                var moduleName = GetListModule(EncryptionConstant.MASTER).Response;
                List <TblMasterMenu> lstMenu = new List <TblMasterMenu>();
                foreach (var item in moduleName)
                {
                    TblMasterMenu tblMasterMenu = new TblMasterMenu();
                    tblMasterMenu = item as TblMasterMenu;
                    lstMenu.Add(tblMasterMenu);
                }
                var orderByCreateDate = await db.TblEncryption.Where(x => x.UpdateDate == null).OrderByDescending(x => x.CreateDate).ToListAsync();

                var orderByUpdateDate = await db.TblEncryption.Where(x => x.UpdateDate != null).OrderByDescending(x => x.UpdateDate).ToListAsync();

                tblEncryptions.AddRange(orderByCreateDate);
                tblEncryptions.AddRange(orderByUpdateDate);
                menuDTO.AttributesEncryption = tblEncryptions.Select(x => new EncryptionDTO()
                {
                    AttributeCode    = x.AttributeCode,
                    AttributeLabel   = x.AttributeLabel,
                    ModuleName       = x.ModuleName,
                    MenuCode         = x.ParentCode,
                    UpdateDate       = x.UpdateDate,
                    ExecuteTime      = x.IsDone == true ? null : common.GetTimeExecuteEncrpytion(x.UpdateDate == null ? DateTime.Now : x.UpdateDate),
                    EncryptionStatus = x.EncryptionStatus
                }).ToList();
                return(new ResponseDTO()
                {
                    StatusCode = 200, Response = menuDTO
                });
            }
            catch (Exception ex)
            {
                return(new ResponseDTO()
                {
                    StatusCode = 500, Response = ex.Message
                });
            }
        }