Exemple #1
0
        public FluturasAngajatObiect FluturasAngajatAdaugare(FluturasAngajatObiect oFluturasAngajat)
        {
            if (GlobalClass.VerificareAccesOperatie("Angajati", "1", "Adaugare"))
            {
                Nullable <int> Id = null, IdEroare = null;
                oFluturasAngajat.Eroare = VerificareDate(oFluturasAngajat);

                if (oFluturasAngajat.Eroare == "")
                {
                    DateTime             DataFluturas  = DateTime.ParseExact(oFluturasAngajat.DataFluturas, "MM.yyyy", null, System.Globalization.DateTimeStyles.None);
                    DataClassWbmOlimpias dcWbmOlimpias = new DataClassWbmOlimpias();
                    dcWbmOlimpias.FluturasAngajatAdaugare(Convert.ToInt32(oFluturasAngajat.IdAngajat), DataFluturas, Convert.ToInt32(oFluturasAngajat.IdFisier), Convert.ToInt32("1"), ref Id, ref IdEroare);
                    oFluturasAngajat.Eroare = InterpretareEroare(IdEroare.ToString());
                    oFluturasAngajat.Id     = Id.ToString();
                }
                if (oFluturasAngajat.Eroare != "")
                {
                    oFluturasAngajat.Id = "";
                }
            }
            else
            {
                oFluturasAngajat.Eroare = "Nu aveti drept de adaugare!";
            }
            return(oFluturasAngajat);
        }
Exemple #2
0
        private string VerificareDate(FluturasAngajatObiect oFluturasAngajat)
        {
            string   Eroare = "";
            DateTime dateTime;

            if (!DateTime.TryParseExact(oFluturasAngajat.DataFluturas, "MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dateTime))
            {
                Eroare = InterpretareEroare("");
            }
            return(Eroare);
        }
Exemple #3
0
        public FluturaseAngajatObiect FluturaseAngajatLista(FiltruFluturaseAngajatObiect oFiltruFluturaseAngajat, int PaginaCurenta, string IdAngajat)
        {
            FluturaseAngajatObiect oFluturaseAngajat = new FluturaseAngajatObiect();

            if (GlobalClass.VerificareAcces("Angajati", "1"))
            {
                DataClassWbmOlimpias dcWbmOlimpias = new DataClassWbmOlimpias();
                var query = from tFluturaseAngajat in dcWbmOlimpias.FluturaseAngajats
                            where tFluturaseAngajat.IdAngajat.Equals(IdAngajat) && tFluturaseAngajat.IdUtilizatorStergere.Equals(null)
                            orderby tFluturaseAngajat.Id
                            select new { tFluturaseAngajat.Id, tFluturaseAngajat.DataFluturas, tFluturaseAngajat.IdFisier };

                oFluturaseAngajat.NumarPagini = (query.Count() - 1) / 5 + 1;
                if (oFiltruFluturaseAngajat.Find == "")
                {
                    oFluturaseAngajat.PaginaCurenta = PaginaCurenta;
                    oFluturaseAngajat.IndexRand     = 0;
                }
                else
                {
                    int Pozitie = 0;
                    Pozitie = query.ToList().FindIndex(A => A.Id.Equals(Convert.ToInt32(oFiltruFluturaseAngajat.Find)));

                    oFluturaseAngajat.PaginaCurenta = Pozitie / 5 + 1;
                    oFluturaseAngajat.IndexRand     = Pozitie - (oFluturaseAngajat.PaginaCurenta - 1) * 5;
                }
                if (oFluturaseAngajat.NumarPagini < oFluturaseAngajat.PaginaCurenta)
                {
                    oFluturaseAngajat.PaginaCurenta = oFluturaseAngajat.NumarPagini;
                }
                if (oFluturaseAngajat.PaginaCurenta < 1)
                {
                    oFluturaseAngajat.PaginaCurenta = 1;
                }
                foreach (var rezultat in query.Skip(5 * (oFluturaseAngajat.PaginaCurenta - 1)).Take(5))
                {
                    FluturasAngajatObiect oFluturasAngajat = new FluturasAngajatObiect();
                    oFluturasAngajat.Id           = rezultat.Id.ToString();
                    oFluturasAngajat.DataFluturas = rezultat.DataFluturas.ToString("MM.yyyy");
                    oFluturasAngajat.IdFisier     = rezultat.IdFisier.ToString();
                    oFluturaseAngajat.Tabela.Add(oFluturasAngajat);
                }
            }
            else
            {
                oFluturaseAngajat.Eroare = "Acces interzis!";
            }
            return(oFluturaseAngajat);
        }
Exemple #4
0
        public FluturasAngajatObiect FluturasAngajatProprietati(string Id)
        {
            FluturasAngajatObiect oFluturasAngajat = new FluturasAngajatObiect();

            if (GlobalClass.VerificareAcces("Angajati", "1"))
            {
                DataClassWbmOlimpias dcWbmOlimpias = new DataClassWbmOlimpias();
                var query = from tFluturaseAngajat in dcWbmOlimpias.FluturaseAngajats
                            join tFisiere in dcWbmOlimpias.Fisieres on tFluturaseAngajat.IdFisier equals tFisiere.Id
                            where tFluturaseAngajat.Id.Equals(Id)
                            select new { tFluturaseAngajat.Id, tFluturaseAngajat.DataFluturas, tFluturaseAngajat.IdFisier, tFisiere.NumeFisier };
                oFluturasAngajat.DataFluturas = query.First().DataFluturas.ToString("MM.yyyy");
                oFluturasAngajat.IdFisier     = query.First().IdFisier.ToString();
                oFluturasAngajat.Fisier       = query.First().NumeFisier;
            }
            else
            {
                oFluturasAngajat.Eroare = "Acces interzis!";
            }
            return(oFluturasAngajat);
        }