protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int dichvu_ma = 0;

        try
        {
            dichvu_ma = Convert.ToInt32(Request.QueryString["loaidv_id"]);
        }
        catch (Exception ex) { }
        if (Validate(dichvu_ma))
        {
            String sqlText =
                "UPDATE loaidv SET tendv = @tendv " +
                "WHERE loaidv_id = @loaidv_id";
            clsConnect cn         = new clsConnect();
            int        Nparameter = 2;
            string[]   name       = new string[Nparameter];
            object[]   value      = new object[Nparameter];
            name[0]  = "@tendv ";
            value[0] = txtTen.Text;
            name[1]  = "@loaidv_id";
            value[1] = dichvu_ma;
            cn.UpdateData(sqlText, name, value, Nparameter);
            cn.close();
            String strURL = "cat_service.aspx?save=" + txtTen.Text;
            Response.Redirect(strURL);
        }
    }
예제 #2
0
    protected void btnSavemenu_Click(object sender, EventArgs e)
    {
        clsConnect cn  = new clsConnect();
        string     sql =
            "update chitietquyen set " +
            "quyen_xem = @quyen_xem, " +
            "quyen_sua = @quyen_sua, " +
            "quyen_them = @quyen_them, " +
            "quyen_xoa = @quyen_xoa " +
            "where quyen_ma=@quyen_ma and menu_id=@menu_id";
        int Nparameter = 6;

        string[] name  = new string[Nparameter];
        object[] value = new object[Nparameter];
        name[0]  = "@quyen_ma";
        name[1]  = "@menu_id";
        name[2]  = "@quyen_xem";
        name[3]  = "@quyen_them";
        name[4]  = "@quyen_sua";
        name[5]  = "@quyen_xoa";
        value[0] = Request.QueryString["quyen_ma"];
        for (int i = 0; i < rptquyenDetail.Items.Count; i++)
        {
            value[1] = ((Label)rptquyenDetail.Items[i].FindControl("lblMenuID")).Text;
            value[2] = ((CheckBox)rptquyenDetail.Items[i].FindControl("chkView")).Checked;
            value[3] = ((CheckBox)rptquyenDetail.Items[i].FindControl("chkAdd")).Checked;
            value[4] = ((CheckBox)rptquyenDetail.Items[i].FindControl("chkEdit")).Checked;
            value[5] = ((CheckBox)rptquyenDetail.Items[i].FindControl("chkDelete")).Checked;
            cn.UpdateData(sql, name, value, Nparameter);
        }
        cn.close();
        Response.Redirect("sys_authority.aspx?quyen_ma=" + Request.QueryString["quyen_ma"]);
    }
예제 #3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (CheckError())
     {
         clsConnect cn  = new clsConnect();
         string     sql =
             "UPDATE menu SET menu_title = @menu_title, menu_description = @menu_description, " +
             "menu_url= @menu_url, menu_order = @menu_order where menu_id=@menu_id ";
         int      Nparameter = 5;
         string[] name       = new string[Nparameter];
         name[0] = "@menu_title";
         name[1] = "@menu_description";
         name[2] = "@menu_url";
         name[3] = "@menu_id";
         name[4] = "@menu_order";
         object[] value = new object[Nparameter];
         value[0] = txtmenu_name.Text;
         value[1] = txtmenu_description.Text;
         value[2] = txtmenu_url.Text;
         value[3] = Request.QueryString["menu_id"];
         value[4] = txtMenuOrder.Text;
         cn.UpdateData(sql, name, value, Nparameter);
         cn.close();
         Response.Redirect("menu.aspx");
     }
 }
예제 #4
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int hanghoa_ma = 0;

        try
        {
            hanghoa_ma = Convert.ToInt32(Request.QueryString["service_type_id"]);
        }
        catch (Exception ex) { }
        if (Validate(hanghoa_ma))
        {
            String sqlText =
                "UPDATE service_type SET service_type_name = @service_type_name " +
                "WHERE service_type_id = @service_type_id";
            clsConnect cn         = new clsConnect();
            int        Nparameter = 2;
            string[]   name       = new string[Nparameter];
            object[]   value      = new object[Nparameter];
            name[0]  = "@service_type_name ";
            value[0] = txtTen.Text.ToUpper();
            name[1]  = "@service_type_id";
            value[1] = hanghoa_ma;
            cn.UpdateData(sqlText, name, value, Nparameter);
            cn.close();
            String strURL = "cat_service_type.aspx?save=1";
            Response.Redirect(strURL);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Convert.ToInt16(Session["Quyen_ma"]) == 0)
            {
                Response.Redirect("Default.aspx");
            }
            //createMenu(1);
            createMenu(Convert.ToInt16((Session["Quyen_ma"])));

            divUser.InnerHtml = "Xin chào, " + Session["username"].ToString();
            String     sqlText    = "SELECT * FROM NhanVien WHERE NhanVien_ma = @nhanvien_ma;";
            clsConnect cn         = new clsConnect();
            int        Nparameter = 1;
            string[]   name       = new string[Nparameter];
            name[0] = "@nhanvien_ma";
            object[] value = new object[Nparameter];
            value[0] = Session["NhanVien_ma"];
            DataTable dt = cn.LoadData(sqlText, name, value, Nparameter);
            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];

                divUser.InnerHtml = "Xin chào, " + row["NhanVien_ten"].ToString();
            }
            cn.close();
        }
    }
예제 #6
0
 protected void btnInsert_Click(object sender, EventArgs e)
 {
     if (Validate(0))
     {
         String sqlText =
             "INSERT INTO TaiKhoan(username,password,quyen_ma,nhanvien_ma,tu_donvi,den_donvi) VALUES( " +
             "@user,@password,@quyen_ma,@nhanvien_ma,@tu_donvi,@den_donvi);";
         clsConnect cn         = new clsConnect();
         int        Nparameter = 6;
         string[]   name       = new string[Nparameter];
         object[]   value      = new object[Nparameter];
         name[0]  = "@user";
         name[1]  = "@password";
         name[2]  = "@quyen_ma";
         name[3]  = "@nhanvien_ma";
         name[4]  = "@tu_donvi";
         name[5]  = "@den_donvi";
         value[0] = txtTen.Text.Trim();
         value[1] = txtMatKhau.Text.Trim();
         value[2] = ddlQuyen.Text;
         value[3] = ddlNhanVien.Text;
         value[4] = txtFrom.Text.Trim();
         value[5] = txtTo.Text.Trim();
         cn.UpdateData(sqlText, name, value, Nparameter);
         cn.close();
         String strURL = "sys_sercurity.aspx?add=1";
         Response.Redirect(strURL);
     }
 }
예제 #7
0
    private void CreateNodeChild(TreeNode Nparent, string quyen_ma, clsConnect cn)
    {
        string sql        = "select * from menu where menu_parent_id = @menu_parent_id ORDER BY menu_order, menu.menu_id";
        int    Nparameter = 1;

        string[] name  = new string[2];
        object[] value = new object[2];
        name[0]  = "@menu_parent_id";
        value[0] = Nparent.Value;
        foreach (DataRow row in cn.LoadData(sql, name, value, Nparameter).Rows)
        {
            TreeNode node_parent = new TreeNode(row["menu_title"].ToString(), row["menu_id"].ToString());
            Nparent.ChildNodes.Add(node_parent);
            //checked menu
            sql =
                "select * from menu, chitietquyen where menu.menu_id = chitietquyen.menu_id and " +
                "menu.menu_id = @menu_id and quyen_ma = @quyen_ma ORDER BY menu_parent_id, menu_order, menu.menu_id";
            Nparameter = 2;
            name[0]    = "@menu_id"; value[0] = node_parent.Value;
            name[1]    = "@quyen_ma"; value[1] = quyen_ma;
            if (cn.LoadData(sql, name, value, Nparameter).Rows.Count > 0)
            {
                node_parent.Checked = true;
            }
            CreateNodeChild(node_parent, quyen_ma, cn);
        }
    }
예제 #8
0
    private void dislaytremenu(string quyen_ma)
    {
        clsConnect cn  = new clsConnect();
        string     sql = "select * from menu where menu_parent_id = 0";

        foreach (DataRow row_root in cn.LoadData(sql).Rows)
        {
            TreeNode root = new TreeNode(row_root["menu_title"].ToString(), row_root["menu_id"].ToString());
            tremenu.Nodes.Add(root);
            sql =
                "select * from menu, chitietquyen where menu.menu_id = chitietquyen.menu_id and " +
                "menu.menu_id = @menu_id and quyen_ma = @quyen_ma ORDER BY menu_parent_id, menu_order, menu.menu_id";
            int      Nparameter = 2;
            string[] name       = new string[Nparameter];
            object[] value      = new object[Nparameter];
            name[0] = "@menu_id"; value[0] = root.Value;
            name[1] = "@quyen_ma"; value[1] = quyen_ma;
            if (cn.LoadData(sql, name, value, Nparameter).Rows.Count > 0)
            {
                root.Checked = true;
            }
            CreateNodeChild(root, quyen_ma, cn);
        }
        cn.close();
    }
예제 #9
0
 private bool Check_Error(int _IDSave)
 {
     lblMsg.BackColor = System.Drawing.Color.Yellow;
     if (txtquyen_ten.Text == "")
     {
         lblMsg.Text = "Vui lòng điền vào tên quyền.";
         return(false);
     }
     else
     {
         clsConnect cn         = new clsConnect();
         string     sql        = "select * from quyen where quyen = @quyen_ten and quyen_ma != @quyen_ma";
         int        Nparameter = 2;
         string[]   name       = new string[Nparameter];
         name[0] = "@quyen_ten";
         name[1] = "@quyen_ma";
         object[] value = new object[Nparameter];
         value[0] = txtquyen_ten.Text;
         value[1] = _IDSave;
         if (cn.LoadData(sql, name, value, Nparameter).Rows.Count > 0)
         {
             lblMsg.Text = "Tên quyền đã có rồi.Vui lòng nhập lại.";
             return(false);
         }
     }
     return(true);
 }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int id = 0;

        try
        {
            id = Convert.ToInt32(Request.QueryString["nhanvien_ma"]);
        }
        catch (Exception ex) { }
        if (Validate(id))
        {
            String sqlText =
                "UPDATE nhanvien SET nhanvien_ten = @nhanvien_ten " +
                "WHERE nhanvien_ma = @nhanvien_ma";
            clsConnect cn         = new clsConnect();
            int        Nparameter = 2;
            string[]   name       = new string[Nparameter];
            object[]   value      = new object[Nparameter];
            name[0]  = "@nhanvien_ten";
            name[1]  = "@nhanvien_ma";
            value[0] = txtTen.Text.Trim();
            value[1] = id;
            cn.UpdateData(sqlText, name, value, Nparameter);
            cn.close();
            String strURL = "sys_employee.aspx?save=1";
            Response.Redirect(strURL);
        }
    }
예제 #11
0
 protected void ddlServiceType_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         clsConnect cn         = new clsConnect();
         int        Nparameter = 1;
         string[]   name       = new string[Nparameter];
         object[]   value      = new object[Nparameter];
         string     sql        = "";
         DataTable  dt         = new DataTable();
         if (ddlServiceType.Text != "0")
         {
             sql        = "SELECT * FROM service WHERE service_type_id=?service_type_id";
             Nparameter = 1;
             name[0]    = "?service_type_id";
             value[0]   = ddlServiceType.Text;
             dt         = cn.LoadData(sql, name, value, Nparameter);
             if (dt.Rows.Count > 0)
             {
                 ddlService.DataSource = dt;
                 ddlService.DataBind();
             }
         }
     }
     catch (Exception)
     {
     }
 }
예제 #12
0
    private void dislayGrid_quyen()
    {
        clsConnect cn  = new clsConnect();
        string     sql = "select * from quyen";

        gridauthority.DataSource = cn.LoadData(sql);
        gridauthority.DataBind();
        cn.close();
    }
예제 #13
0
    protected void btnAddmenu_Click(object sender, EventArgs e)
    {
        clsConnect cn = new clsConnect();

        foreach (TreeNode node in tremenu.Nodes)
        {
            insertmenu(node, cn);
        }
        cn.close();
        dislayGrid_quyen_detail(Request.QueryString["quyen_ma"]);
        Response.Redirect("sys_authority.aspx?quyen_ma=" + Request.QueryString["quyen_ma"]);
    }
예제 #14
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (CheckError())
        {
            clsConnect cn  = new clsConnect();
            string     sql = "INSERT INTO menu(menu_title,menu_description,menu_url,menu_valuepath,menu_parent_id, menu_order) " +
                             "VALUES(@menu_title,@menu_description,@menu_url,@menu_valuepath,@menu_parent_id, @menu_order)";


            int      Nparameter = 6;
            string[] name       = new string[Nparameter];
            name[0] = "@menu_valuepath";
            name[1] = "@menu_description";
            name[2] = "@menu_url";
            name[3] = "@menu_title";
            name[4] = "@menu_parent_id";
            name[5] = "@menu_order";
            object[] value = new object[Nparameter];
            value[0] = "";
            if (tremenu.SelectedNode != null)
            {
                value[0] = tremenu.SelectedNode.ValuePath;
            }
            value[1] = txtmenu_description.Text;
            value[2] = txtmenu_url.Text;
            value[3] = txtmenu_name.Text;
            if (Request.QueryString["menu_id"] == null)
            {
                value[4] = 0;
            }
            else
            {
                value[4] = tremenu.SelectedValue;
            }
            value[5] = txtMenuOrder.Text;
            cn.UpdateData(sql, name, value, Nparameter);
            string menu_id = cn.LoadData("SELECT * FROM menu WHERE menu_id IN(SELECT TOP 1(menu_id) FROM menu ORDER BY menu_id desc)").Rows[0][0].ToString();
            value[0] = value[0].ToString() + "/" + menu_id;
            if (Request.QueryString["menu_id"] == null)
            {
                value[0] = menu_id;
            }
            cn.UpdateData("UPDATE menu SET menu_valuepath=@menu_valuepath WHERE menu_id=" + menu_id, name, value, 1);
            cn.close();
            String strURL = "menu.aspx?menu_id=" + menu_id + "&sub_menu=1";
            if (Request.QueryString["menu_id"] != null)
            {
                strURL = "menu.aspx?menu_id=" + Request.QueryString["menu_id"].ToString() + "&sub_menu=1";
            }
            Response.Redirect(strURL);
        }
    }
예제 #15
0
    private void Delete_Menu(string smenu_ID)
    {
        clsConnect cn      = new clsConnect();
        string     sqlText = "DELETE FROM menu WHERE menu_id = @menu_id ";

        string[] name       = new string[1];
        object[] value      = new object[1];
        int      Nparameter = 1;

        name[0]  = "@menu_id";
        value[0] = smenu_ID;
        cn.UpdateData(sqlText, name, value, Nparameter);
        cn.close();
    }
예제 #16
0
    protected void DeleteIDList(String id)
    {
        //room_type table
        String     sqlText    = "DELETE FROM service WHERE service_id = ?service_id";
        clsConnect cn         = new clsConnect();
        int        Nparameter = 1;

        string[] name  = new string[Nparameter];
        object[] value = new object[Nparameter];
        name[0]  = "?service_id";
        value[0] = id;
        cn.UpdateData(sqlText, name, value, Nparameter);
        cn.close();
    }
예제 #17
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        clsConnect cn         = new clsConnect();
        string     sql        = "delete from quyen where quyen_ma=@quyen_ma";
        int        Nparameter = 1;

        string[] name = new string[Nparameter];
        name[0] = "@quyen_ma";
        object[] value = new object[Nparameter];
        value[0] = Request.QueryString["quyen_ma"];
        cn.UpdateData(sql, name, value, Nparameter);
        cn.close();
        Response.Redirect("sys_authority.aspx");
    }
예제 #18
0
    private void dislayGrid_quyen_detail(string quyen_ma)
    {
        clsConnect cn         = new clsConnect();
        string     sql        = "select * from chitietquyen,menu where chitietquyen.menu_id=menu.menu_id and quyen_ma=@quyen_ma ";
        int        Nparameter = 1;

        string[] name = new string[Nparameter];
        name[0] = "@quyen_ma";
        object[] value = new object[Nparameter];
        value[0] = quyen_ma;
        rptquyenDetail.DataSource = cn.LoadData(sql, name, value, Nparameter);
        rptquyenDetail.DataBind();
        cn.close();
    }
예제 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            clsConnect cn         = new clsConnect();
            int        Nparameter = 10;
            string[]   name       = new string[Nparameter];
            object[]   value      = new object[Nparameter];
            Page.SetFocus(txtmenu_name);
            dislayTremenu();
            if (Request.QueryString["Menu_ID"] != null)
            {
                string menu_id = Request.QueryString["Menu_ID"].ToString();

                string valuepath = cn.LoadData("SELECT * FROM Menu where Menu_ID=" + menu_id + " ORDER BY menu_order").Rows[0]["menu_valuepath"].ToString();

                tremenu.FindNode(valuepath).Selected = true;
                lblmenu.Text = tremenu.SelectedNode.Text;
                if (Request.QueryString["sub_menu"] == null)
                {
                    rdbMenu.SelectedIndex = 1;
                }
                rdbMenu_SelectedIndexChanged(sender, e);
            }

            #region phan quyen trang
            try
            {
                string sqlText = "select * from ChiTietQuyen CT JOIN Menu M ON CT.Menu_id=M.Menu_id " +
                                 "WHERE Quyen_ma=@quyen_ma AND menu_url=@menu";
                Nparameter = 2;
                name[0]    = "@quyen_ma";
                name[1]    = "@menu";
                value[0]   = Session["Quyen_ma"];
                value[1]   = Request.Url.Segments[Request.Url.Segments.Length - 1].ToString();
                DataTable dt3 = cn.LoadData(sqlText, name, value, Nparameter);
                //kiem tra xem url nhap vao co chinh xac khong
                if (dt3.Rows.Count == 0)
                {
                    Response.Redirect("access_denied.aspx");
                }
            }
            catch (Exception)
            {
            }

            #endregion
            cn.close();
        }
    }
예제 #20
0
    protected void DeleteCarBranchList(String sCarBranchID)
    {
        //room_type table
        String     sqlText = "DELETE FROM service_type WHERE service_type_id = @service_type_id";
        clsConnect cn      = new clsConnect();

        string[] name       = new string[1];
        object[] value      = new object[1];
        int      Nparameter = 1;

        name[0]  = "@service_type_id";
        value[0] = sCarBranchID;
        cn.UpdateData(sqlText, name, value, Nparameter);
        cn.close();
    }
    private void createMenu(int quyen_ma)
    {
        clsConnect cn = new clsConnect();
        DataTable  dt = cn.LoadData("select * from Menu, ChiTietQuyen where Menu.Menu_ID=ChiTietQuyen.Menu_ID and Quyen_ma=" + quyen_ma + " ORDER BY menu_parent_id, menu_order, Menu.Menu_ID");

        if (dt.Rows.Count == 0)
        {
            mnuTools.Visible = false;
        }
        else
        {
            createMenuItem(dt);
        }
        cn.close();
    }
예제 #22
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (Check_Error(0))
     {
         clsConnect cn         = new clsConnect();
         string     sql        = "insert into quyen(quyen) values(@quyen)";
         int        Nparameter = 1;
         string[]   name       = new string[Nparameter];
         name[0] = "@quyen";
         object[] value = new object[Nparameter];
         value[0] = txtquyen_ten.Text;
         cn.UpdateData(sql, name, value, Nparameter);
         string quyen_ma = cn.LoadData("select * from quyen WHERE quyen_ma IN(SELECT TOP 1(quyen_ma) FROM quyen ORDER BY quyen_ma DESC)").Rows[0][0].ToString();
         cn.close();
         Response.Redirect("sys_authority.aspx");//?quyen_ma=" + quyen_ma);
     }
 }
예제 #23
0
    private void LoadData(string menu_id)
    {
        clsConnect cn         = new clsConnect();
        int        Nparameter = 1;

        string[] name = new string[Nparameter];
        name[0] = "@menu_id";
        object[] value = new object[Nparameter];
        value[0] = menu_id;
        DataRow row = cn.LoadData("SELECT * FROM menu where menu_id=@menu_id", name, value, Nparameter).Rows[0];

        cn.close();
        txtmenu_name.Text        = row["menu_title"].ToString();
        txtmenu_description.Text = row["menu_description"].ToString();
        txtmenu_url.Text         = row["menu_url"].ToString();
        txtMenuOrder.Text        = row["menu_order"].ToString();
    }
예제 #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack)
        {
            return;
        }
        {
            clsConnect cn       = new clsConnect();
            string     quyen_ma = Convert.ToString(Request.QueryString["quyen_ma"]);
            if (quyen_ma == null)
            {
                setButton(true);
            }
            else
            {
                setButton(false);
                LoadData(quyen_ma);
            }
            dislayGrid_quyen();
            #region phan quyen trang
            try
            {
                string sqlText = "select * from chitietquyen CT JOIN menu M ON CT.menu_id=M.menu_id " +
                                 "WHERE quyen_ma=@quyen_ma AND menu_url=@menu";
                int      Nparameter = 2;
                string[] name       = new string[Nparameter];
                object[] value      = new object[Nparameter];
                name[0]  = "@quyen_ma";
                name[1]  = "@menu";
                value[0] = Session["quyen_ma"];
                value[1] = Request.Url.Segments[Request.Url.Segments.Length - 1].ToString();
                DataTable dt3 = cn.LoadData(sqlText, name, value, Nparameter);
                //kiem tra xem url nhap vao co chinh xac khong
                if (dt3.Rows.Count == 0)
                {
                    Response.Redirect("access_denied.aspx");
                }
            }
            catch (Exception)
            {
            }

            #endregion
        }
    }
    private bool SearchPassword()
    {
        clsConnect cn        = new clsConnect();
        string     sql       = "";
        int        parameter = 5;

        string[] name  = new string[parameter];
        object[] value = new object[parameter];
        if (txtPassWordReNew.Text.Trim().ToUpper() != txtPassWordNew.Text.Trim().ToUpper())
        {
            lblMsg.Text      = "Mật khẩu mới không hợp lệ.";
            lblMsg.ForeColor = System.Drawing.Color.Red;
            return(false);
        }
        else
        {
            sql       = "SELECT * FROM taikhoan WHERE nhanvien_ma=@nhanvien_ma";
            parameter = 1;
            name[0]   = "@nhanvien_ma";
            value[0]  = Session["nhanvien_ma"].ToString();
            DataTable dt = cn.LoadData(sql, name, value, parameter);
            if (dt.Rows.Count == 0)
            {
                cn.close();
                return(false);
            }
            lblUserName.Text = dt.Rows[0]["username"].ToString();
            sql       = "SELECT * FROM taikhoan WHERE username=@username AND password=@password";
            parameter = 2;
            name[0]   = "@username";
            name[1]   = "@password";
            value[0]  = lblUserName.Text.Trim();
            value[1]  = txtPassWord.Text.Trim();
            dt        = cn.LoadData(sql, name, value, parameter);
            if (dt.Rows.Count > 0)
            {
                cn.close();
                return(true);
            }
            lblMsg.Text      = "Mật khẩu không đúng.";
            lblMsg.ForeColor = System.Drawing.Color.Red;
            cn.close();
            return(false);
        }
    }
예제 #26
0
 protected void btnInsert_Click(object sender, EventArgs e)
 {
     if (Validate(0))
     {
         String sqlText =
             "INSERT INTO service_type(service_type_name) VALUES(@service_type_name);";
         clsConnect cn         = new clsConnect();
         int        Nparameter = 1;
         string[]   name       = new string[Nparameter];
         object[]   value      = new object[Nparameter];
         name[0]  = "@service_type_name";
         value[0] = txtTen.Text.ToUpper();
         cn.UpdateData(sqlText, name, value, Nparameter);
         cn.close();
         String strURL = "cat_service_type.aspx?add=" + txtTen.Text;
         Response.Redirect(strURL);
     }
 }
예제 #27
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Check_Error(Convert.ToInt32(Request.QueryString["quyen_ma"])))
     {
         clsConnect cn         = new clsConnect();
         string     sql        = "update quyen set quyen = @quyen_ten where quyen_ma=@quyen_ma";
         int        Nparameter = 2;
         string[]   name       = new string[Nparameter];
         name[0] = "@quyen_ten";
         name[1] = "@quyen_ma";
         object[] value = new object[Nparameter];
         value[0] = txtquyen_ten.Text;
         value[1] = Request.QueryString["quyen_ma"];
         cn.UpdateData(sql, name, value, Nparameter);
         cn.close();
         Response.Redirect("sys_authority.aspx");
     }
 }
 protected void btnInsert_Click(object sender, EventArgs e)
 {
     if (Validate(0))
     {
         String sqlText =
             "INSERT INTO nhanvien(nhanvien_ten) VALUES( " +
             "@nhanvien_ten);";
         clsConnect cn         = new clsConnect();
         int        Nparameter = 1;
         string[]   name       = new string[Nparameter];
         object[]   value      = new object[Nparameter];
         name[0]  = "@nhanvien_ten";
         value[0] = txtTen.Text.Trim();
         cn.UpdateData(sqlText, name, value, Nparameter);
         cn.close();
         String strURL = "sys_employee.aspx?add=1";
         Response.Redirect(strURL);
     }
 }
예제 #29
0
    private void LoadData(string quyen_ma)
    {
        clsConnect cn         = new clsConnect();
        int        Nparameter = 1;

        string[] name = new string[Nparameter];
        name[0] = "@quyen_ma";
        object[] value = new object[Nparameter];
        value[0] = quyen_ma;
        DataTable dt  = cn.LoadData("select * from quyen where quyen_ma = @quyen_ma ", name, value, Nparameter);
        DataRow   row = dt.Rows[0];

        txtquyen_ten.Text = row["quyen"].ToString();
        cn.close();
        divmenu.Visible = true;
        lblquyen.Text   = row["quyen"].ToString();
        dislaytremenu(row["quyen_ma"].ToString());
        dislayGrid_quyen_detail(row["quyen_ma"].ToString());
    }
    private void createMenuItem(DataTable table)
    {
        clsConnect cn = new clsConnect();

        foreach (DataRow row in table.Rows)
        {
            string[] strValuepath    = row["menu_valuepath"].ToString().Split('/');
            string   valuepathParent = "";
            for (int i = 0; i < strValuepath.Length; i++)
            {
                DataRow  temp = cn.LoadData("select * from Menu where Menu_ID=" + strValuepath[i]).Rows[0];
                MenuItem item = new MenuItem();
                if (i == 0 || i == 1)
                {
                    valuepathParent = strValuepath[0];
                }
                else
                {
                    valuepathParent += "/" + strValuepath[i - 1];
                }
                item = mnuTools.FindItem(temp["menu_valuepath"].ToString());
                if (item == null)
                {
                    MenuItem itemtemp = new MenuItem();
                    itemtemp.Text        = temp["Menu_title"].ToString();
                    itemtemp.Value       = temp["Menu_ID"].ToString();
                    itemtemp.NavigateUrl = temp["menu_url"].ToString();
                    itemtemp.ToolTip     = temp["menu_description"].ToString();
                    if (i == 0)
                    {
                        mnuTools.Items.Add(itemtemp);
                    }
                    else
                    {
                        //itemtemp.Text = "<img src='../images/menu/icon-16-menu.png'/>" + temp["menu_title"].ToString();
                        mnuTools.FindItem(valuepathParent).ChildItems.Add(itemtemp);
                    }
                }
            }
        }
        cn.close();
    }