コード例 #1
0
 public string Save(NewMemberCard x)
 {
     try {
         using (SqlConnection connection = new SqlConnection(G.connectionString)) {
             connection.Open();
             string sql = null;
             if (x.id == null)
             {
                 sql = string.Format(@"INSERT INTO MemberCards
                             VALUES ('{0}', '{1}', N'{2}', N'{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', N'{10}', N'{11}', N'{12}', N'{13}', N'{14}', N'{15}', N'{16}'
                             , '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', '{25}', '{26}', '{27}', '{28}', '{29}', '{30}', '{31}', '{32}', '{33}', '{34}', '{35}', '{36}', N'{37}' )"
                                     , x.memberId, x.recordDate, x.trupPretklon, x.ramenaIskretPalicom, x.leptir_25m, x.ledno_25m, x.prsno_25m, x.kraul_25m, x.nogeBicikla_25m, x.nogePrsno_25m, x.kraul_25m_vrijeme, x.nogeKraul_25m_vrijeme, x.nogePrsno_25m_vrijeme
                                     , x.WPKraul_25m_vrijeme, x.vodenjeLopte_25m_vrijeme, x.kraul_100m_vrijeme, x.kraul_200m_vrijeme, x.hodanjeBlok_10m, x.mahanjeSLoptom_25m, x.blokSPromjenomRuke_25m, x.testOkretnosti, x.visinaSkokaIzVode, x.bacanjeLopteUDalj
                                     , x.izdrzajNogeBiciklaSMedicinkom, x.preciznostSuta, x.klizanjeIzmeduStativa, x.prsno25m, x.prsno50m, x.prsno100m, x.sklekovi, x.trbuh, x.cucanj, x.prednjiUpor, x.izdrzajUZgibu, x.bacanjeMedicinkeSPrsa, x.skokUDalj, x.bacanjeMedicinkeIzLezanja, x.note);
             }
             else
             {
                 sql = string.Format(@"UPDATE MemberCards SET  
                                 RecordDate = '{1}', TrupPretklon = '{2}', RamenaIskretPalicom = '{3}', Leptir_25m = {4}, Ledno_25m = {5}, Prsno_25m = {6}, Kraul_25m = {7}, NogeBicikla_25m = {8}, NogePrsno_25m = {9}, Kraul_25m_vrijeme = '{10}', NogeKraul_25m_vrijeme = '{11}'
                                 , NogePrsno_25m_vrijeme = '{12}', WPKraul_25m_vrijeme = '{13}', VodenjeLopte_25m_vrijeme = '{14}', Kraul_100m_vrijeme = '{15}', Kraul_200m_vrijeme = '{16}', HodanjeBlok_10m = '{17}', MahanjeSLoptom_25m = '{18}', BlokSPromjenomRuke_25m = '{19}', TestOkretnosti = N'{20}', VisinaSkokaIzVode = N'{21}', BacanjeLopteUDalj = N'{21}', IzdrzajNogeBiciklaSMedicinkom = N'{22}'
                                 , PreciznostSuta = N'{23}', KlizanjeIzmeduStativa = N'{24}', Prsno25m = '{25}', Prsno50m = '{26}', Prsno100m = '{27}', Sklekovi = '{28}', Trbuh = '{29}', Cucanj = '{30}', PrednjiUpor = '{31}', IzdrzajUZgibu = '{32}', BacanjeMedicinkeSPrsa = '{33}', SkokUDalj = '{34}', BacanjeMedicinkeIzLezanja = '{35}', Note = N'{36}'
                                 WHERE Id = '{0}'"
                                     , x.id, x.recordDate, x.trupPretklon, x.ramenaIskretPalicom, x.leptir_25m, x.ledno_25m, x.prsno_25m, x.kraul_25m, x.nogeBicikla_25m, x.nogePrsno_25m, x.kraul_25m_vrijeme, x.nogeKraul_25m_vrijeme, x.nogePrsno_25m_vrijeme
                                     , x.WPKraul_25m_vrijeme, x.vodenjeLopte_25m_vrijeme, x.kraul_100m_vrijeme, x.kraul_200m_vrijeme, x.hodanjeBlok_10m, x.mahanjeSLoptom_25m, x.blokSPromjenomRuke_25m, x.testOkretnosti, x.visinaSkokaIzVode, x.bacanjeLopteUDalj, x.izdrzajNogeBiciklaSMedicinkom, x.preciznostSuta
                                     , x.klizanjeIzmeduStativa, x.prsno25m, x.prsno50m, x.prsno100m, x.sklekovi, x.trbuh, x.cucanj, x.prednjiUpor, x.izdrzajUZgibu, x.bacanjeMedicinkeSPrsa, x.skokUDalj, x.bacanjeMedicinkeIzLezanja, x.note);
             }
             using (SqlCommand command = new SqlCommand(sql, connection)) {
                 command.ExecuteNonQuery();
             }
             connection.Close();
         }
         return(JsonConvert.SerializeObject("Spremljeno", Formatting.None));
     } catch (Exception e) { return(JsonConvert.SerializeObject(e.Message, Formatting.None)); }
 }
コード例 #2
0
 public string Delete(NewMemberCard x)
 {
     try {
         string sql = string.Format(@"DELETE MemberCards WHERE Id = {0}", x.id);
         using (SqlConnection connection = new SqlConnection(G.connectionString)) {
             connection.Open();
             using (SqlCommand command = new SqlCommand(sql, connection)) {
                 command.ExecuteNonQuery();
             }
             connection.Close();
         }
         return(JsonConvert.SerializeObject(GetData(x.memberId), Formatting.None));
     } catch (Exception e) { return(JsonConvert.SerializeObject(e.Message, Formatting.None)); }
 }
コード例 #3
0
    public string Init()
    {
        NewMemberCard x = new NewMemberCard();

        x.id                            = null;
        x.memberId                      = null;
        x.recordDate                    = null;
        x.trupPretklon                  = null;
        x.ramenaIskretPalicom           = null;
        x.leptir_25m                    = 0;
        x.ledno_25m                     = 0;
        x.prsno_25m                     = 0;
        x.kraul_25m                     = 0;
        x.nogeBicikla_25m               = 0;
        x.nogePrsno_25m                 = 0;
        x.kraul_25m_vrijeme             = null;
        x.nogeKraul_25m_vrijeme         = null;
        x.nogePrsno_25m_vrijeme         = null;
        x.WPKraul_25m_vrijeme           = null;
        x.vodenjeLopte_25m_vrijeme      = null;
        x.kraul_100m_vrijeme            = null;
        x.kraul_200m_vrijeme            = null;
        x.hodanjeBlok_10m               = null;
        x.mahanjeSLoptom_25m            = null;
        x.blokSPromjenomRuke_25m        = null;
        x.testOkretnosti                = null;
        x.visinaSkokaIzVode             = null;
        x.bacanjeLopteUDalj             = null;
        x.izdrzajNogeBiciklaSMedicinkom = null;
        x.preciznostSuta                = null;
        x.klizanjeIzmeduStativa         = null;
        x.prsno25m                      = null;
        x.prsno50m                      = null;
        x.prsno100m                     = null;
        x.sklekovi                      = null;
        x.trbuh                         = null;
        x.cucanj                        = null;
        x.prednjiUpor                   = null;
        x.izdrzajUZgibu                 = null;
        x.bacanjeMedicinkeSPrsa         = null;
        x.skokUDalj                     = null;
        x.bacanjeMedicinkeIzLezanja     = null;
        x.note                          = null;
        return(JsonConvert.SerializeObject(x, Formatting.Indented));
    }
コード例 #4
0
    private NewMemberCard ReadData(SqlDataReader reader)
    {
        NewMemberCard x = new NewMemberCard();

        x.id                            = G.ReadI(reader, 0);
        x.memberId                      = G.ReadI(reader, 1);
        x.recordDate                    = G.ReadS(reader, 2);
        x.trupPretklon                  = G.ReadS(reader, 3);
        x.ramenaIskretPalicom           = G.ReadS(reader, 4);
        x.leptir_25m                    = G.ReadI(reader, 5);
        x.ledno_25m                     = G.ReadI(reader, 6);
        x.prsno_25m                     = G.ReadI(reader, 7);
        x.kraul_25m                     = G.ReadI(reader, 8);
        x.nogeBicikla_25m               = G.ReadI(reader, 9);
        x.nogePrsno_25m                 = G.ReadI(reader, 10);
        x.kraul_25m_vrijeme             = G.ReadS(reader, 11);
        x.nogeKraul_25m_vrijeme         = G.ReadS(reader, 12);
        x.nogePrsno_25m_vrijeme         = G.ReadS(reader, 13);
        x.WPKraul_25m_vrijeme           = G.ReadS(reader, 14);
        x.vodenjeLopte_25m_vrijeme      = G.ReadS(reader, 15);
        x.kraul_100m_vrijeme            = G.ReadS(reader, 16);
        x.kraul_200m_vrijeme            = G.ReadS(reader, 17);
        x.hodanjeBlok_10m               = G.ReadS(reader, 18);
        x.mahanjeSLoptom_25m            = G.ReadS(reader, 19);
        x.blokSPromjenomRuke_25m        = G.ReadS(reader, 20);
        x.testOkretnosti                = G.ReadS(reader, 21);
        x.visinaSkokaIzVode             = G.ReadS(reader, 22);
        x.bacanjeLopteUDalj             = G.ReadS(reader, 23);
        x.izdrzajNogeBiciklaSMedicinkom = G.ReadS(reader, 24);
        x.preciznostSuta                = G.ReadS(reader, 25);
        x.klizanjeIzmeduStativa         = G.ReadS(reader, 26);
        x.prsno25m                      = G.ReadS(reader, 27);
        x.prsno50m                      = G.ReadS(reader, 28);
        x.prsno100m                     = G.ReadS(reader, 29);
        x.sklekovi                      = G.ReadS(reader, 30);
        x.trbuh                         = G.ReadS(reader, 31);
        x.cucanj                        = G.ReadS(reader, 32);
        x.prednjiUpor                   = G.ReadS(reader, 33);
        x.izdrzajUZgibu                 = G.ReadS(reader, 34);
        x.bacanjeMedicinkeSPrsa         = G.ReadS(reader, 35);
        x.skokUDalj                     = G.ReadS(reader, 36);
        x.bacanjeMedicinkeIzLezanja     = G.ReadS(reader, 37);
        x.note                          = G.ReadS(reader, 38);
        return(x);
    }
コード例 #5
0
    public List <NewMemberCard> GetData(int?memberId)
    {
        string sql = string.Format(@"{0} WHERE mc.MemberId = {1}", main_sql, memberId);
        List <NewMemberCard> xx = new List <NewMemberCard>();

        using (SqlConnection connection = new SqlConnection(G.connectionString)) {
            connection.Open();
            using (SqlCommand command = new SqlCommand(sql, connection)) {
                using (SqlDataReader reader = command.ExecuteReader()) {
                    while (reader.Read())
                    {
                        NewMemberCard x = ReadData(reader);
                        xx.Add(x);
                    }
                }
            }
            connection.Close();
        }
        return(xx);
    }
コード例 #6
0
 public string Get(int id)
 {
     try {
         string        sql = string.Format(@"{0} WHERE mc.Id = {1}", main_sql, id);
         NewMemberCard x   = new NewMemberCard();
         using (SqlConnection connection = new SqlConnection(G.connectionString)) {
             connection.Open();
             using (SqlCommand command = new SqlCommand(sql, connection)) {
                 using (SqlDataReader reader = command.ExecuteReader()) {
                     while (reader.Read())
                     {
                         x = ReadData(reader);
                     }
                 }
             }
             connection.Close();
         }
         return(JsonConvert.SerializeObject(x, Formatting.None));
     } catch (Exception e) { return(JsonConvert.SerializeObject(e.Message, Formatting.None)); }
 }
コード例 #7
0
 public string Load()
 {
     try {
         string sql = @"SELECT Id FROM MemberCards";
         List <NewMemberCard> xx = new List <NewMemberCard>();
         using (SqlConnection connection = new SqlConnection(G.connectionString)) {
             connection.Open();
             using (SqlCommand command = new SqlCommand(sql, connection)) {
                 using (SqlDataReader reader = command.ExecuteReader()) {
                     while (reader.Read())
                     {
                         NewMemberCard x = new NewMemberCard();
                         x.id = G.ReadI(reader, 0);
                         xx.Add(x);
                     }
                 }
                 connection.Close();
             }
         }
         return(JsonConvert.SerializeObject(xx, Formatting.None));
     } catch (Exception e) { return(JsonConvert.SerializeObject(e.Message, Formatting.None)); }
 }