示例#1
0
        private bool CheckUser(ALRD_SecurityUserEntity entity)
        {
            try
            {
                ALRD_SecurityUserEntity objEntity = new ALRD_SecurityUserEntity();
                objEntity = ALRD_SecurityUserService.GetService().GetAll(entity).FirstOrDefault();
                if (objEntity != null && objEntity.COMPID.HasValue)
                {
                    GlobalClass.IsLogin = true;
                    GlobalClass.UserID  = (long)objEntity.COMPID;
                    //GlobalClass.PublicUserID = objEntity.Public_User_ID.HasValue ? (long)objEntity.Public_User_ID : -99;
                    GlobalClass.UserRoleID    = objEntity.RoleID.HasValue ? (long)objEntity.RoleID : -99;
                    GlobalClass.Email         = objEntity.Email;
                    GlobalClass.UserName      = objEntity.UserName;
                    GlobalClass.UserFullName  = objEntity.FullName;
                    GlobalClass.BlockIPAccess = objEntity.BlockIPAccess != null?objEntity.BlockIPAccess.Trim() : string.Empty;

                    GlobalClass.BlockMacAccess = objEntity.BlockMacAccess != null?objEntity.BlockMacAccess.Trim() : string.Empty;

                    GlobalClass.UserRolePermission = ALRD_SecurityRoleDetailService.GetService().GetAll(new ALRD_SecurityRoleDetailEntity {
                        RoleID = GlobalClass.UserRoleID, IsVisible = true
                    }).ToList();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     this.lblException.Text = "";
     this.lblResult.Text    = "";
     try
     {
         List <ALRD_SecurityRoleDetailEntity> entityList = BuiltEntityList();
         long i = ALRD_SecurityRoleDetailService.GetService().SaveList(entityList);
         SuccessMessage = "Information Saved Successfully.";
     }
     catch (Exception ex)
     {
         Error = ex.Message;
     }
 }
        private void LoadEntityList(ALRD_SecurityRoleDetailEntity entity)
        {
            bool updateMode = false;

            try
            {
                FormLocalDataStore = ALRD_SecurityRoleDetailService.GetService().GetAllByRoleID(entity).ToList();

                if (FormLocalDataStore != null && FormLocalDataStore.Count > 0)
                {
                    foreach (ALRD_SecurityRoleDetailEntity ob in FormLocalDataStore)
                    {
                        if (ob.COMPID.HasValue)
                        {
                            updateMode = true;
                        }
                    }
                }

                if (updateMode)
                {
                    btnSave.Text          = "Update";
                    btnSave.OnClientClick = "javascript:return validateSubmit('Do you want to update this information?');";
                    this.CheckButtonPermission(null, btnSave, null);
                }
                else
                {
                    btnSave.Text          = "Save";
                    btnSave.OnClientClick = "javascript:return validateSubmit('Do you want to save this information?');";
                    this.CheckButtonPermission(btnSave, null, null);
                }

                if (MenuLocalDataStore != null && MenuLocalDataStore.Count > 0)
                {
                    this.rptMenuInfo.DataSource = MenuLocalDataStore;
                }
                else
                {
                    this.rptMenuInfo.DataSource = new List <ALRD_SecurityMenuEntity>();
                }
                this.rptMenuInfo.DataBind();
            }
            catch (Exception ex)
            {
                Error = ex.Message;
            }
        }