Example #1
0
        private bool CheckEmployeeRights()
        {
            ReaderRightsInfo rights = ReaderRightsInfo.GetReaderRights(ScannedReader.ID);

            if (rights[ReaderRightsEnum.Employee] == null)
            {
                return(false);
            }
            return(true);
        }
Example #2
0
        private bool CheckFreeAbonementRights()
        {
            ReaderRightsInfo rights = ReaderRightsInfo.GetReaderRights(ScannedReader.ID);

            if (rights[ReaderRightsEnum.FreeAbonement] == null)
            {
                return(false);
            }
            return(true);
        }
Example #3
0
        public void Init(int NumberReader)
        {
            lvRights.Items.Clear();
            ReaderRightsInfo rights = ReaderRightsInfo.GetReaderRights(NumberReader);

            lvRights.Items.Clear();
            foreach (var right in rights.RightsList)
            {
                lvRights.Items.Add($"{right.ToString()} до {right.DateEndReaderRight.ToString("dd.MM.yyyy")}");
            }
        }
Example #4
0
        internal ReaderRightsInfo GetReaderRights(int NumberReader)
        {
            DataTable        table  = dbw.GetReaderRights(NumberReader);
            ReaderRightsInfo result = new ReaderRightsInfo();

            if (table.Rows.Count == 0)
            {
                return(result);
            }


            foreach (DataRow row in table.Rows)
            {
                ReaderRight right = new ReaderRight();
                object      o     = row["DataEndReaderRight"];
                Type        t     = o.GetType();
                right.DateEndReaderRight = (row["DataEndReaderRight"].GetType() != typeof(DBNull)) ? (DateTime)row["DataEndReaderRight"] : DateTime.Now.AddYears(1);
                right.IDOrganization     = (row["IDOrganization"].GetType() == typeof(DBNull)) ? 0 : (int)row["IDOrganization"];
                switch ((int)row["IDReaderRight"])
                {
                case 1:
                    right.ReaderRightValue = ReadersRights.ReaderRightsEnum.BritSovet;
                    break;

                case 2:
                    right.ReaderRightValue = ReadersRights.ReaderRightsEnum.ReadingRoomUser;
                    break;

                case 3:
                    right.ReaderRightValue = ReadersRights.ReaderRightsEnum.Employee;
                    break;

                case 4:
                    right.ReaderRightValue = ReadersRights.ReaderRightsEnum.FreeAbonement;
                    break;

                case 5:
                    right.ReaderRightValue = ReadersRights.ReaderRightsEnum.PaidAbonement;
                    break;

                case 6:
                    right.ReaderRightValue = ReadersRights.ReaderRightsEnum.CollectiveAbonement;
                    break;

                case 7:
                    right.ReaderRightValue = ReadersRights.ReaderRightsEnum.Partner;
                    break;
                }
                result.RightsList.Add(right);
            }
            return(result);
        }
Example #5
0
        public ReaderInfo LoadReader(int Id)
        {
            DataTable  table  = dbw.GetReader(Id);
            ReaderInfo reader = new ReaderInfo();

            if (table.Rows.Count == 0)
            {
                throw new Exception("R004");
            }
            DataRow row = table.Rows[0];

            foreach (DataColumn col in table.Columns)
            {
                switch (col.ColumnName)
                {
                case "NumberReader":
                    reader.NumberReader = (int)row[col];
                    break;

                case "BarCode":
                    reader.BarCode = "R" + row[col].ToString();
                    break;

                case "DateBirth":
                    reader.DateBirth = (DateTime)row[col];
                    break;

                case "DateRegistration":
                    reader.DateRegistration = (DateTime)row[col];
                    break;

                case "DateReRegistration":
                    reader.DateReRegistration = (DateTime)row[col];
                    break;

                case "Email":
                    reader.Email = row[col].ToString();
                    break;

                case "FamilyName":
                    reader.FamilyName = row[col].ToString();
                    break;

                case "Name":
                    reader.Name = row[col].ToString();
                    break;

                case "FatherName":
                    reader.FatherName = row[col].ToString();
                    break;

                case "MobileTelephone":
                    reader.MobileTelephone = row[col].ToString();
                    break;

                case "TypeReader":
                    reader.TypeReader     = ((bool)row[col] == true) ? TypeReader.Remote : TypeReader.Local;
                    reader.IsRemoteReader = (reader.TypeReader == TypeReader.Remote) ? true : false;    //для апи
                    break;

                case "WordReg":
                    reader.Salt = row[col].ToString();
                    break;

                case "Password":
                    reader.HashedPassword = row[col].ToString();
                    break;

                case "RegistrationCountry":
                    reader.RegistrationCountry = (int)row[col];
                    break;

                case "RegistrationRegion":
                    reader.RegistrationRegion = row[col].ToString();
                    break;

                case "RegistrationProvince":
                    reader.RegistrationProvince = row[col].ToString();
                    break;

                case "RegistrationDistrict":
                    reader.RegistrationDistrict = row[col].ToString();
                    break;

                case "RegistrationCity":
                    reader.RegistrationCity = row[col].ToString();
                    break;

                case "RegistrationStreet":
                    reader.RegistrationStreet = row[col].ToString();
                    break;

                case "RegistrationHouse":
                    reader.RegistrationHouse = row[col].ToString();
                    break;

                case "RegistrationFlat":
                    reader.RegistrationFlat = row[col].ToString();
                    break;

                case "LiveRegion":
                    reader.LiveRegion = row[col].ToString();
                    break;

                case "LiveProvince":
                    reader.LiveProvince = row[col].ToString();
                    break;

                case "LiveDistrict":
                    reader.LiveDistrict = row[col].ToString();
                    break;

                case "LiveCity":
                    reader.LiveCity = row[col].ToString();
                    break;

                case "LiveStreet":
                    reader.LiveStreet = row[col].ToString();
                    break;

                case "LiveHouse":
                    reader.LiveHouse = row[col].ToString();
                    break;

                case "LiveFlat":
                    reader.LiveFlat = row[col].ToString();
                    break;

                case "fotka":
                    if (row["fotka"].GetType() != typeof(System.DBNull))
                    {
                        object o    = row["fotka"];
                        byte[] data = (byte[])o;    //row["Photo"];

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

                                reader.Photo = new Bitmap(ms);
                            }
                        }
                    }
                    else
                    {
                        reader.Photo = LibflClassLibrary.Properties.Resources.nofoto;
                    }
                    break;
                }
            }
            reader.Rights = ReaderRightsInfo.GetReaderRights(reader.NumberReader);
            return(reader);
        }