Beispiel #1
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            foreach (TreeNode nodeparent in trview_grant.Nodes)
            {
                DuyetCay(nodeparent);
            }

            foreach (ListItem item in lst_Box2.Items)
            {
                int            User_ID       = Int16.Parse(item.Value);
                int            Group_ID      = Int16.Parse(drpd_NhomNguoi.SelectedValue);
                SqlParameter[] prUSER_GROUP  = { new SqlParameter("@User_ID", User_ID), new SqlParameter("@Group_ID", Group_ID) };
                object         User_Group_ID = cm.ExecuteScalarProcedure("[AddUserGroup]", prUSER_GROUP);
                foreach (String itemModul in module)
                {
                    String[]       value               = itemModul.Split('@');
                    int            Parent_ID           = Int16.Parse(value[0]);
                    int            Module_ID           = Int16.Parse(value[1]);
                    SqlParameter[] prUSER_GROUP_MODULE = { new SqlParameter("@User_Group_ID", User_Group_ID), new SqlParameter("@Module_ID", Module_ID), new SqlParameter("@Parent_ID", Parent_ID) };
                    cm.ExecuteProcedure("AddUSER_GROUP_MODULE", prUSER_GROUP_MODULE);
                }
            }
            string script = "alert(\"Lưu thành công!\");";

            ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);

            //SqlParameter[] pr = { new SqlParameter("@User_ID", DBNull.Value), new SqlParameter("@Group_ID", DBNull.Value) };
            //for (int i = 0; i < lst_Box2.Items.Count; i++)
            //{
            //    lst_Box2.DataSource = cm.getTableStoreprocedure("AddUserGroup", pr);

            //}
            //for (int i = 0; i < module.Count; i++)
            //{

            //    string sql = "Select"
            //}
        }