Exemple #1
0
        private void RaschetItogVPO()
        {
            foreach (var Zan in ugtu_db.PlanZanyat.Where(z => z.IDTypeZan == TZan).ToList())// по всем занятостям данного типа
            {
                Zan ZanFac = new Zan();
                ZanFac.idZan = Zan.IDPlanZanyat;
                ItogVPO.ListZan.Add(ZanFac);
            }

            foreach (var Fac in ListFac.Where(f => f.idFac == ConstRep.FacIGNiTT || f.idFac == ConstRep.FacInEUiIT || f.idFac == ConstRep.FacSTI))
            {
                ItogVPO.FullKol += Fac.Stroka.FullKol;
                ItogVPO.KolBudzet += Fac.Stroka.KolBudzet;
                ItogVPO.KolKontrakt += Fac.Stroka.KolKontrakt;

                Zan Z=new Zan();
                foreach (var ZanI in ItogVPO.ListZan)
                {
                    foreach (var Zan in Fac.Stroka.ListZan)
                    {
                        if (ZanI.idZan == Zan.idZan)
                        {
                            ZanI.KolBudzet = Zan.KolBudzet;
                            ZanI.KolKontrakt = Zan.KolKontrakt;
                            ZanI.NameZan = Zan.NameZan;
                        }
                    }
                }

                ItogVPO.KolTrudBudzet += Fac.Stroka.KolTrudBudzet;
                ItogVPO.KolTrudKontrakt += Fac.Stroka.KolTrudKontrakt;
                ItogVPO.ProcBudzet=((double)ItogVPO.KolTrudBudzet / ItogVPO.FullKol) * 100;
                ItogVPO.ProcKontrakt=((double)ItogVPO.KolTrudKontrakt / ItogVPO.FullKol) * 100;
                ItogVPO.Proc = ((double)(ItogVPO.KolTrudBudzet + ItogVPO.KolTrudKontrakt) / ItogVPO.FullKol) * 100;
            }
        }
Exemple #2
0
        private void Data()
        {
            UGTU_DBDataContext ugtu_db = new UGTU_DBDataContext();
            var Stud = (from Gr in ugtu_db.Grup
                        join StGr in ugtu_db.StudGrup on Gr.Ik_grup equals StGr.Ik_grup
                        join Za in ugtu_db.Zach on StGr.Ik_zach equals Za.Ik_zach
                        join stud in ugtu_db.Student on Za.nCode equals stud.nCode
                        join Pers in ugtu_db.Person on stud.nCode equals Pers.nCode
                        join RSF in ugtu_db.Relation_spec_fac on Gr.ik_spec_fac equals RSF.ik_spec_fac
                        join S in ugtu_db.Spec_stud on RSF.ik_spec equals S.ik_spec
                        join F in ugtu_db.Fac on RSF.ik_fac equals F.Ik_fac
                        join KZ in ugtu_db.Kat_zach on StGr.ik_kat_zach equals KZ.Ik_kat_zach
                        join TKZ in ugtu_db.TypeKatZach on KZ.ik_type_kat equals TKZ.ik_type_kat
                        join FE in ugtu_db.Form_ed on RSF.Ik_form_ed equals FE.Ik_form_ed
                        where Gr.DateExit.Value.Year == Yr
                        && (FE.Ik_form_ed == FormEd)
                        && (RSF.ik_fac == FacIGNiTT
                        || RSF.ik_fac == FacInEUiIT
                        || RSF.ik_fac == FacSTI
                        || RSF.ik_fac == FacII)
                        select new
                        {
                            NameStud = Pers.PersonFullName,
                            NameGrup = Gr.Cname_grup,
                            idStud = Pers.nCode,
                            idFac = F.Ik_fac,
                            NameFac = F.Cname_fac,
                            idSpec = S.ik_spec,
                            NameSpec = S.FullName,
                            idTypeKatZach = TKZ.ik_type_kat,
                            NameTypeKatZach = TKZ.CType_kat,
                            idDirection = S.ik_direction,
                            Pricina=StGr.ik_pricOtch
                        }).ToList();
            try
            {
                if (TZan == ConstRep.PlanTypeZan)
                {
                    //if (Yr < DateTime.Now.Year || (Yr == DateTime.Now.Year && DateTime.Now.Month >= 9))
                    //{
                    //    Stud = Stud.Where(s => s.Pricina == ConstRep.PricinaOtch).ToList();
                    //}
                    //else
                    //{
                    //    Stud = Stud.Where(s => s.Pricina == null).ToList();

                    // }
                    Stud = Stud.Where(s => s.Pricina == ConstRep.PricinaOtch || s.Pricina == null).ToList();
                }
                else {Stud = Stud.Where(s => s.Pricina == ConstRep.PricinaOtch).ToList();}
            }
            catch (Exception){ }
            foreach (var Fac in Stud.Where(f => f.idFac == ConstRep.FacIGNiTT || f.idFac == ConstRep.FacSTI || f.idFac == ConstRep.FacInEUiIT || f.idFac == ConstRep.FacII).Select(f => f.idFac).Distinct().ToList())//по 3 факультетам +1
            {
                czs2.Otchet.Fac F = new czs2.Otchet.Fac();
                F.idFac = Stud.First(s => s.idFac == Fac).idFac;
                F.NameFac = Stud.First(s => s.idFac == Fac).NameFac;
                //F.ListSpec = new List<czs2.Otchet.Spec>();
                //F.Stroka = new Stroka();
               // F.Stroka.ListZan = new List<Zan>();

                foreach (var Zan in ugtu_db.PlanZanyat.Where(z => z.IDTypeZan == TZan).ToList())// по всем занятостям данного типа
                {
                    Zan ZanFac = new Zan();
                    ZanFac.NameZan = Zan.NamePlanZanyat;
                    ZanFac.idZan = Zan.IDPlanZanyat;
                    F.Stroka.ListZan.Add(ZanFac);
                }

                var StudFac = Stud.Where(s => s.idFac == Fac).ToList();
                foreach (var Spec in StudFac.Where(s => s.idDirection == ConstRep.DirectionSpec || s.idDirection == ConstRep.DirectionBak || s.idDirection == ConstRep.DirectionBakSokr || s.idDirection == ConstRep.DirectionSPO).Select(s => s.idSpec).Distinct().ToList())//по всем спецальностям факультета
                {
                    var StudSpec = StudFac.Where(s => s.idSpec == Spec).ToList();
                    Spec Sp = new czs2.Otchet.Spec();
                    Sp.NameSpec = StudSpec.First().NameSpec;
                    Sp.Stroka = new Stroka();
                    Sp.Stroka.FullKol = StudSpec.Count();
                    Sp.Stroka.KolBudzet = StudSpec.Where(s => s.idTypeKatZach == ConstRep.TypeKat_zachBudzet).Count() + StudSpec.Where(s => s.idTypeKatZach == ConstRep.TypeKat_zachCKP).Count();
                    Sp.Stroka.KolKontrakt = StudSpec.Where(s => s.idTypeKatZach == ConstRep.TypeKat_zachKontrakt).Count();
                    Sp.Stroka.ListZan = new List<Zan>();
                    foreach (var Zan in ugtu_db.PlanZanyat.Where(z => z.IDTypeZan == TZan).ToList())// по всем занятостям данного типа
                    {
                        var StudZan = (from St in StudSpec
                                       join PZS in ugtu_db.PlanZanyat_Student on St.idStud equals PZS.idStud
                                       join PZ in ugtu_db.PlanZanyat on PZS.idPlanZanyat equals PZ.IDPlanZanyat
                                       where PZ.IDPlanZanyat == Zan.IDPlanZanyat
                                       select new
                                       {
                                           idStud = St.idStud,
                                           idTypeKatZach = St.idTypeKatZach,
                                       }).ToList();
                        Zan Z = new Zan();
                        Z.NameZan = Zan.NamePlanZanyat;
                        Z.idZan = Zan.IDPlanZanyat;
                        Z.KolBudzet = StudZan.Where(s => s.idTypeKatZach == ConstRep.TypeKat_zachBudzet).Count() + StudZan.Where(s => s.idTypeKatZach == ConstRep.TypeKat_zachCKP).Count(); ;
                        Z.KolKontrakt = StudZan.Where(s => s.idTypeKatZach == ConstRep.TypeKat_zachKontrakt).Count();

                        if (TZan == ConstRep.PlanTypeZan)
                        {
                            if (Zan.IDPlanZanyat != ConstRep.PlanZanNeTrud)
                            {
                                Sp.Stroka.KolTrudBudzet += Z.KolBudzet;
                                Sp.Stroka.KolTrudKontrakt += Z.KolKontrakt;
                            }
                        }
                        else
                        {
                            if (Zan.IDPlanZanyat != ConstRep.FaktZanNeTrud && Zan.IDPlanZanyat != ConstRep.FaktZanInCZN)
                            {
                                Sp.Stroka.KolTrudBudzet += Z.KolBudzet;
                                Sp.Stroka.KolTrudKontrakt += Z.KolKontrakt;
                            }
                        }
                        Sp.Stroka.ListZan.Add(Z);
                    }
                    // проценты
                    if (Sp.Stroka.FullKol != 0) Sp.Stroka.Proc = ((double)(Sp.Stroka.KolTrudBudzet + Sp.Stroka.KolTrudKontrakt) / Sp.Stroka.FullKol) * 100;
                    if (Sp.Stroka.KolBudzet != 0) Sp.Stroka.ProcBudzet = ((double)(Sp.Stroka.KolTrudBudzet) / Sp.Stroka.KolBudzet) * 100;
                    if (Sp.Stroka.KolKontrakt != 0) Sp.Stroka.ProcKontrakt = ((double)(Sp.Stroka.KolTrudKontrakt) / Sp.Stroka.KolKontrakt) * 100;

                    F.Stroka.FullKol += Sp.Stroka.FullKol;
                    F.Stroka.KolBudzet += Sp.Stroka.KolBudzet;
                    F.Stroka.KolKontrakt += Sp.Stroka.KolKontrakt;

                    foreach (var ZanSp in Sp.Stroka.ListZan)
                    {
                        foreach (var ZanF in F.Stroka.ListZan)
                            if (ZanSp.NameZan == ZanF.NameZan)
                            {
                                ZanF.KolBudzet += ZanSp.KolBudzet;
                                ZanF.KolKontrakt += ZanSp.KolKontrakt;
                                if (TZan == ConstRep.PlanTypeZan)
                                {
                                    if (ZanF.idZan != ConstRep.PlanZanNeTrud)
                                    {
                                        F.Stroka.KolTrudBudzet += ZanSp.KolBudzet;
                                        F.Stroka.KolTrudKontrakt += ZanSp.KolKontrakt;
                                    }
                                }
                                else
                                {
                                    if (ZanF.idZan != ConstRep.FaktZanNeTrud && ZanF.idZan != ConstRep.FaktZanInCZN)
                                    {
                                        F.Stroka.KolTrudBudzet += ZanSp.KolBudzet;
                                        F.Stroka.KolTrudKontrakt += ZanSp.KolKontrakt;
                                    }
                                }

                            }
                    }

                    F.ListSpec.Add(Sp);
                }
                if (F.Stroka.FullKol != 0) F.Stroka.Proc = ((double)(F.Stroka.KolTrudBudzet + F.Stroka.KolTrudKontrakt) / F.Stroka.FullKol) * 100;
                if (F.Stroka.KolBudzet != 0) F.Stroka.ProcBudzet = ((double)(F.Stroka.KolTrudBudzet) / F.Stroka.KolBudzet) * 100;
                if (F.Stroka.KolKontrakt != 0) F.Stroka.ProcKontrakt = ((double)(F.Stroka.KolTrudKontrakt) / F.Stroka.KolKontrakt) * 100;
                ListFac.Add(F);

            }

              //  return ListFac;
        }