예제 #1
0
 public void See(SqlDataReader reader)
 {
     while (reader.Read())
     {
         String   s   = reader.GetString(0);
         String[] str = s.Split(',');
         for (int i = 0; i < str.Length; i++)
         {
             PayInf   inf;
             String[] h = str[i].Split('_');
             if (h.Length == 2)
             {
                 inf = new PayInf(Convert.ToDateTime(h[0]), Convert.ToDouble(h[1]));
             }
             else if (h.Length > 2)
             {
                 inf = new PayInf(Convert.ToDateTime(h[0]), Convert.ToDouble(h[1]), h[2]);
             }
             else
             {
                 break;
             }
             list.Add(inf);
             //count++;
         }
         YearComparer yc = new YearComparer();
         list.Sort(yc);
         for (int i = 0; i < list.Count; i++)
         {
             dataGridViewInf.Rows.Add(list[i].Date.ToShortDateString(), list[i].Pay, list[i].Notice);
         }
     }
     reader.Close();
 }
예제 #2
0
        public void Pay_FormClosing(object sender, FormClosingEventArgs e)
        {
            YearComparer comparer = new YearComparer();

            list.Sort(comparer);

            String str = "'";

            if (list.Count > 0)
            {
                str += list[0].Date.ToShortDateString() + "_" + list[0].Pay.ToString();
                if (list[0].Notice != "")
                {
                    str += "_" + list[0].Notice;
                }
            }
            for (int i = 1; i < list.Count; i++)
            {
                str += "," + list[i].Date.ToShortDateString() + "_" + list[i].Pay.ToString();
                if (list[i].Notice != "")
                {
                    str += "_" + list[i].Notice;
                }
            }
            str += "'";
            command.CommandText = "UPDATE Payments SET List = " + str + " WHERE Contract_num = '" + contract + "'";
            command.ExecuteNonQuery();

            command.CommandText = "SELECT List FROM Payments WHERE Contract_num = '" + contract + "'";
            SqlDataReader reader = command.ExecuteReader();

            Program.form.SqlReadDate(reader);

            Act act = new Act(contract, "", "", connection);

            //act.Calc(connection, contract);
            act.Dispose();
            Program.form.setButtonAct(true);
        }