Example #1
0
 private void f_Luu_Quyen()
 {
     ttQuyen_Luu.Enabled = false;
     this.Cursor         = Cursors.AppStarting;
     try
     {
         ttProgress.Minimum = 0;
         ttProgress.Value   = 0;
         ttProgress.Maximum = m_dsquyen.Tables[0].Rows.Count;
         ttProgress.Visible = true;
         ttStatus.Text      = lan.Change_language_MessageText("Đang lưu, xin chờ!");
         statusStrip1.Refresh();
         string aid = "", aloai = "";
         try
         {
             int i = treeView1.SelectedNode.Parent == null ? 0 : 1;
             aid   = treeView1.SelectedNode.Tag.ToString().Split(':')[i];
             aloai = treeView1.SelectedNode.Parent == null ? "N" : "U";
         }
         catch
         {
             aid = "";
         }
         if (aid != "" && aid != "?")
         {
             if (aloai == "N")
             {
                 m_v.del_v_phanquyennhom(aid);
                 foreach (DataRow r in m_dsquyen.Tables[0].Rows)
                 {
                     m_v.upd_v_phanquyennhom(decimal.Parse(aid), r["menuname"].ToString(), decimal.Parse(r["chon"].ToString()), r["chitiet"].ToString());
                     ttProgress.Value = ttProgress.Value + 1;
                     statusStrip1.Refresh();
                 }
             }
             else
             {
                 m_v.del_v_phanquyen(aid);
                 foreach (DataRow r in m_dsquyen.Tables[0].Rows)
                 {
                     m_v.upd_v_phanquyen(decimal.Parse(aid), r["menuname"].ToString(), decimal.Parse(r["chon"].ToString()), r["chitiet"].ToString());
                     ttProgress.Value = ttProgress.Value + 1;
                     statusStrip1.Refresh();
                 }
             }
         }
     }
     catch
     {
     }
     finally
     {
         this.Cursor         = Cursors.Default;
         ttQuyen_Luu.Enabled = true;
         ttProgress.Visible  = false;
         ttStatus.Text       = lan.Change_language_MessageText("Lưu thành công!");
         this.Cursor         = Cursors.Default;
     }
 }