Example #1
0
        public void AddStudReg(RegistrData obj)
        {
            Resume res = new Resume()
            {
                DataPrinytiya = obj.Data,
                idStatus = obj.idStatus,
                idStud = obj.idStud

            };

            Console.Write(obj.Data);
            Console.Write(obj.idStatus);
            ugtu_db.Resume.InsertOnSubmit(res);
            ugtu_db.SubmitChanges();
        }
Example #2
0
		private void detach_Resume(Resume entity)
		{
			this.SendPropertyChanging();
			entity.Status = null;
		}
Example #3
0
 partial void DeleteResume(Resume instance);
Example #4
0
		private void attach_Resume(Resume entity)
		{
			this.SendPropertyChanging();
			entity.Status = this;
		}
Example #5
0
 partial void UpdateResume(Resume instance);
Example #6
0
 partial void InsertResume(Resume instance);
        // Метод записи в БД
        public int AddResumeSaveBD(ResumeModel resume, int idTipZan)
        {
            using (var ugtu_db = new UGTU_DBDataContext())
            {
                Models.ugtuRealTest.File F = null;
                if (resume.upload != null)
                {
                    F = new Models.ugtuRealTest.File();
                    F.ExtensionFile = Path.GetExtension(resume.upload.FileName);
                    byte[] byteFile = null;
                    // считываем переданный файл в массив байтов
                    using (var binaryReader = new BinaryReader(resume.upload.InputStream))
                    {
                        byteFile = binaryReader.ReadBytes(resume.upload.ContentLength);
                    }
                    F.bFile = byteFile;

                    ugtu_db.File.InsertOnSubmit(F);
                    ugtu_db.SubmitChanges();
                }

                Resume res = new Resume()
                {
                    DataPrinytiya = resume.DataPrinytiya,
                    idStatus = 1,//StatusResumeOpen,
                    idStud = resume.idStud,
                    DopInfo = resume.DopInfo,
                    Otmetki=resume.Otmetki
                };
                if (F != null) { res.idFile = F.idFile; } else {
                    var fileres = ugtu_db.Resume.Where(m => m.idStud == resume.idStud && m.idFile != null).Select(m => m.idFile).FirstOrDefault();
                    res.idFile = fileres;
                }
                ugtu_db.Resume.InsertOnSubmit(res);
                if (F != null)
                {
                    foreach (var r in ugtu_db.Resume.Where(r => r.idStud == resume.idStud))
                    {
                        if (ugtu_db.File.Where(m => m.idFile == r.idFile).Count() > 0)
                        {
                            ugtu_db.File.DeleteOnSubmit(ugtu_db.File.Where(m => m.idFile == r.idFile).First());
                        }
                        r.idFile = F.idFile;
                    }
                }
                var person = ugtu_db.Person.Where(m => m.nCode == resume.idStud).First();
                person.cEmail = resume.mail;
                person.cSotTel = resume.Tel;
                ugtu_db.SubmitChanges();
                Param_Resume PR = new Param_Resume()
                {
                    idResumeZnachParam = idTipZan,
                    idParam = ConstRep.idParamTipZan,
                    idResume = res.idResume
                };
                ugtu_db.Param_Resume.InsertOnSubmit(PR);
                ugtu_db.SubmitChanges();
                return res.idResume;
            }
        }
Example #8
0
        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();
        }
Example #9
0
        public void AddStudReg(RegistrData obj)
        {
            Resume res = new Resume()
            {
               DataPrinytiya = obj.Data,
               idStatus =obj.idStatus,
               idStud = obj.idStud

            };

            Console.Write(obj.Data);
            Console.Write(obj.idStatus);
            ugtu_db.Resume.InsertOnSubmit(res);

            ugtu_db.SubmitChanges();
            int idres=ugtu_db.Resume.Select(resume => resume.idResume).Max();
            Dolznost_Resume DR = new Dolznost_Resume()
            {
                idDolznost = obj.IDDolznost,
                idResume = idres
            };
            ugtu_db.Dolznost_Resume.InsertOnSubmit(DR);
            ugtu_db.SubmitChanges();
        }