Beispiel #1
0
    public void addRequest(requestDTO request)
    {
        DbConnect db = new DbConnect();

        db.sqlConnection.Open();

        String query = "INSERT INTO bookland.request_info ( `uid`, `book_name`, `author_name`, `book_type`, `book_edition`)  VALUES ('" + request.USERID + "','" + request.BOOKNAME + "','" + request.AUTHORNAME + "','" + request.BOOKTYPE + "','" + request.BOOKEDITION + "')";

        System.Diagnostics.Debug.WriteLine(query);

        db.sqlCommand = new MySqlCommand(query, db.sqlConnection);

        db.sqlCommand.ExecuteNonQuery();

        db.sqlConnection.Close();
    }
        public List <requestDTO> GetRequestByCodeInstatition(int id)
        {
            List <request> requestList = requestDAL.GetRequestByCodeInstation(id);

            if (requestList == null)
            {
                return(new List <requestDTO>());
            }
            List <requestDTO> requestDTOList = new List <requestDTO>();

            requestDTOList.ForEach(x =>
            {
                requestDTO r = new requestDTO();
                r.code       = x.code;
                r.from_hour  = x.from_hour;
                r.id_parent  = x.id_parent;
                r.to_hour    = x.to_hour;
                requestDTOList.Add(r);
            });
            return(requestDTOList);
        }
        public List <requestDTO> GetAllRequest()
        {
            List <request> requestList = requestDAL.GetAllRequest();

            if (requestList == null)
            {
                return(new List <requestDTO>());
            }
            List <requestDTO> requestListDTO = new List <requestDTO>();

            requestList.ForEach(x =>
            {
                requestDTO r = new requestDTO();
                r.code       = x.code;
                r.from_hour  = x.from_hour;
                r.id_parent  = x.id_parent;
                r.to_hour    = x.to_hour;
                requestListDTO.Add(r);
            });
            return(requestListDTO);
        }
        //מוסיפה בקשות מקובץ אקסל
        public void addRequestFromExcel()
        {
            requestDTO   r    = new requestDTO();
            StreamReader read = new StreamReader(@"d:\request.csv", Encoding.Default);
            string       str  = read.ReadToEnd();

            string[] arr = str.Split('\n');
            for (int i = 0; i < arr.Length; i++)
            {
                int      j    = 0;
                string[] arr1 = arr[i].Split(',');
                r.code      = int.Parse(arr1[j++]);
                r.id_parent = arr1[j++];
                r.from_hour = TimeSpan.Parse(arr1[j++]);
                r.to_hour   = TimeSpan.Parse(arr1[j++]);
                requestBL rBL = new requestBL();
                rBL.AddRequest(r);
                Console.WriteLine();
            }
            Console.ReadLine();
        }
        //עדכון

        public void UpdateRequest(requestDTO request)
        {
            var requestMapper = iMapper.Map <requestDTO, request>(request);

            requestDAL.UpdateRequest(requestMapper);
        }
        public int AddRequest(requestDTO request)
        {
            var requestMapper = iMapper.Map <requestDTO, request>(request);

            return(requestDAL.AddRequest(requestMapper));
        }
        //בדיקה האם בקשה אפשרית
        public Boolean check(requestDTO request)
        {
            var requestMapper = iMapper.Map <requestDTO, request>(request);

            return(requestDAL.check(requestMapper));
        }
Beispiel #8
0
        public void Put(requestDTO requestDTO)
        {
            requestBL requestListBL = new requestBL();

            requestListBL.UpdateRequest(requestDTO);
        }
Beispiel #9
0
        public Boolean check(requestDTO request)
        {
            requestBL requestListBL = new requestBL();

            return(requestListBL.check(request));
        }
Beispiel #10
0
        public void Post(requestDTO request)
        {
            requestBL requestListBL = new requestBL();

            requestListBL.AddRequest(request);
        }