Beispiel #1
0
		private void detach_PlanZanyat_Student(PlanZanyat_Student entity)
		{
			this.SendPropertyChanging();
			entity.PlanZanyat = null;
		}
Beispiel #2
0
 partial void DeletePlanZanyat_Student(PlanZanyat_Student instance);
Beispiel #3
0
		private void attach_PlanZanyat_Student(PlanZanyat_Student entity)
		{
			this.SendPropertyChanging();
			entity.Student = this;
		}
Beispiel #4
0
 partial void InsertPlanZanyat_Student(PlanZanyat_Student instance);
Beispiel #5
0
 partial void UpdatePlanZanyat_Student(PlanZanyat_Student instance);
        //добавление/редактирование планируемой занятости ОТСУСТВУЕТ ЗАПИСЬ В БД ЯЗЫКА ТЕЛЕФОНА И ЭЛ ЯЩИКА!!!!!!!
        public void AddPlanZan(PlanZan obj)
        {
            if (ugtu_db.PlanZanyat_Student.Join(ugtu_db.PlanZanyat, PZS => PZS.idPlanZanyat, PZ => PZ.IDPlanZanyat,(PZS, PZ) => new { PZS, PZ })
                .Where(student => student.PZS.idStud == obj.idStud && student.PZ.IDTypeZan == PlanTypeZan).Count() == 0) //add
            {
                PlanZanyat_Student res = new PlanZanyat_Student()
            {
                DataObzvona = obj.Data,
                idPlanZanyat = obj.idPlanZan,
                idStud = obj.idStud
            };
                ugtu_db.PlanZanyat_Student.InsertOnSubmit(res);

            }
            else  //edit
            {
                var f = (from PZS in ugtu_db.PlanZanyat_Student
                         where PZS.idStud == obj.idStud
                         select PZS).First();
                f.DataObzvona = obj.Data;
                f.idPlanZanyat = obj.idPlanZan;
                f.idStud = obj.idStud;
            }

            ugtu_db.SubmitChanges();
            if (obj.RabProffs != null)
            {
                for (int i = 0; i < obj.RabProffs.Count(); i++)
                {
                    if (ugtu_db.RabProfStudenta.Where(m => m.idStud == obj.idStud && m.idRabProf == obj.RabProffs[i]).Select(m => m.idRabProfstudenta).Count() == 0)
                    {
                        RabProfStudenta RP = new RabProfStudenta()
                        {
                            idRabProf = obj.RabProffs[i],
                            idStud = obj.idStud,
                            Razryad = obj.Razryads[i]
                        };
                        ugtu_db.RabProfStudenta.InsertOnSubmit(RP);
                        ugtu_db.SubmitChanges();
                    }
                    else
                    {
                        var rp = ugtu_db.RabProfStudenta.Where(m => m.idStud == obj.idStud && m.idRabProf == obj.RabProffs[i]).ToList();
                        foreach (var rabProff in rp)
                        {
                            rabProff.idRabProf = obj.RabProffs[i];
                            rabProff.idStud = obj.idStud;
                            rabProff.Razryad = obj.Razryads[i];
                        }
                        ugtu_db.SubmitChanges();
                    }
                }

                var RPs = ugtu_db.RabProfStudenta.Where(m => m.idStud == obj.idStud).ToList();
                foreach (var rabProffInBD in RPs)
                {
                    if (!obj.RabProffs.ToList().Exists(m => m == rabProffInBD.idRabProf))
                    {
                        ugtu_db.RabProfStudenta.DeleteOnSubmit(rabProffInBD);
                        ugtu_db.SubmitChanges();
                    }
                }
            }
            else {
                var RPs = ugtu_db.RabProfStudenta.Where(m => m.idStud == obj.idStud).ToList();
                foreach (var rabProffInBD in RPs)
                {
                        ugtu_db.RabProfStudenta.DeleteOnSubmit(rabProffInBD);
                        ugtu_db.SubmitChanges();
                }
            }
            if (obj.masLang != null)
            {
                foreach (var lang in obj.masLang)
                {
                    if (ugtu_db.Lang_stud.Where(m => m.nCode == obj.idStud && m.Ik_lang == lang).Select(m => m.Step_vlad).Count() == 0)
                    {
                        Lang_stud LS = new Lang_stud()
                        {
                            Ik_lang = lang,
                            Ik_step_vlad = 0,// не указано
                            nCode = obj.idStud
                        };
                        ugtu_db.Lang_stud.InsertOnSubmit(LS);
                        ugtu_db.SubmitChanges();
                    }
                }
                var LPs = ugtu_db.Lang_stud.Where(m => m.nCode == obj.idStud).ToList();
                foreach (var LPsInBD in LPs)
                {
                    if (!obj.masLang.ToList().Exists(m => m == LPsInBD.Ik_lang))
                    {
                        ugtu_db.Lang_stud.DeleteOnSubmit(LPsInBD);
                        ugtu_db.SubmitChanges();
                    }
                }
            }
            else {
                var LPs = ugtu_db.Lang_stud.Where(m => m.nCode == obj.idStud).ToList();
                foreach (var LPsInBD in LPs)
                {
                    ugtu_db.Lang_stud.DeleteOnSubmit(LPsInBD);
                    ugtu_db.SubmitChanges();
                }
            }

            if (obj.Email != null) {
                var PersonEmail = ugtu_db.Person.Where(m => m.nCode == obj.idStud).ToList();
                foreach (var person in PersonEmail) {
                    person.cEmail = obj.Email;
                    ugtu_db.SubmitChanges();
                }
            }
            if (obj.Tel != null)
            {
                var PersonTel = ugtu_db.Person.Where(m => m.nCode == obj.idStud).ToList();
                foreach (var person in PersonTel)
                {
                    person.cSotTel = obj.Tel;
                   ugtu_db.SubmitChanges();
                }
            }
        }
        public string AddFactZanAndTrudoustrSave(FactZanTrud obj)
        {
            var PZcount = ugtu_db.PlanZanyat_Student.Where(m => m.DataObzvona == obj.Data && m.idStud == obj.idStud).Count();
            if (PZcount == 0)
            {
                try
            {
            Trudoustr res = new Trudoustr()
            {
                DataBegin = obj.DataNachTrudoustr,
                DataObzvon = obj.Data,
                DataEnd = obj.DataOkonTrudoustr,
                IDDolznost = AddDolgnost(obj.NameDolzhnost),
                IDPredpriyatie = GetIdPredpr(obj.NamePred),
                RabotaPoSpec = obj.RabPoSpec,
                RabotaVRegion = obj.RabVReg,
                ZarPlata = obj.ZarPlata,
                IDStudent = obj.idStud,
                Otdel=obj.Otdel,
                DopInfo=obj.DopInfo,
                Spravka = obj.BitSpravka
            };
            ugtu_db.Trudoustr.InsertOnSubmit(res);
            ugtu_db.SubmitChanges();
            int id = ugtu_db.Trudoustr.Select(m => m.IDTrudoustr).Max();
            PlanZanyat_Student res2 = new PlanZanyat_Student()
            {
                DataObzvona = obj.Data,
                idPlanZanyat = obj.idPlanZan,
                idStud = obj.idStud,
                idTrudoustr = id
            };
            ugtu_db.PlanZanyat_Student.InsertOnSubmit(res2);
            var person = ugtu_db.Person.Where(m => m.nCode == obj.idStud).First();
            person.cEmail = obj.Email;
            person.cSotTel = obj.Tel;
            ugtu_db.SubmitChanges();
                    return "1";
                }
                catch (Exception)
                {
                    return "Ошибка добавления трудоустройства";
                }

            }
            else
            {
                return "Фактическая занятось с такой датой обзвона уже существует";
            }
        }
        public void AddVipusknikReg(RegistrData obj)
        {
            var Res = ugtu_db.Resume.Where(tr => tr.idStud == obj.idStud).ToList();
            if (Res.Count() == 0)
            {
                Resume res = new Resume()
                {
                    DataPrinytiya = obj.Data,
                    idStatus = StatusRegistrVipusknika,
                    idStud = obj.idStud
                };
                ugtu_db.Resume.InsertOnSubmit(res);
            }
            else
            {
                foreach (var R in Res)
                {
                    R.DataPrinytiya = obj.Data;
                    R.idStatus = StatusRegistrVipusknika;
                }
            }

            var Pers = ugtu_db.Person.Where(tr => tr.nCode == obj.idStud).ToList();
            foreach (var P in Pers)
            {
                P.cSotTel = obj.Tel;
                P.cEmail = obj.Email;
            }

            if (ugtu_db.PlanZanyat_Student.Join(ugtu_db.PlanZanyat, PZS => PZS.idPlanZanyat, PZ => PZ.IDPlanZanyat,
                                            (PZS, PZ) => new { PZS, PZ }).Where(@t => @t.PZS.idStud == obj.idStud && t.PZ.IDTypeZan == PlanTypeZan).Select(arg => arg.PZS.DataObzvona).Count() == 0)//ugtu_db.PlanZanyat_Student.Where(student => student.idStud == obj.idStud).Count() == 0
            {
                PlanZanyat_Student PZS = new PlanZanyat_Student()
                {
                    DataObzvona = obj.Data,
                    idPlanZanyat = obj.idPlanZan,
                    idStud = obj.idStud
                };
                ugtu_db.PlanZanyat_Student.InsertOnSubmit(PZS);
            }
            else
            {
                var f = (from PZS in ugtu_db.PlanZanyat_Student
                         where PZS.idStud == obj.idStud && PZS.idPlanZanyat_Student == obj.idPlanZanStud
                         select PZS).First();
                f.DataObzvona = obj.Data;
                f.idPlanZanyat = obj.idPlanZan;
                f.idStud = obj.idStud;
            }
            ugtu_db.SubmitChanges();

            //var lang=(ugtu_db.Lang_stud.Where(l=>l.nCode==obj.idStud).Select(l=>l.Ik_lang)).ToList();
            // if (obj.Check.Count() > 0)
            //{
            //    foreach(var c in obj.Check){
            //        if (ugtu_db.Lang_stud.Where(l => l.nCode == obj.idStud && l.Ik_lang == c).Count() == 0)
            //        {
            //            Lang_stud LS = new Lang_stud()
            //            {
            //                nCode = obj.idStud,
            //                Ik_lang = c
            //            };
            //            ugtu_db.Lang_stud.InsertOnSubmit(LS);
            //        }
            //    }
            //}
            //if (ugtu_db.Lang_stud.Where(l => l.nCode == obj.idStud && l.Ik_lang == c).Count() > 0)
            //{
            //    var f = (from langSt in ugtu_db.Lang_stud
            //             where langSt.nCode == obj.idStud && langSt.Ik_lang==c
            //             select langSt);
            //    //f.Ik_lang = c;
            //    //f.nCode = obj.idStud;
            //    foreach (var detail in f)
            //    {
            //        ugtu_db.Lang_stud.DeleteOnSubmit(detail);
            //    };
            //}

            ugtu_db.SubmitChanges();
        }
 public void AddViborTrud(PlanZan obj)
 {
     PlanZanyat_Student res = new PlanZanyat_Student()
     {
         DataObzvona = obj.Data,
         idPlanZanyat = obj.idPlanZan,
         idStud = obj.idStud,
         idTrudoustr = obj.idTrud
     };
     ugtu_db.PlanZanyat_Student.InsertOnSubmit(res);
     var person = ugtu_db.Person.Where(m => m.nCode == obj.idStud).First();
     person.cEmail = obj.Email;
     person.cSotTel = obj.Tel;
     ugtu_db.SubmitChanges();
 }
Beispiel #10
0
 public void AddFactZanOnlySave(PlanZan obj)
 {
     var PZcount = ugtu_db.PlanZanyat_Student.Where(m => m.DataObzvona == obj.Data && m.idStud == obj.idStud).Count();
     if (PZcount == 0)
     {
     PlanZanyat_Student res = new PlanZanyat_Student()
     {
         DataObzvona = obj.Data,
         idPlanZanyat = obj.idPlanZan,
         idStud = obj.idStud
     };
     ugtu_db.PlanZanyat_Student.InsertOnSubmit(res);
     var person = ugtu_db.Person.Where(m => m.nCode == obj.idStud).First();
     person.cEmail = obj.Email;
     person.cSotTel = obj.Tel;
     ugtu_db.SubmitChanges();
     }
     else
     {
         throw new Exception("");
     }
 }