Ejemplo n.º 1
0
 public ActionResult AddTrudoustrSave(TrudoustrModel Trud, string Path)
 {
     int idTrud = 0;
     try
     {
         Trud.idDolzhnost = AddDolgnost(Trud.NameDolzhnost);
         Trud.idPredpr = GetIdPredpr(Trud.NamePred);
         idTrud = Rep.AddTrudoustrSave(Trud);
     }
     catch (Exception e)
     {
         ViewBag.Message = e.Message;
         return View("Error");
     }
     return RedirectToAction("InfoTrudoustr", Path, new { idTrud = idTrud, idStud = Trud.idStud });
 }
Ejemplo n.º 2
0
        public ActionResult EditTrudoustr(int idTrud, string Path)
        {
            TrudoustrModel InfoTrud = new TrudoustrModel();
            InfoTrud = Rep.InfoTrudoustr(idTrud);

            using (var ugtu_db = new UGTU_DBDataContext())
            {
                ViewBag.Predpr = new SelectList(ugtu_db.Predpriyatie.ToList(), "IDPredpriyatie", "Name",
                                                ugtu_db.Trudoustr.Where(trudoustr => trudoustr.IDTrudoustr == idTrud)
                                                       .Select(trudoustr => trudoustr.IDPredpriyatie)
                                                       .SingleOrDefault());
                //ViewBag.Dolzhnost = new SelectList(ugtu_db.Dolznost.ToList(), "IDDolznost", "NameDolznost",
                //                                   ugtu_db.Trudoustr.Where(trudoustr => trudoustr.IDTrudoustr == idTrud)
                //                                          .Select(trudoustr => trudoustr.IDDolznost)
                //                                          .SingleOrDefault());

                var SpravkaVipusknik = (from Pers in ugtu_db.Person
                                        join Za in ugtu_db.Zach on Pers.nCode equals Za.nCode
                                        join StGr in ugtu_db.StudGrup on Za.Ik_zach equals StGr.Ik_zach
                                        join Gr in ugtu_db.Grup on StGr.Ik_grup equals Gr.Ik_grup
                                        join Tr in ugtu_db.Trudoustr on Pers.nCode equals Tr.IDStudent
                                        where Pers.nCode == InfoTrud.idStud
                                        select new
                                        {
                                            spravka = Tr.Spravka
                                        }).ToList();

                ViewBag.bitSpravkaAll = false;
                foreach (var c in SpravkaVipusknik)
                {
                    if (c.spravka == true)
                    {
                        ViewBag.bitSpravkaAll = true;
                    }
                }

            }

            ViewBag.idStud = InfoTrud.idStud;
            ViewBag.Path = Path;
            return PartialView("PartialEditTrudoustr", InfoTrud);
        }
Ejemplo n.º 3
0
        public int AddTrudoustrSave(TrudoustrModel Trud)
        {
            using (var ugtu_db = new UGTU_DBDataContext())
            {
                Models.ugtuRealTest.File F = null;
                if (Trud.upload != null)
                {
                    F = new Models.ugtuRealTest.File();
                    F.ExtensionFile = Path.GetExtension(Trud.upload.FileName);
                    byte[] byteFile = null;
                    // считываем переданный файл в массив байтов
                    using (var binaryReader = new BinaryReader(Trud.upload.InputStream))
                    {
                        byteFile = binaryReader.ReadBytes(Trud.upload.ContentLength);
                    }
                    F.bFile = byteFile;

                    ugtu_db.File.InsertOnSubmit(F);
                    ugtu_db.SubmitChanges();
                }
                Trudoustr Tr = new Trudoustr()
                {
                    DataBegin = Trud.DataNachTrudoustr,
                    DataObzvon = Trud.DataObzvon,
                    DataEnd = Trud.DataOkonTrudoustr,
                    IDDolznost = Trud.idDolzhnost,
                    IDPredpriyatie = Trud.idPredpr,
                    RabotaPoSpec = Trud.RabPoSpec,
                    ZarPlata = Trud.ZarPlata,
                    IDStudent = Trud.idStud,
                    Spravka = Trud.BitSpravka,
                    Otdel=Trud.Otdel,
                    DopInfo=Trud.DopInfo
                };
                if (F != null) Tr.IDFile = F.idFile;
                ugtu_db.Trudoustr.InsertOnSubmit(Tr);
                ugtu_db.SubmitChanges();
                return Tr.IDTrudoustr;
            }
        }
Ejemplo n.º 4
0
 //закрыттие регистрации при нахождении работы самим обратившимся используется в связке с SaveVipusknikCloseRegisration_OtkazOtCZS в JS , нужен tru catch!!!
 public int SaveVipusknikCloseRegisration_WithOutCZS_AddTrud(TrudoustrModel Trud)
 {
     using (var ugtu_db = new UGTU_DBDataContext())
     {
         Trudoustr Tr = new Trudoustr()
         {
             IDStudent = ugtu_db.Resume.Where(m => m.idResume == Trud.idRes).Select(m => m.idStud).SingleOrDefault(),
             IDDolznost = AddDolgnost(Trud.NameDolzhnost),
             IDPredpriyatie = GetIdPredpr(Trud.NamePred),
             IDResume = Trud.idRes,
             Otdel=Trud.Otdel,
             RabotaPoSpec = Trud.RabPoSpec,
             DataObzvon = Trud.DataObzvon,
             DataBegin = Trud.DataNachTrudoustr,
             DataEnd = Trud.DataOkonTrudoustr,
             ZarPlata = Trud.ZarPlata,
             DopInfo=Trud.DopInfo
         };
         ugtu_db.Trudoustr.InsertOnSubmit(Tr);
         ugtu_db.SubmitChanges();
         return 1;
     }
 }
Ejemplo n.º 5
0
        public ActionResult EditFactZanVipusknik(int id)
        {
            var qw = (from PZS in ugtu_db.PlanZanyat_Student
                      join PZ in ugtu_db.PlanZanyat on PZS.idPlanZanyat equals PZ.IDPlanZanyat
                      where PZS.idPlanZanyat_Student == id
                      select new
                      {
                          idStud = PZS.idStud,
                          idTrud = PZS.idTrudoustr,
                          data = PZS.DataObzvona
                      }).First();
            TrudoustrModel _TrudoustrModel = new TrudoustrModel();
            if (qw.idTrud != null)
            {
                ViewBag.idTrud = qw.idTrud;

                ViewBag.idPredpr = new SelectList(ugtu_db.Predpriyatie.OrderBy(n => n.Name), "IDPredpriyatie", "Name", ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(m => m.IDPredpriyatie).First());
                ViewBag.idDolzhnost = new SelectList(ugtu_db.Dolznost.OrderBy(n => n.NameDolznost), "IDDolznost", "NameDolznost", ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(m => m.IDDolznost).First());

                if (ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataBegin).First() != null) ViewBag.DataNachTrudoustr = DateTime.Parse(ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataBegin).First().ToString()).ToShortDateString();
                if (ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataEnd).First() != null) ViewBag.DataOkonTrudoustr = DateTime.Parse(ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataEnd).First().ToString()).ToShortDateString();
                if (ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataObzvon).First() != null) ViewBag.DataObzvon = DateTime.Parse(ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataObzvon).First().ToString()).ToShortDateString();
                ViewBag.ZarPlata = ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.ZarPlata).First();
                ViewBag.RabPoSpec = ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.RabotaPoSpec).First();
                ViewBag.BitSpravka = ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.Spravka).First();
                ViewBag.DopInfo = ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DopInfo).First();

                if (ViewBag.DataNachTrudoustr != null) _TrudoustrModel.DataNachTrudoustr = DateTime.Parse(ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataBegin).First().ToString());
                if (ViewBag.DataOkonTrudoustr != null) _TrudoustrModel.DataOkonTrudoustr = DateTime.Parse(ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataEnd).First().ToString());
                if (ViewBag.DataObzvon != null) _TrudoustrModel.DataObzvon = DateTime.Parse(ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.DataObzvon).First().ToString());
                _TrudoustrModel.ZarPlata = ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(M => M.ZarPlata).First();
                _TrudoustrModel.NamePred = ugtu_db.Predpriyatie.Where(m => m.IDPredpriyatie == ugtu_db.Trudoustr.Where(m1 => m1.IDTrudoustr == qw.idTrud).Select(m1 => m1.IDPredpriyatie).SingleOrDefault()).Select(m => m.Name).SingleOrDefault();
                _TrudoustrModel.NameDolzhnost = ugtu_db.Dolznost.Where(m => m.IDDolznost == ugtu_db.Trudoustr.Where(m1 => m1.IDTrudoustr == qw.idTrud).Select(m1 => m1.IDDolznost).SingleOrDefault()).Select(m => m.NameDolznost).SingleOrDefault();
                _TrudoustrModel.Otdel = ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(m => m.Otdel).SingleOrDefault();
                _TrudoustrModel.DopInfo = ugtu_db.Trudoustr.Where(m => m.IDTrudoustr == qw.idTrud).Select(m => m.DopInfo).SingleOrDefault();

            }
            else
            {
                ViewBag.Predpr = new SelectList(ugtu_db.Predpriyatie.OrderBy(n => n.Name), "IDPredpriyatie", "Name");
                ViewBag.Dolzhnost = new SelectList(ugtu_db.Dolznost.OrderBy(n => n.NameDolznost), "IDDolznost", "NameDolznost");
            }
            var KaryeraVipusknik1 = (from Pers in ugtu_db.Person
                                     join Za in ugtu_db.Zach on Pers.nCode equals Za.nCode
                                     join StGr in ugtu_db.StudGrup on Za.Ik_zach equals StGr.Ik_zach
                                     join Gr in ugtu_db.Grup on StGr.Ik_grup equals Gr.Ik_grup
                                     where Pers.nCode == qw.idStud// && Gr.DateExit.Value.Year == DateTime.Today.Year && DateTime.Today.Month < Month
                                     select new StudentKarModel
                                     {
                                         firstname = Pers.Cfirstname,
                                         lastname = Pers.Clastname,
                                         otch = Pers.Cotch,
                                         FIO = Pers.PersonFullName,
                                         nCode = Pers.nCode,
                                         name_grup = Gr.Cname_grup,
                                     }).ToList();

            var KaryeraVipusknik = (from Pers in ugtu_db.Person
                                    join Za in ugtu_db.Zach on Pers.nCode equals Za.nCode
                                    join StGr in ugtu_db.StudGrup on Za.Ik_zach equals StGr.Ik_zach
                                    join Gr in ugtu_db.Grup on StGr.Ik_grup equals Gr.Ik_grup
                                    join Tr in ugtu_db.Trudoustr on Pers.nCode equals Tr.IDStudent
                                    where Pers.nCode == qw.idStud //&& Gr.DateExit.Value.Year == DateTime.Today.Year && DateTime.Today.Month < Month
                                    select new
                                    {
                                        spravka = Tr.Spravka
                                    }).ToList();

            ViewBag.bitSpravkaAll = false;
            foreach (var c in KaryeraVipusknik)
            {
                if (c.spravka == true)
                {
                    ViewBag.bitSpravkaAll = true;
                }
            }
            ViewBag.InfoStud = KaryeraVipusknik1.Last();
            ViewBag.idStud = qw.idStud;
               // ViewBag.idTrud = 0; ???надо, нет???
            if (qw.idTrud != null) { ViewBag.idTrud = qw.idTrud; };
            ViewBag.idPlanZan = id;
            ViewBag.Tel = ugtu_db.Person.Where(m => m.nCode == qw.idStud).Select(M => M.cSotTel).FirstOrDefault();
            ViewBag.mail = ugtu_db.Person.Where(m => m.nCode == qw.idStud).Select(M => M.cEmail).FirstOrDefault();
            ViewBag.FactZan = new SelectList(ugtu_db.PlanZanyat.Where(m => m.IDTypeZan == FactTypeZan), "IDPlanZanyat", "NamePlanZanyat",
                ugtu_db.PlanZanyat_Student.Where(m => m.idPlanZanyat_Student == id).Select(m => m.idPlanZanyat).First());
            ViewBag.DataObzvonFactZan = DateTime.Parse(qw.data.ToString()).ToShortDateString();
            return PartialView("VipusknikEditFactZan", _TrudoustrModel);
        }
Ejemplo n.º 6
0
        public ActionResult EditTrudoustrSave(TrudoustrModel Trud, string Path)
        {
            using (var ugtu_db = new UGTU_DBDataContext())
            {
                var Trudostr = ugtu_db.Trudoustr.Where(tr => tr.IDTrudoustr == Trud.idTrud).First();
                if (Path == "Vipusknik")
                {
                    Models.ugtuRealTest.File F = null;

                    if (Trudostr.Spravka == true && Trud.BitSpravka == false)//если справка была и её не стало
                    {
                        ugtu_db.File.DeleteOnSubmit(ugtu_db.File.Where(f => f.idFile == Trudostr.IDFile).SingleOrDefault());
                        Trudostr.IDFile = null;
                        ugtu_db.SubmitChanges();
                    }
                    else
                    {
                        if (Trud.BitSpravka == true && Trud.upload != null)
                        {
                            if (Trudostr.Spravka == true) F = new Models.ugtuRealTest.File();
                            else F = ugtu_db.File.Where(f => f.idFile == Trudostr.IDFile).SingleOrDefault();
                            F.ExtensionFile = System.IO.Path.GetExtension(Trud.upload.FileName);
                            byte[] byteFile = null;
                            // считываем переданный файл в массив байтов
                            using (var binaryReader = new BinaryReader(Trud.upload.InputStream))
                            {
                                byteFile = binaryReader.ReadBytes(Trud.upload.ContentLength);
                            }
                            F.bFile = byteFile;

                            if (Trudostr.Spravka == true) ugtu_db.File.InsertOnSubmit(F);
                            ugtu_db.SubmitChanges();

                            if (F != null) Trudostr.IDFile = F.idFile;
                            if (Path == "Vipusknik" && F == null) Trudostr.IDFile = null;
                        }
                    }
                }
                //var Trudostr = ugtu_db.Trudoustr.Where(tr => tr.IDTrudoustr == Trud.idTrud).First();
                Trudostr.DataBegin = Trud.DataNachTrudoustr;
                Trudostr.DataObzvon = Trud.DataObzvon;
                Trudostr.DataEnd = Trud.DataOkonTrudoustr;
                Trudostr.IDDolznost = AddDolgnost(Trud.NameDolzhnost);
                Trudostr.IDPredpriyatie =GetIdPredpr(Trud.NamePred);
                Trudostr.RabotaPoSpec = Trud.RabPoSpec;
                Trudostr.Otdel = Trud.Otdel;
                Trudostr.ZarPlata = Trud.ZarPlata;
                Trudostr.IDStudent = Trud.idStud;
                Trudostr.Spravka = Trud.BitSpravka;
                Trudostr.DopInfo = Trud.DopInfo;

                ugtu_db.SubmitChanges();
            }
            return RedirectToAction("InfoTrudoustr", Path, new { idTrud = Trud.idTrud, idStud = Trud.idStud });
        }
Ejemplo n.º 7
0
 public ActionResult InfoTrudoustr(int idTrud, string Path)
 {
     TrudoustrModel InfoTrud = new TrudoustrModel();
     InfoTrud = Rep.InfoTrudoustr(idTrud);
     ViewBag.idStud = InfoTrud.idStud;
     ViewBag.idTrud = idTrud;
     ViewBag.Path = Path;
     return PartialView("PartialInfoTrudoustr", InfoTrud);
 }