예제 #1
0
        public DataTable insertForCheckOutMedia(int userId, int mediaId)
        {
            BorrowLogic borrowLogic = new BorrowLogic();
            bool        result      = borrowLogic.insertForCheckOutMedia(userId, mediaId);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #2
0
        public DataTable updateMediaForReturn(int borrowId, int lateFee)
        {
            BorrowLogic borrowLogic = new BorrowLogic();
            bool        result      = borrowLogic.updateMediaForReturn(borrowId, lateFee);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #3
0
        public DataTable insertNewGenre(string genreName)
        {
            MediaLogic mediaLogic = new MediaLogic();
            bool       result     = mediaLogic.insertNewGenre(genreName);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #4
0
        public DataTable deleteBorrowItem(int borrowId)
        {
            BorrowLogic borrowLogic = new BorrowLogic();
            bool        result      = borrowLogic.deleteBorrowItem(borrowId);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #5
0
        public DataTable getGenreExists(int genreId)
        {
            MediaLogic mediaLogic = new MediaLogic();
            bool       result     = mediaLogic.getGenreExists(genreId);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #6
0
        public DataTable deleteUser(int userId)
        {
            UserLogic userLogic = new UserLogic();
            bool      result    = userLogic.deleteUser(userId);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #7
0
        public DataTable deleteReservation(int reservationId)
        {
            ReservedLogic reserveLogic = new ReservedLogic();
            bool          result       = reserveLogic.deleteReservation(reservationId);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #8
0
        public DataTable updateUserPassword(int userId, string newPassword)
        {
            UserLogic userLogic = new UserLogic();
            bool      result    = userLogic.updateUserPassword(userId, newPassword);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #9
0
        public DataTable updateUserAll(int userId, string username, string email, string password, int userLevel)
        {
            UserLogic userLogic = new UserLogic();
            bool      result    = userLogic.updateUserAll(userId, username, email, password, userLevel);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #10
0
        public DataTable getMediaExistsBorrowLogic(int mediaId)
        {
            BorrowLogic borrowLogic = new BorrowLogic();
            bool        result      = borrowLogic.getMediaExists(mediaId);

            IdAndValue x = createBoolIdAndValue(result);

            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #11
0
        public DataTable insertNewReservation(int userId, int mediaId, string dateMonthDayYear)
        {
            ReservedLogic reserveLogic = new ReservedLogic();
            bool          result       = reserveLogic.insertNewReservation(userId, mediaId, dateMonthDayYear);

            IdAndValue x = createBoolIdAndValue(result);


            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #12
0
        public DataTable getGenreIdByName(string genreName)
        {
            MediaLogic mediaLogic = new MediaLogic();
            int        result     = mediaLogic.getGenreIdByName(genreName);

            IdAndValue x = new IdAndValue(result, "left undefined at WebMethod");


            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #13
0
        // functions ------

        public IdAndValue createBoolIdAndValue(bool result)
        {
            IdAndValue temp;

            if (result)
            {
                temp = new IdAndValue(0, "true");
            }
            else
            {
                temp = new IdAndValue(-1, "false");
            }

            return(temp);
        }
예제 #14
0
        public DataTable updateMedia(int id, string title, string genre, string director, string language, int publishYear, int budget)
        {
            MediaLogic mediaLogic = new MediaLogic();

            string[] resultArr = mediaLogic.updateMedia(id, title, genre, director, language, publishYear, budget);

            IdAndValue x = createStrArrIdAndValue(resultArr);


            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #15
0
        public DataTable deleteGenreById(int genId)
        {
            MediaLogic mediaLogic = new MediaLogic();

            string[] resultArr = mediaLogic.deleteGenrebyId(genId);

            IdAndValue x = createStrArrIdAndValue(resultArr);


            //sneaky list IdAndValue of 1 item
            List <IdAndValue> idValList = new List <IdAndValue>();

            idValList.Add(x);

            return(AppUtil.ToDataTable(idValList));
        }
예제 #16
0
        public IdAndValue createStrArrIdAndValue(string[] strArr)

        //recieved strArray:
        //index 0 == boolSTr
        //index 1== ErrorMessay
        {
            IdAndValue temp;

            if (strArr[0] == "true")
            {
                temp = new IdAndValue(0, strArr[1]);
            }
            else
            {
                temp = new IdAndValue(-1, strArr[1]);
            }

            return(temp);
        }
예제 #17
0
        public MainViewModel(OrganizacionLogic organizacionLogic,
                             SectorLogic sectorLogic,
                             RubroLogic rubroLogic,
                             LocalidadLogic localidadLogic,
                             TipoOrganizacionLogic tipoOrganizacionLogic)
        {
            this.organizacionLogic     = organizacionLogic;
            this.sectorLogic           = sectorLogic;
            this.localidadLogic        = localidadLogic;
            this.rubroLogic            = rubroLogic;
            this.tipoOrganizacionLogic = tipoOrganizacionLogic;

            UsuarioIntiStatuses = new ObservableCollection <IdAndValue>();

            var usuarioIntiStatus = new IdAndValue()
            {
                Id    = ((int)UsuarioIntiStatus.UsuarioInti),
                Value = EnumUtils.GetDescription(UsuarioIntiStatus.UsuarioInti)
            };

            var noUsuarioIntiStatus = new IdAndValue()
            {
                Id    = ((int)UsuarioIntiStatus.NoUsuarioInti),
                Value = EnumUtils.GetDescription(UsuarioIntiStatus.NoUsuarioInti)
            };

            var todosStatus = new IdAndValue()
            {
                Id    = ((int)UsuarioIntiStatus.Todos),
                Value = EnumUtils.GetDescription(UsuarioIntiStatus.Todos)
            };

            UsuarioIntiStatuses.Add(usuarioIntiStatus);
            UsuarioIntiStatuses.Add(noUsuarioIntiStatus);
            UsuarioIntiStatuses.Add(todosStatus);

            OrganizacionesFilter = new FilterStatus();

            Organizaciones = new ObservableCollection <OrganizacionHeaderData>();

            InitializationTask = UpdateOrganizacionHeaders();
        }
        // END data table functions -------------



        public bool getBool(System.Data.DataTable dt)
        {
            //IdAndValue class
            //private int id;       0
            //private string value; 1

            // expected return item list of 1
            // option 3 in webservice
            //
            //if (result)
            //{
            //    temp = new IdAndValue(0, "true");
            //}
            //else
            //{
            //    temp = new IdAndValue(-1, "false");
            //}

            int    id    = errorInt;
            string value = errorString;

            foreach (DataRow row in dt.Rows)
            {
                id    = (int)row[0];
                value = (string)row[1];
            }


            IdAndValue temp = new IdAndValue(id, value);


            if (id == 0)   // 0 == true
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }