예제 #1
0
        public Role(string strRoleID)
        {
            lstFunction = new List <Function>(0);

            DataTable dt = new Data.Role().GetRole(strRoleID);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    RoleID = string.Empty + dt.Rows[0]["ME02_ROLEID"].ToString();
                    VnName = string.Empty + dt.Rows[0]["ME02_VNNAME"].ToString();
                    EnName = string.Empty + dt.Rows[0]["ME02_ENNAME"].ToString();
                    lstFunction.Clear();
                    foreach (RoleFunction oRoleFunction in new RoleFunction().GetRoleFunctions(strRoleID))
                    {
                        Function oFunction = new Function(oRoleFunction.FunctionID);
                        if (!lstFunction.Contains(oFunction))
                        {
                            lstFunction.Add(oFunction);
                        }
                    }
                }
            }
        }
예제 #2
0
 public UserModel(Data.User user, Data.Role role)
 {
     Email     = user.Email;
     FirstName = user.FirstName;
     LastName  = user.LastName;
     Password  = user.Password;
     Role      = new RoleModel(role);
 }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         JiaJiao.Data.Role role = new Data.Role();
         var ds = role.GetRoleList();
         DropDownList1.DataSource = ds.Tables["Roles"];
         DropDownList1.DataBind();
     }
 }
예제 #4
0
파일: Role.cs 프로젝트: screwcat/pipe
        public Role(int currentRoleId)
        {
            DataRow row = new Data.Role(PubConstant.ConnectionString).Retrieve(currentRoleId);

            this.roleId      = currentRoleId;
            this.description = (string)row["Description"];
            Permission permission = new Permission(PubConstant.ConnectionString);

            this.permissions   = permission.GetPermissionList(currentRoleId);
            this.nopermissions = permission.GetNoPermissionList(currentRoleId);
        }
예제 #5
0
        public bool Save(IDb db)
        {
            var role = db.Roles.FirstOrDefault(r => r.Id == Role.Id);

            if (role == null)
            {
                Role.Id             = Role.Id != Guid.Empty ? Role.Id : Guid.NewGuid();
                Role.NormalizedName = !string.IsNullOrEmpty(Role.NormalizedName) ? Role.NormalizedName.ToUpper() : Role.Name.ToUpper();

                role = new Data.Role
                {
                    Id = Role.Id
                };
                db.Roles.Add(role);
            }
            role.Name           = Role.Name;
            role.NormalizedName = Role.NormalizedName;

            var claims = db.RoleClaims.Where(r => r.RoleId == role.Id).ToList();
            var delete = new List <IdentityRoleClaim <Guid> >();
            var add    = new List <IdentityRoleClaim <Guid> >();

            foreach (var old in claims)
            {
                if (!SelectedClaims.Contains(old.ClaimType))
                {
                    delete.Add(old);
                }
            }

            foreach (var selected in SelectedClaims)
            {
                if (!claims.Any(c => c.ClaimType == selected))
                {
                    add.Add(new IdentityRoleClaim <Guid>()
                    {
                        RoleId     = role.Id,
                        ClaimType  = selected,
                        ClaimValue = selected
                    });
                }
            }

            db.RoleClaims.RemoveRange(delete);
            db.RoleClaims.AddRange(add);

            db.SaveChanges();

            return(true);
        }
예제 #6
0
 private void ShowInfo(int ID)
 {
     JiaJiao.BLL.Teacher bll = new JiaJiao.BLL.Teacher();
     JiaJiao.Model.Teacher model = bll.GetModel(ID);
     this.lblID.Text = model.ID.ToString();
     this.lblTeacherName.Text = model.TeacherName;
     this.lblTeacherTel.Text = model.TeacherTel;
     this.lblTeacherEmail.Text = model.TeacherEmail;
     this.lblTeacherAddress.Text = model.TeacherAddress;
     this.lblTeacherDescribe.Text = model.TeacherDescribe;
     Image1.ImageUrl = model.Image;
     JiaJiao.Data.Role role = new Data.Role();
        var dr=  role.Retrieve(model.RoleId.Value);
        this.lblRoleId.Text = dr[1].ToString();
 }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    int ID = (Convert.ToInt32(Request.Params["id"]));

                    JiaJiao.Data.Role role = new Data.Role();
                    var ds = role.GetRoleList();
                    DropDownList1.DataSource = ds.Tables["Roles"];
                    DropDownList1.DataBind();
                    DropDownList1.SelectedValue = ID.ToString();
                    ShowInfo(ID);
                }
            }
        }
예제 #8
0
        public Role[] GetRoles()
        {
            List <Role> lstRole = new List <Role>(0);
            DataTable   dt      = new Data.Role().GetRoles();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    Role oRole = new Role();
                    oRole.RoleID = string.Empty + dr["ME02_ROLEID"].ToString();
                    oRole.VnName = string.Empty + dr["ME02_VNNAME"].ToString();
                    oRole.EnName = string.Empty + dr["ME02_ENNAME"].ToString();
                    if (!lstRole.Contains(oRole))
                    {
                        lstRole.Add(oRole);
                    }
                }
            }
            return(lstRole.ToArray());
        }
예제 #9
0
        public void CreateRole()
        {
            CreatedRoleTextBox.Text = "";
            var db   = new Data.SecurityEntities();
            var role = new Data.Role()
            {
                ApplicationId   = new Guid(ApplicationIdTextBox.Text),
                Description     = DescriptionTextBox.Text,
                LoweredRoleName = RoleNameTextBox.Text.ToLower(),
                RoleId          = new Guid(RoleIdTextBox.Text),
                RoleName        = RoleNameTextBox.Text,
            };

            db.Roles.AddObject(role);
            db.SaveChanges();
            switch (PostCreateMode)
            {
            case PostCreateModeEnum.None:
                break;

            case PostCreateModeEnum.Create:
                PrepareToCreate();
                break;

            case PostCreateModeEnum.Update:
                PrepareToUpdate();
                LoadRole(role.RoleId);
                break;

            default:
                break;
            }
            CreateStatusLabel.ForeColor = System.Drawing.Color.Green;
            CreateStatusLabel.Text      = "Role '" + role.RoleName + "' was created.";
            CreatedRoleTextBox.Text     = role.RoleName;
            RiseCreated(new RoleEditEventArgs(role));
        }
예제 #10
0
 /// <summary>
 /// 获取所有角色
 /// </summary>
 public static DataSet GetRoleList()
 {
     Data.Role dataRole = new Data.Role();
     return(dataRole.GetRoleList());
 }
예제 #11
0
 public RoleModel(Data.Role role)
 {
     RoleId   = role.RoleId;
     RoleName = role.RoleName;
 }
예제 #12
0
        /// <summary>
        /// Ritorna un nuovo oggetto ProtocolInitializer per la protocollazione automatica di una UDS
        /// </summary>
        public ProtocolInitializer GetProtocolInitializer(UDSDto dto)
        {
            ProtocolInitializer protInitializer = new ProtocolInitializer();

            // Oggetto
            protInitializer.Subject = dto.UDSModel.Model.Subject.Value;
            if (dto.UDSModel.Model.ProtocolDirectionSpecified)
            {
                switch (dto.UDSModel.Model.ProtocolDirection)
                {
                case ProtocolDirectionType.None:
                    break;

                case ProtocolDirectionType.In:
                {
                    protInitializer.ProtocolType = -1;
                    break;
                }

                case ProtocolDirectionType.Out:
                {
                    protInitializer.ProtocolType = 1;
                    break;
                }

                case ProtocolDirectionType.InternalOffice:
                {
                    protInitializer.ProtocolType = 0;
                    break;
                }

                default:
                    break;
                }
            }

            // Classificazione
            if (dto.UDSModel.Model.Category.DefaultEnabled)
            {
                int idCategory = int.Parse(dto.UDSModel.Model.Category.IdCategory);
                protInitializer.Category = FacadeFactory.Instance.CategoryFacade.GetById(idCategory);
            }

            // Gestione documenti
            if (dto.UDSModel.Model.Documents != null)
            {
                // Documento principale
                ICollection <BiblosDocumentInfo> mainDocuments = FillUDSDocuments(dto.UDSModel.Model.Documents.Document);
                if (mainDocuments.Count > 0)
                {
                    protInitializer.MainDocument = mainDocuments.FirstOrDefault();
                }

                // Allegati
                ICollection <BiblosDocumentInfo> attachments = FillUDSDocuments(dto.UDSModel.Model.Documents.DocumentAttachment);
                if (attachments.Any())
                {
                    protInitializer.Attachments = attachments.Cast <DocumentInfo>().ToList();
                }

                // Annessi
                ICollection <BiblosDocumentInfo> annexed = FillUDSDocuments(dto.UDSModel.Model.Documents.DocumentAnnexed);
                if (annexed.Any())
                {
                    protInitializer.Annexed = annexed.Cast <DocumentInfo>().ToList();
                }
            }

            // Contatti
            protInitializer.Senders    = new List <ContactDTO>();
            protInitializer.Recipients = new List <ContactDTO>();
            if (dto.UDSModel.Model.Contacts != null)
            {
                foreach (Contacts contact in dto.UDSModel.Model.Contacts)
                {
                    ICollection <ContactDTO> contactDtos = FillUDSContacts(contact.ContactInstances).Concat(FillUDSContacts(contact.ContactManualInstances)).ToList();
                    if (contact.ContactType.Equals(Helpers.UDS.ContactType.Sender))
                    {
                        protInitializer.Senders.AddRange(contactDtos);
                    }
                    else
                    {
                        protInitializer.Recipients.AddRange(contactDtos);
                    }
                }
            }

            // Settori
            if (dto.UDSModel.Model.Authorizations != null && dto.UDSModel.Model.Authorizations.Instances != null)
            {
                IList <Data.Role> roles = new List <Data.Role>();
                foreach (AuthorizationInstance auth in dto.UDSModel.Model.Authorizations.Instances)
                {
                    Data.Role role = FacadeFactory.Instance.RoleFacade.GetById(auth.IdAuthorization);
                    roles.Add(role);
                }

                protInitializer.Roles = roles;
            }

            return(protInitializer);
        }
예제 #13
0
 public void Update(Data.Role entity, int LoggedInUserId, int LoggedInOrganizationId)
 {
     base.Update(entity);
     _unitOfWork.Save();
 }
예제 #14
0
 public void Add(Data.Role entity, int LoggedInUserId, int LoggedInOrganizationId)
 {
     entity.Active         = true;
     entity.OrganizationId = LoggedInOrganizationId;
     base.Insert(entity);
 }
        /// <summary>
        /// 获取所有角色
        /// </summary>
		public static DataSet GetRoleList()
		{
			Data.Role dataRole = new Data.Role();
			return dataRole.GetRoleList();
		}
예제 #16
0
파일: Role.cs 프로젝트: screwcat/pipe
 public bool Delete()
 {
     Data.Role role = new Data.Role(PubConstant.ConnectionString);
     return(role.Delete(this.roleId));
 }
예제 #17
0
 public static DataSet GetRoleList()
 {
     Data.Role role = new Data.Role(PubConstant.ConnectionString);
     return(role.GetRoleList());
 }
예제 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                JiaJiao.Data.Role role = new Data.Role();
                var ds = role.GetRoleList();
                DropDownList1.DataSource = ds.Tables["Roles"];
                DropDownList1.DataBind();
                DropDownList1.SelectedValue = Request.Params["id"];
                ShowInfo(int.Parse(Request.Params["id"]));
            }
        }