コード例 #1
0
ファイル: ReaderVO.cs プロジェクト: malekula/CirculationSCC
        private void InitReaderRights()
        {
            var       dbr    = new DBReader();
            DataTable rights = dbr.GetReaderRightsById(this.ID);

            if (rights.Rows.Count != 0)
            {
                foreach (DataRow r in rights.Rows)
                {
                    switch (r["IDReaderRight"].ToString())
                    {
                    case "1":
                        this.ReaderRights |= Rights.BRIT;
                        break;

                    case "2":
                        this.ReaderRights |= Rights.HALL;
                        break;

                    case "3":
                        this.ReaderRights |= Rights.EMPL;
                        this.IDDepartment  = r["IDOrganization"].ToString();
                        break;

                    case "4":
                        this.ReaderRights |= Rights.ABON;
                        break;

                    case "5":
                        this.ReaderRights |= Rights.PERS;
                        break;

                    case "6":
                        this.ReaderRights |= Rights.COLL;
                        break;

                    default:
                        this.ReaderRights |= Rights.HALL;
                        break;
                    }
                }
            }
        }
コード例 #2
0
ファイル: ReaderVO.cs プロジェクト: malekula/CirculationSCC
        public ReaderVO(int ID)
        {
            DBReader  dbr    = new DBReader();
            DataRow   reader = dbr.GetReaderByID(ID);
            DataTable rights = dbr.GetReaderRightsById(ID);

            if (reader == null)
            {
                return;
            }
            this.ID     = (int)reader["NumberReader"];
            this.Family = reader["FamilyName"].ToString();
            this.Father = reader["FatherName"].ToString();
            this.Name   = reader["Name"].ToString();
            this.FIO    = this.Family + " " + this.Name + " " + this.Father;
            if (reader["fotka"].GetType() != typeof(System.DBNull))
            {
                byte[] data = (byte[])reader["fotka"];

                if (data != null)
                {
                    using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
                    {
                        ms.Write(data, 0, data.Length);
                        ms.Position = 0L;

                        this.Photo = new Bitmap(ms);
                    }
                }
            }
            else
            {
                this.Photo = Properties.Resources.nofoto;
            }
            InitReaderRights();
        }