示例#1
0
 private void butSave_Click(object sender, EventArgs e)
 {
     try
     {
         m_ds.AcceptChanges();
         butSave.Enabled    = false;
         butClose.Enabled   = false;
         ttProgress.Visible = true;
         ttProgress.Minimum = 0;
         ttProgress.Value   = 0;
         ttProgress.Maximum = m_ds.Tables[0].Rows.Count;
         ttStatus.Text      = lan.Change_language_MessageText("Đang lưu ...");
         this.Refresh();
         m_v.del_v_viettat();
         decimal astt = 0, areadonly = 0;
         foreach (DataRow r in m_ds.Tables[0].Rows)
         {
             try
             {
                 astt = decimal.Parse(r["stt"].ToString());
             }
             catch
             {
                 astt = 1;
             }
             try
             {
                 areadonly = decimal.Parse(r["readonly"].ToString());
             }
             catch
             {
                 areadonly = 0;
             }
             try
             {
                 if (r["ma"].ToString().Trim() != "" && r["ten"].ToString().Trim() != "")
                 {
                     m_v.upd_v_viettat(astt, r["ma"].ToString(), r["ten"].ToString(), areadonly);
                 }
             }
             catch
             {
             }
             ttProgress.Value = ttProgress.Value + 1;
             statusStrip1.Refresh();
         }
     }
     catch
     {
     }
     finally
     {
         f_Load_Viettat();
         butSave.Enabled    = true;
         butClose.Enabled   = true;
         ttProgress.Visible = false;
         ttStatus.Text      = "";
     }
 }