Beispiel #1
0
        public static List <Row> Filter_Shifts(int mouth, int week)
        {
            List <Row> filterShifts = new List <Row>();
            Row        shift;
            DateTime   time, start, end;

            foreach (Row row in shifts)
            {
                try
                {
                    time  = DateTime.Parse(row.GetColValue("day").ToString());
                    start = DateTime.Parse(row.GetColValue("start_shift").ToString());
                    end   = DateTime.Parse(row.GetColValue("end_shift").ToString());
                    if (time.Month == mouth)
                    {
                        if (week == -1 || (week + 1) * 7 > time.Day && week * 7 < time.Day)
                        {
                            shift = new Row();
                            shift.AddColume(new Col("day", $"{time.Day}/{time.Month}"));
                            shift.AddColume(new Col("hours", end.Hour - start.Hour));
                            filterShifts.Add(shift);
                        }
                    }
                }
                catch
                {
                }
            }
            return(filterShifts);
        }
Beispiel #2
0
        public static List <Row> Filter_Shifts(DateTime value, int id)
        {
            List <Row> filterShifts = new List <Row>();
            Row        shift;
            DateTime   time, start, end;

            foreach (Row row in Assets.shifts)
            {
                try
                {
                    if (id != -1 && row.GetColValue("id_worker").ToString() != id.ToString())
                    {
                        continue;
                    }
                    time  = DateTime.Parse(row.GetColValue("day").ToString());
                    start = DateTime.Parse(row.GetColValue("start_shift").ToString());
                    end   = DateTime.Parse(row.GetColValue("end_shift").ToString());
                    if (time.Month == value.Month && time.Year == value.Year)
                    {
                        shift = new Row();
                        shift.AddColume(new Col("id", row.GetColValue("id_worker")));
                        shift.AddColume(new Col("day", $"{time.Day}/{time.Month}"));
                        shift.AddColume(new Col("hours", end.Hour - start.Hour));
                        filterShifts.Add(shift);
                    }
                }
                catch (Exception err)
                {
                }
            }
            return(Organize(filterShifts));
        }
Beispiel #3
0
    public static List <Row> getObjects(string command)
    {
        List <Row> Rows = new List <Row>();

        try
        {
            ConnectionState(true);
            OleCommand = new OleDbCommand(command, Connection);
            Reader     = OleCommand.ExecuteReader();
            while (Reader.Read())
            {
                Row row     = new Row();
                var table   = Reader.GetSchemaTable();
                var nameCol = table.Columns["ColumnName"];
                var fields  = new List <string>();
                foreach (DataRow r in table.Rows)
                {
                    fields.Add(r[nameCol].ToString());
                }
                for (int i = 0; i < Reader.FieldCount; i++)
                {
                    row.AddColume(new Col(fields[i], Reader[i].ToString()));
                }
                Rows.Add(row);
            }
            Reader.Close();
            ConnectionState(false);
            return(Rows);
        }
        catch
        {
            ConnectionState(false);
            return(null);
        }
    }
Beispiel #4
0
        public static bool updateWorker()
        {
            Row       columes = new Row( );
            Condition con     = new Condition("id", int.Parse(worker.GetColValue("id").ToString()));

            columes.AddColume(new Col("password", worker.GetColValue("password")));
            return(Access.Execute(SQL_Queries.Update("workers", columes.GetColumes(), con)));
        }