Ejemplo n.º 1
0
        private MultiSelectList GenerateMultiSelectListWithServices()
        {
            var             serviceList = selectServices.GetRowsForTable(SGetAllRowsFromSpecificTable.ServicesSelectAllRowsQuery());
            List <Services> listS       = new List <Services>()
            {
                new Services {
                    services_id = 0, services_name = "Wybierz usługę"
                }
            };

            if (!serviceList.Any())
            {
                return(new MultiSelectList(listS.Select(x => new
                {
                    key = x.services_id,
                    value = x.services_name
                }), "key", "value"));
            }
            foreach (var i in serviceList)
            {
                listS.Add(i);
            }
            return(new MultiSelectList(listS.Select(x => new
            {
                key = x.services_id,
                value = x.services_name
            }), "key", "value"));
        }
Ejemplo n.º 2
0
        public int InsertObjectToDB(Services dataObject)
        {
            var    insertServices = SInsertScripts.SqlLiteDBInsertServices(dataObject);
            string result         = DBConnectAndExecute.ExecuteQuery(insertServices);

            if (result != string.Empty)
            {
                return(-1);
            }
            var lastAddedServices = selectServices.GetRowsForTable(SGetAllRowsFromSpecificTable.ServicesSelectAllRowsQuery())
                                    .Where(x => x.services_id == dataObject.services_id).First();

            return(lastAddedServices.services_id);
        }
Ejemplo n.º 3
0
        public static void SetDataToCmbServices(ComboBox cmbListServices)
        {
            selectServices = new SelectServices();
            List <Services> listServices = new List <Services>();

            listServices.Add(new Services {
                services_id = 0, services_name = "usługa"
            });
            foreach (var i in selectServices.GetRowsForTable(SGetAllRowsFromSpecificTable.ServicesSelectAllRowsQuery()))
            {
                listServices.Add(i);
            }
            cmbListServices.DataSource    = listServices;
            cmbListServices.DisplayMember = "services_name";
            cmbListServices.ValueMember   = "services_id";
        }
Ejemplo n.º 4
0
        public List <VReservation> GetVReservations()
        {
            var clientsList     = selectClient.GetRowsForTable(SGetAllRowsFromSpecificTable.ClientSelectAllRowsQuery());
            var servicesList    = selectServices.GetRowsForTable(SGetAllRowsFromSpecificTable.ServicesSelectAllRowsQuery());
            var reservationList = selectReservation.GetRowsForTable(SGetAllRowsFromSpecificTable.ReservationSelectAllRowsQuery());
            var employeeList    = selectEmployee.GetRowsForTable(SGetAllRowsFromSpecificTable.EmployeeSelectAllRowsQuery());

            var result = reservationList.Join(clientsList,
                                              x => x.client_id,
                                              y => y.client_id,
                                              (x, y) => new
            {
                clName  = y.client_name,
                clSname = y.client_sname,
                clPhone = y.client_phone,
                clDesc  = y.client_description,
                resId   = x.reservation_id,
                resDate = x.reservation_date,
                resTime = x.reservation_time,
                serId   = x.services_id,
                empID   = x.employee_id,
                clId    = y.client_id
            })
                         .Join(servicesList,
                               x => x.serId,
                               y => y.services_id,
                               (x, y) => new
            {
                x.resId,
                x.resDate,
                x.resTime,
                x.clName,
                x.clSname,
                x.clPhone,
                x.clDesc,
                y.services_name,
                y.services_id,
                x.empID,
                x.clId
            })
                         .Join(employeeList,
                               x => x.empID,
                               y => y.employee_id,
                               (x, y) => new
            {
                x.clName,
                x.clSname,
                x.clPhone,
                x.clDesc,
                x.resId,
                x.resDate,
                x.resTime,
                x.services_id,
                x.services_name,
                empName = y.employee_name,
                x.empID,
                x.clId
            }).Select(x => new VReservation
            {
                reservation_id     = x.resId,
                reservation_date   = x.resDate,
                reservation_time   = x.resTime,
                client_name        = x.clName,
                client_sname       = x.clSname,
                client_phone       = x.clPhone,
                client_description = x.clDesc,
                services_name      = x.services_name,
                services_id        = x.services_id,
                employee_name      = x.empName,
                client_id          = x.clId,
                employee_id        = x.empID,
                client_data        = x.clName + " " + x.clSname + " " + x.clPhone + " " + x.clDesc
            }).OrderByDescending(x => x.reservation_date.ToShortDateString()).ThenByDescending(y => y.reservation_time).ToList();

            return(result);
        }