Esempio n. 1
0
 public static void Add_CtVet1b(CtVet1b tmp)
 {
     if (tmp == null)
     {
         return;
     }
     using (SqlConnection _conn = new SqlConnection(spDAL.connStr))
     {
         string q = "INSERT INTO ctVET1b " +
                    "(KIDro,repMO,KIDdiv,KIDspc,KIDdis,test,femage_1,femage_2," +
                    "fage1_pos,fage2_pos,dtObs,test_tot,pos_tot) " +
                    "VALUES " +
                    "(@KIDro,@repMO,@KIDdiv,@KIDspc,@KIDdis,@test,@femage_1,@femage_2," +
                    "@fage1_pos,@fage2_pos,@dtObs,@test_tot,@pos_tot)";
         var param = new
         {
             KIDro     = tmp.KIDro,
             repMO     = tmp.repMO,
             KIDdiv    = tmp.KIDdiv,
             KIDspc    = tmp.KIDspc,
             KIDdis    = tmp.KIDdis,
             test      = tmp.test,
             femage_1  = tmp.femage_1,
             femage_2  = tmp.femage_2,
             fage1_pos = tmp.fage1_pos,
             fage2_pos = tmp.fage2_pos,
             dtObs     = tmp.dtObs,
             test_tot  = tmp.femage_1 + tmp.femage_2,
             pos_tot   = tmp.fage1_pos + tmp.fage2_pos
         };
         _conn.Execute(q, param);
         _conn.Close();
     }
 }
Esempio n. 2
0
        public IActionResult Edit(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            CtVet1b tmpVet1b = CtVet1bDAL.GetCtVet1bById(id);

            if (tmpVet1b == null)
            {
                return(NotFound());
            }

            int Y = Convert.ToInt32(User.Claims.ToList().FirstOrDefault(x => x.Type == "reportDtYear").Value);
            int M = Convert.ToInt32(User.Claims.ToList().FirstOrDefault(x => x.Type == "reportDtMonth").Value);

            ViewBag.RepMoList  = spDAL.RepMO1YearList(Y, M);
            ViewBag.KIDdivList = spDAL.KIDdivList(User.Claims.ToList().FirstOrDefault(x => x.Type == "KIDro").Value);
            ViewBag.KIDspcList = spDAL.KIDspcList();
            ViewBag.KIDdisList = spDAL.KIDdisList();
            ViewBag.testList   = spDAL.testList();

            ViewBag.Page = "CtVet1b";
            return(View(tmpVet1b));
        }
Esempio n. 3
0
 public static bool IsUniqueRecord(CtVet1b tmp)
 {
     using (SqlConnection _conn = new SqlConnection(spDAL.connStr))
     {
         string q = "SELECT COUNT(*) FROM ctVet1b WHERE " +
                    "(repMO=@repMOP and KIDro=@KIDroP and KIDspc=@KIDspcP and " +
                    "KIDdis=@KIDdisP and test=@testP and " +
                    "KIDdiv=@KIDdivP)";
         var param = new
         {
             repMOP  = tmp.repMO,
             KIDroP  = tmp.KIDro,
             KIDspcP = tmp.KIDspc,
             KIDdisP = tmp.KIDdis,
             testP   = tmp.test,
             KIDdivP = tmp.KIDdiv
         };
         int count = _conn.QueryFirstOrDefault <int>(q, param);
         if (count == 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Esempio n. 4
0
 public static void UpdateCtVet1b(CtVet1b tmp)
 {
     if (tmp is null)
     {
         return;
     }
     using (SqlConnection _conn = new SqlConnection(spDAL.connStr))
     {
         string q = "UPDATE ctVET1b SET " +
                    "KIDro=@KIDro,repMO=@repMO,KIDdiv=@KIDdiv," +
                    "KIDspc=@KIDspc,KIDdis=@KIDdis,test = @test," +
                    "dtObs = @dtObs,femage_1=@femage_1,femage_2=@femage_2," +
                    "fage1_pos = @fage1_pos,fage2_pos = @fage2_pos," +
                    "test_tot=@test_tot, pos_tot=@pos_tot " +
                    "WHERE ID=@ID";
         var param = new
         {
             ID        = tmp.ID,
             KIDro     = tmp.KIDro,
             repMO     = tmp.repMO,
             KIDdiv    = tmp.KIDdiv,
             KIDspc    = tmp.KIDspc,
             KIDdis    = tmp.KIDdis,
             test      = tmp.test,
             dtObs     = tmp.dtObs,
             femage_1  = tmp.femage_1,
             femage_2  = tmp.femage_2,
             fage1_pos = tmp.fage1_pos,
             fage2_pos = tmp.fage2_pos,
             test_tot  = tmp.femage_1 + tmp.femage_2,
             pos_tot   = tmp.fage1_pos + tmp.fage2_pos
         };
         _conn.Execute(q, param);
     }
 }
Esempio n. 5
0
 public static CtVet1b GetCtVet1bById(Guid id)
 {
     using (SqlConnection _conn = new SqlConnection(spDAL.connStr))
     {
         CtVet1b tmp = _conn.QueryFirstOrDefault <CtVet1b>("SELECT * FROM ctVet1b WHERE ID=@idd",
                                                           new { idd = id });
         tmp.KIDdisDisplay = spDAL.KIDdisName(tmp.KIDdis);
         tmp.KIDdivDisplay = spDAL.KIDdivName(tmp.KIDdiv);
         tmp.KIDspcDisplay = spDAL.KIDspcName(tmp.KIDspc);
         tmp.testDisplay   = spDAL.testName(tmp.test);
         return(tmp);
     }
 }
Esempio n. 6
0
        public IActionResult Delete(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            CtVet1b tmpVet1a = CtVet1bDAL.GetCtVet1bById(id);

            if (tmpVet1a == null)
            {
                return(NotFound());
            }
            ViewBag.Page = "CtVet1b";
            return(View(tmpVet1a));
        }
Esempio n. 7
0
 public IActionResult Edit(Guid id, [Bind] CtVet1b objCtVet1b)
 {
     if (id == null)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         CtVet1bDAL.UpdateCtVet1b(objCtVet1b);
         ViewBag.Page = "CtVet1b";
         return(RedirectToAction("Index"));
     }
     ViewBag.Page = "CtVet1b";
     return(View(objCtVet1b));
 }
Esempio n. 8
0
 public IActionResult Create([Bind] CtVet1b tmpVet)
 {
     if (ModelState.IsValid)
     {
         //проверка на существования аналогичной записи
         if (CtVet1bDAL.IsUniqueRecord(tmpVet))
         {
             CtVet1bDAL.Add_CtVet1b(tmpVet);
         }
         else
         {
             TempData["EM"] = "Такая запись уже существует";
         };
         return(RedirectToAction("Index"));
     }
     ViewBag.Page = "CtVet1b";
     return(View(tmpVet));
 }
Esempio n. 9
0
        public IActionResult Create()
        {
            int Y = Convert.ToInt32(User.Claims.ToList().FirstOrDefault(x => x.Type == "reportDtYear").Value);
            int M = Convert.ToInt32(User.Claims.ToList().FirstOrDefault(x => x.Type == "reportDtMonth").Value);

            ViewBag.RepMoList  = spDAL.RepMO1YearList(Y, M);
            ViewBag.KIDdivList = spDAL.KIDdivList(User.Claims.ToList().FirstOrDefault(x => x.Type == "KIDro").Value);
            ViewBag.KIDspcList = spDAL.KIDspcList();
            ViewBag.KIDdisList = spDAL.KIDdisList();
            ViewBag.testList   = spDAL.testList();
            CtVet1b tmp = new CtVet1b
            {
                KIDro = User.Claims.ToList().FirstOrDefault(x => x.Type == "KIDro").Value,
                repMO = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1),
                dtObs = DateTime.Now
            };

            ViewBag.Page = "CtVet1b";
            return(View(tmp));
        }