Beispiel #1
0
        public static void DeleteWorkTime(WorkType workType, int idEmployee, DateTime date, ConnectionToDB disconnect = ConnectionToDB.disconnect)
        {
            string select = String.Empty;

            switch (workType)
            {
            case WorkType.work:
                select = "delete praca where id_pracownika=" + idEmployee +
                         " AND datepart(year,data)=" + date.Year + " AND datepart(month,data)=" + date.Month + " AND datepart(day,data)=" + date.Day;
                break;

            case WorkType.dayOff:
                select = "delete urlop where id_pracownika=" + idEmployee +
                         " AND datepart(year,data)=" + date.Year + " AND datepart(month,data)=" + date.Month + " AND datepart(day,data)=" + date.Day;
                break;

            case WorkType.illness:
                select = "delete choroba where id_pracownika=" + idEmployee +
                         " AND datepart(year,data)=" + date.Year + " AND datepart(month,data)=" + date.Month + " AND datepart(day,data)=" + date.Day;
                break;

            default:
                break;
            }

            Database.Save(select, disconnect);
            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.dodawanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.praca, select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Beispiel #2
0
        public static void AddWorkTime(IWorkTime workTime, ConnectionToDB disconnect = ConnectionToDB.disconnect)
        {
            string select = String.Empty;

            if (workTime is Work)
            // if (typeof(Work).IsInstanceOfType(workTime))
            {
                Work work = (Work)workTime;
                select = "insert into praca values('" + work.Date.ToString("d", DateFormat.TakeDateFormat()) + "'" +
                         ",'" + work.IdEmployee + "','" + work.StartTime.ToString("d", DateFormat.TakeDateFormat()) + " " + work.StartTime.ToString("T", DateFormat.TakeDateFormat()) +
                         "','" + work.StopTime.ToString("d", DateFormat.TakeDateFormat()) + " " + work.StopTime.ToString("T", DateFormat.TakeDateFormat()) + "')";
            }
            if (workTime is Illness)
            {
                Illness illness = (Illness)workTime;
                select = "insert into choroba values('" + illness.IdEmployee + "'" +
                         ",'" + illness.Date.ToString("d", DateFormat.TakeDateFormat()) + "','" + illness.IdIllnessType + "')";
            }
            if (workTime is DayOff)
            {
                DayOff dayOff = (DayOff)workTime;
                select = "insert into urlop values('" + dayOff.IdEmployee + "'" +
                         ",'" + dayOff.Date.ToString("d", DateFormat.TakeDateFormat()) + "','" + dayOff.IdTypeDayOff + "')";
            }

            Database.Save(select, disconnect);
            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.dodawanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.praca, select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Beispiel #3
0
        public static void DeleteLoan(int idLoan, ConnectionToDB disconnect)
        {
            string select = "delete pozyczka where id_pozyczki=" + idLoan;

            Database.Save(select, disconnect);
            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.usuwanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.pozyczka,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Beispiel #4
0
        public static void Delete(int idAddition, ConnectionToDB disconnect)
        {
            string select = "delete dodatek where id_dodatku=" + idAddition;

            Database.Save(select, disconnect);
            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.usuwanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.dodatek,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
        public void Delete(int id, ConnectionToDB disconnect = ConnectionToDB.disconnect)
        {
            string select = "delete pracownik where id_pracownika=" + id;

            Database.Save(select, disconnect);

            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.usuwanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.pracownik,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Beispiel #6
0
        /// <summary>
        /// Zapisuje ustawienia tabeli pożyczki do bazy danych
        /// </summary>
        /// <param name="lista"></param>
        /// <param name="z"></param>
        public void SaveSettings(SetLoan p, ConnectionToDB disconnect)
        {
            string select = "update ustawienia set sort_kolumna_poz='" + p.SortColumnIndex +
                            "', sort_rodzaj_poz='" + (int)p.SortTypeAscDesc + "', opcje_wys_poz ='" + (int)p.OptionDisplay + "' where id_uzytkownika=" + Polaczenia.idUser;

            Database.Save(select, ConnectionToDB.disconnect);

            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.edycja, DateTime.Now, Polaczenia.ip, NazwaTabeli.ustawienia, select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Beispiel #7
0
        public static void Add(Addition a, ConnectionToDB disconnect)
        {
            string select = "insert into dodatek values('" + a.IdEmployee + "'" +
                            ",'" + a.AdditionType.Id + "','" + a.Amount.ToString().Replace(',', '.') + "','" + a.Date.ToString("d", DateFormat.TakeDateFormat()) + "','" + a.OtherInfo + "')";

            Database.Save(select, disconnect);
            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.dodawanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.dodatek,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Beispiel #8
0
        public static void EditLoan(Loan l, ConnectionToDB disconnect)
        {
            string select = "update pozyczka set nazwa='" + l.Name + "',kwota = '" + l.Amount.ToString().Replace(',', '.') + "', data = '" +
                            l.Date.ToString("d", DateFormat.TakeDateFormat()) + "', ile_pobierac = '" + l.InstallmentLoan.ToString().Replace(',', '.') + "', inne = '" + l.OtherInfo + "' where id_pozyczki='" + l.IdLoan + "'";

            Database.Save(select, disconnect);

            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.edycja, DateTime.Now, Polaczenia.ip, NazwaTabeli.pozyczka,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Beispiel #9
0
        public static void AddLoan(Loan l, ConnectionToDB disconnect)
        {
            string select = "insert into pozyczka (id_pracownika, nazwa, kwota, data, ile_pobierac, inne, czy_splacone)values('" +
                            l.IdEmployee + "','" + l.Name + "','" + l.Amount.ToString().Replace(',', '.') + "','" + l.Date.ToString("d", DateFormat.TakeDateFormat()) + "','" + l.InstallmentLoan.ToString().Replace(',', '.') + "','" +
                            l.OtherInfo + "','" + (int)Enum.Parse(typeof(Payment), l.IsPaid.ToString()) + "')";

            Database.Save(select, disconnect);
            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.dodawanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.pozyczka,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
        public void Add(Employee employee, ConnectionToDB disconnect = ConnectionToDB.disconnect)
        {
            string select = "insert into pracownik values('" +
                            employee.FirstName + "','" + employee.LastName + "','" + employee.Street + "','" + employee.City + "','" + employee.ZipCode + "','" +
                            employee.NumberDaysOffLeft + "','" + employee.NumberDaysOffAnnually + "','" + employee.TelNumber + "','" + employee.OtherInfo + "','" + employee.IsHired + "','" +
                            employee.HiredDate.ToString("d", DateFormat.TakeDateFormat()) + "','" + employee.ReleaseDate.ToString("d", DateFormat.TakeDateFormat()) + "','" + employee.NextMmedicalExaminationDate.ToString("d", DateFormat.TakeDateFormat()) + "','"
                            + employee.NextBhpTrainingDate.ToString("d", DateFormat.TakeDateFormat()) + "','" + employee.EMail + "','" + employee.PartTimeJob + "','" + employee.IsManagement + "')";

            Database.Save(select, disconnect);
            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.dodawanie, DateTime.Now, Polaczenia.ip, NazwaTabeli.pracownik, select), disconnect == ConnectionToDB.disconnect ? true : false);
        }
Beispiel #11
0
        public static void Edit(Addition a, ConnectionToDB disconnect)
        {
            string select = "update dodatek set kwota='" + a.Amount.ToString().Replace(',', '.') + "', data='"
                            + a.Date.ToString("d", DateFormat.TakeDateFormat()) + "',inne='" + a.OtherInfo + "'where id_dodatku = '" + a.Id + "'";

            Database.Save(select, disconnect);

            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.edycja, DateTime.Now, Polaczenia.ip, NazwaTabeli.dodatek,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
            //odłączenie od bazy
            Polaczenia.OdlaczenieOdBazy();
        }
        public void Edit(Employee employee, ConnectionToDB disconnect = ConnectionToDB.disconnect)
        {
            string select = "update pracownik set imie='" + employee.FirstName + "',nazwisko = '" +
                            employee.LastName + "', ulica = '" + employee.Street + "', miasto = '" + employee.City + "', kod = '" + employee.ZipCode
                            + "', urlop_pozostaly = '" + employee.NumberDaysOffLeft.ToString().Replace(',', '.') + "', wymiar_urlopu = '" + employee.NumberDaysOffAnnually + "', numer = '" + employee.TelNumber
                            + "',inne = '" + employee.OtherInfo + "',data_zatrudnienia = '" + employee.HiredDate.ToString("d", DateFormat.TakeDateFormat()) + "',data_zwolnienia = '" + employee.ReleaseDate.ToString("d", DateFormat.TakeDateFormat())
                            + "',data_nast_badania_lek = '" + employee.NextMmedicalExaminationDate.ToString("d", DateFormat.TakeDateFormat()) + "',data_nast_szkolenia_BHP = '" + employee.NextBhpTrainingDate.ToString("d", DateFormat.TakeDateFormat())
                            + "',email = '" + employee.EMail + "',pol_etatu = '" + employee.PartTimeJob + "',czy_kadra = '" + employee.IsManagement + "' where id_pracownika = '" + employee.IdEmployee + "'";

            Database.Save(select, disconnect);

            //log
            LogSys.DodanieLoguSystemu(new LogSys(Polaczenia.idUser, RodzajZdarzenia.edycja, DateTime.Now, Polaczenia.ip, NazwaTabeli.pracownik,
                                                 select), disconnect == ConnectionToDB.disconnect ? true : false);
        }