Пример #1
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sSc = "<script>\n";

        sSc += "alert('Đang tồn tại thông tin khác trong bài này!');\n";
        sSc += "</script>\n";
        switch (e.CommandName)
        {
        case "del":
            string iddel = e.CommandArgument.ToString();
            UpdateData.Delete("tbl_Config", "Config_ID=" + iddel);
            FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Xoá", "Bài: " + FunctionDB.GetName("Content", iddel.ToString()));
            BindData();
            break;

        case "isUse":
            string            id01  = e.CommandArgument.ToString();
            DataSet           dsU   = UpdateData.UpdateBySql("SELECT Config_Status FROM tbl_Config WHERE Config_ID=" + id01);
            DataRowCollection rowsU = dsU.Tables[0].Rows;
            bool isUse = false;
            isUse = Convert.ToBoolean(rowsU[0]["Config_Status"]);
            if (isUse)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Config SET Config_Status=0 WHERE Config_ID=" + id01);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Config SET Config_Status=1 WHERE Config_ID=" + id01);
            }
            BindData();
            break;
        }
    }
Пример #2
0
 protected void lbtDelAll_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow item in gvData.Rows)
     {
         CheckBox cbItem = (CheckBox)item.FindControl("cbItem");
         if (cbItem.Checked)
         {
             int id = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
             try
             {
                 if (UpdateData.Delete("tbl_ModsiteUser", "User_ID=" + id))
                 {
                     if (UpdateData.Delete("tbl_ModUser", "UserID=" + id))
                     {
                         UpdateData.Delete("tbl_User", "User_ID=" + id);
                     }
                 }
             }
             catch (Exception)
             {
                 string sSc = "<script>\n";
                 sSc += "alert('Đang tồn tại các dữ liệu liên quan đến user này!');\n";
                 sSc += "</script>\n";
                 Response.Write(sSc);
             }
         }
     }
     BindData();
 }
Пример #3
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sSc = "<script>\n";

        sSc += "alert('Đang tồn tại module khác bên trong hoặc đã bài viết của module này!');\n";
        sSc += "</script>\n";
        switch (e.CommandName)
        {
        case "del":
            string            iddel = e.CommandArgument.ToString();
            string            sql   = "SELECT * FROM tbl_ModAdmin WHERE ModAdmin_Parent=" + iddel;
            DataSet           ds    = UpdateData.UpdateBySql(sql);
            DataRowCollection rows  = ds.Tables[0].Rows;
            if (rows.Count > 0)
            {
                Response.Write(sSc);
            }
            else
            {
                UpdateData.Delete("tbl_ModAdmin", "ModAdmin_ID=" + iddel);
                FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Xoá", "Module:" + FunctionDB.GetName("Modadmin", iddel));
            }
            BindData();
            break;

        case "isUse":
            string            id01  = e.CommandArgument.ToString();
            DataSet           dsU   = UpdateData.UpdateBySql("SELECT ModAdmin_Status FROM tbl_ModAdmin WHERE ModAdmin_ID=" + id01);
            DataRowCollection rowsU = dsU.Tables[0].Rows;
            bool isUse = false;
            isUse = Convert.ToBoolean(rowsU[0]["ModAdmin_Status"]);
            if (isUse)
            {
                UpdateData.UpdateOrder("UPDATE tbl_ModAdmin SET ModAdmin_Status=0 WHERE ModAdmin_ID=" + id01);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_ModAdmin SET ModAdmin_Status=1 WHERE ModAdmin_ID=" + id01);
            }
            BindData();
            break;
        }
        if (e.CommandName == "Order01")
        {
            foreach (GridViewRow item in gvData.Rows)
            {
                int    order = Convert.ToInt32(((TextBox)item.Cells[3].FindControl("txtOrder01")).Text.ToString());
                int    id    = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
                string sql   = "UPDATE tbl_ModAdmin SET ModAdmin_Pos=" + order + " WHERE ModAdmin_ID=" + id;
                UpdateData.UpdateOrder(sql);
            }
            BindData();
        }
    }
Пример #4
0
 protected void lbtDelAll_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow item in gvData.Rows)
     {
         CheckBox cbItem = (CheckBox)item.FindControl("cbItem");
         if (cbItem.Checked)
         {
             int id = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
             UpdateData.Delete("tbl_Config", "Config_ID=" + id);
         }
     }
     BindData();
 }
Пример #5
0
    protected void lbtUpdate_Click(object sender, EventArgs e)
    {
        string sScritp = "<script>";

        sScritp += "var b = opener.parent.dhxLayout.cells(\"b\");";
        sScritp += "b.attachURL(\"BoxList.aspx\");";
        sScritp += "window.close();";
        sScritp += "</script>";
        int selectedNum = 0;

        for (int i = 0; i < cblRight.Items.Count; i++)
        {
            if (cblRight.Items[i].Selected == true)
            {
                selectedNum++;
            }
        }
        if (id == "11")
        {
            if (selectedNum == 3)
            {
                UpdateData.Delete("tbl_ModBox", "Box_ID=" + id);
                for (int i = 0; i < cblRight.Items.Count; i++)
                {
                    if (cblRight.Items[i].Selected == true)
                    {
                        string ModID = cblRight.Items[i].Value;
                        UpdateData.InsertBySql("INSERT INTO tbl_ModBox(Mod_ID,Box_ID) VALUES(" + ModID + "," + id + ")");
                    }
                }
                Response.Write(sScritp);
            }
            else
            {
                Response.Write("<script>alert(\"Bạn phải chọn 3 mục.\")</script>");
            }
        }
        else
        {
            UpdateData.Delete("tbl_ModBox", "Box_ID=" + id);
            for (int i = 0; i < cblRight.Items.Count; i++)
            {
                if (cblRight.Items[i].Selected == true)
                {
                    string ModID = cblRight.Items[i].Value;
                    UpdateData.InsertBySql("INSERT INTO tbl_ModBox(Mod_ID,Box_ID) VALUES(" + ModID + "," + id + ")");
                }
            }
            Response.Write(sScritp);
        }
    }
Пример #6
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sSc = "<script>\n";

        sSc += "alert('Đang tồn tại module khác bên trong hoặc đã bài viết của module này!');\n";
        sSc += "</script>\n";
        switch (e.CommandName)
        {
        case "del":
            string            iddel = e.CommandArgument.ToString();
            string            sql   = "SELECT * FROM tbl_Documents WHERE Doc_ID=" + iddel;
            DataSet           ds    = UpdateData.UpdateBySql(sql);
            DataRowCollection rows  = ds.Tables[0].Rows;
            if (rows.Count > 0)
            {
                UpdateData.Delete("tbl_Documents", "Doc_ID=" + iddel);
            }
            BindData();
            break;

        case "isUse":
            string            id01  = e.CommandArgument.ToString();
            DataSet           dsU   = UpdateData.UpdateBySql("SELECT Doc_Status FROM tbl_Documents WHERE Doc_ID=" + id01);
            DataRowCollection rowsU = dsU.Tables[0].Rows;
            bool isUse = false;
            isUse = Convert.ToBoolean(rowsU[0]["DOc_Status"]);
            if (isUse)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Documents SET Doc_Status=0 WHERE Doc_ID=" + id01);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Documents SET Doc_Status=1 WHERE Doc_ID=" + id01);
            }
            BindData();
            break;
        }
        if (e.CommandName == "Order01")
        {
            foreach (GridViewRow item in gvData.Rows)
            {
                int    order = Convert.ToInt32(((TextBox)item.Cells[3].FindControl("txtOrder01")).Text.ToString());
                int    id    = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
                string sql   = "UPDATE tbl_Documents SET Doc_Pos=" + order + " WHERE Doc_ID=" + id;
                UpdateData.UpdateOrder(sql);
            }
            BindData();
        }
    }
Пример #7
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sSc = "<script>\n";

        sSc += "alert('Đang tồn tại các dữ liệu liên quan đến user này!');\n";
        sSc += "</script>\n";
        switch (e.CommandName)
        {
        case "del":
            string id = e.CommandArgument.ToString();
            try
            {
                if (UpdateData.Delete("tbl_User", "User_ID=" + id))
                {
                    BindData();
                }
                else
                {
                    Response.Write(sSc);
                }
            }
            catch (Exception)
            {
                Response.Write(sSc);
            }

            break;

        case "isUse":
            string            id01  = e.CommandArgument.ToString();
            DataSet           dsU   = UpdateData.UpdateBySql("SELECT User_Status FROM tbl_User WHERE User_ID=" + id01);
            DataRowCollection rowsU = dsU.Tables[0].Rows;
            bool isUse = false;
            isUse = Convert.ToBoolean(rowsU[0]["User_Status"]);
            if (isUse)
            {
                UpdateData.UpdateOrder("UPDATE tbl_User SET User_Status=0 WHERE User_ID=" + id01);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_User SET User_Status=1 WHERE User_ID=" + id01);
            }
            BindData();
            break;
        }
    }
Пример #8
0
    protected void dgrModtype_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem)
        {
            string sSc = "<script>\n";
            sSc += "alert('Bạn cần gỡ các module sử dụng định dạng này trước khi xoá!');\n";
            sSc += "</script>\n";
            string id = dgrModtype.DataKeys[e.Item.ItemIndex].ToString();
            switch (e.CommandName)
            {
            case "del":
                string            sql  = "SELECT * FROM tbl_Mod WHERE Modtype_ID=" + id;
                DataSet           ds   = UpdateData.UpdateBySql(sql);
                DataRowCollection rows = ds.Tables[0].Rows;
                if (rows.Count > 0)
                {
                    Response.Write(sSc);
                }
                else
                {
                    UpdateData.Delete("tbl_Modtype", "Modtype_ID=" + id);
                }
                dgrModtype.EditItemIndex = -1;
                BindData();
                break;

            case "isUse":
                DataSet           dsU   = UpdateData.UpdateBySql("SELECT Modtype_Status FROM tbl_Modtype WHERE Modtype_ID=" + id);
                DataRowCollection rowsU = dsU.Tables[0].Rows;
                bool isHot = false;
                isHot = Convert.ToBoolean(rowsU[0]["Modtype_Status"]);
                if (isHot)
                {
                    UpdateData.UpdateOrder("UPDATE tbl_Modtype SET Modtype_Status=0 WHERE Modtype_ID=" + id);
                }
                else
                {
                    UpdateData.UpdateOrder("UPDATE tbl_Modtype SET Modtype_Status=1 WHERE Modtype_ID=" + id);
                }
                dgrModtype.EditItemIndex = -1;
                BindData();
                break;
            }
        }
    }
Пример #9
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sSc = "<script>\n";

        sSc += "alert('Đang tồn tại thông tin khác trong bài này!');\n";
        sSc += "</script>\n";
        switch (e.CommandName)
        {
        case "del":
            string iddel = e.CommandArgument.ToString();
            UpdateData.Delete("tbl_File", "File_ID=" + iddel);
            FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Xoá", "Bài: " + FunctionDB.GetName("Content", iddel.ToString()));
            BindData();
            break;

        case "isUse":
            string            id01  = e.CommandArgument.ToString();
            DataSet           dsU   = UpdateData.UpdateBySql("SELECT File_Status FROM tbl_File WHERE File_ID=" + id01);
            DataRowCollection rowsU = dsU.Tables[0].Rows;
            bool isUse = false;
            isUse = Convert.ToBoolean(rowsU[0]["File_Status"]);
            if (isUse)
            {
                UpdateData.UpdateOrder("UPDATE tbl_File SET File_Status=0 WHERE File_ID=" + id01);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_File SET File_Status=1 WHERE File_ID=" + id01);
            }
            BindData();
            break;
        }
        if (e.CommandName == "Order01")
        {
            foreach (GridViewRow item in gvData.Rows)
            {
                int    order = Convert.ToInt32(((TextBox)item.Cells[3].FindControl("txtOrder01")).Text.ToString());
                int    id    = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
                string sql   = "UPDATE tbl_File SET File_Pos=" + order + " WHERE File_ID=" + id;
                UpdateData.UpdateOrder(sql);
            }
            BindData();
        }
    }
Пример #10
0
    protected void lbtUpdate_Click(object sender, EventArgs e)
    {
        string sScritp = "<script>";

        sScritp += "var b = opener.parent.dhxLayout.cells(\"b\");";
        sScritp += "b.attachURL(\"UserList.aspx\");";
        sScritp += "window.close();";
        sScritp += "</script>";

        UpdateData.Delete("tbl_RoleUser", "User_ID=" + id);
        for (int i = 0; i < cblRole.Items.Count; i++)
        {
            if (cblRole.Items[i].Selected == true)
            {
                string RoleID = cblRole.Items[i].Value;
                UpdateData.InsertBySql("INSERT INTO tbl_RoleUser(Role_ID,User_ID) VALUES(" + RoleID + "," + id + ")");
            }
        }
        Response.Write(sScritp);
    }
Пример #11
0
    protected void lbtUpdate_Click(object sender, EventArgs e)
    {
        string sScritp = "<script>";

        sScritp += "var a = opener.parent.dhxLayout.cells(\"a\");";
        sScritp += "a.attachURL(\"Tree.aspx\");";
        sScritp += "var b = opener.parent.dhxLayout.cells(\"b\");";
        sScritp += "b.attachURL(\"FunctionList.aspx?p=" + p + "\");";
        sScritp += "window.close();";
        sScritp += "</script>";

        UpdateData.Delete("tbl_ModUser", "ModAdmin_ID=" + id);
        for (int i = 0; i < cblRight.Items.Count; i++)
        {
            if (cblRight.Items[i].Selected == true)
            {
                string UserID = cblRight.Items[i].Value;
                UpdateData.InsertBySql("INSERT INTO tbl_ModUser(ModAdmin_ID,UserID) VALUES(" + id + "," + UserID + ")");
            }
        }
        Response.Write(sScritp);
    }
Пример #12
0
    protected void lbtUpdate_Click(object sender, EventArgs e)
    {
        string sScript = "<script>";

        sScript += "var b = opener.parent.dhxLayout.cells(\"b\");";
        sScript += "b.attachURL(\"UserList.aspx?pbid=" + pbid + "\");";
        sScript += "window.close();";
        sScript += "</script>";

        UpdateData.Delete("tbl_ModSiteUser", "User_ID=" + id);
        string ModuleID = "";

        for (int i = 0; i < TreeView1.CheckedNodes.Count; i++)
        {
            if (TreeView1.CheckedNodes[i].Checked == true)
            {
                ModuleID = this.TreeView1.CheckedNodes[i].Value;
                UpdateData.InsertBySql("INSERT INTO tbl_ModSiteUser(Mod_ID,User_ID) VALUES(" + ModuleID + "," + id + ")");
            }
        }
        Response.Write(sScript);
    }
Пример #13
0
 protected void lbtDelAll_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow item in gvData.Rows)
     {
         CheckBox cbItem = (CheckBox)item.FindControl("cbItem");
         if (cbItem.Checked)
         {
             int iddel = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
             try
             {
                 if (AuthenticationMenu.CheckPermission(iddel, int.Parse(Session["UserId"].ToString())))
                 {
                     UpdateData.Delete("tbl_ModSiteUser", "User_Id=" + int.Parse(Session["UserID"].ToString()));
                 }
                 UpdateData.Delete("tbl_Mod", "Mod_ID=" + iddel);
             }
             catch (Exception)
             {
                 Response.Write("<script>alert('Module tại trong 1 module khác hoặc được sở hữu bởi 1 người khác, bạn không thể xóa nó');</script>");
             }
         }
     }
     BindData();
 }
Пример #14
0
    protected void gvRaovat_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sSc = "<script>\n";

        sSc += "alert('Đang tồn tại thông tin khác trong bài này!');\n";
        sSc += "</script>\n";
        switch (e.CommandName)
        {
        case "del":
            string iddel = e.CommandArgument.ToString();
            UpdateData.Delete("tbl_Raovat", "Raovat_ID=" + iddel);
            BindRaovat();
            break;

        case "isUse":
            string            id01  = e.CommandArgument.ToString();
            DataSet           dsU   = UpdateData.UpdateBySql("SELECT Raovat_Status FROM tbl_Raovat WHERE Raovat_ID=" + id01);
            DataRowCollection rowsU = dsU.Tables[0].Rows;
            bool isUse = false;
            isUse = Convert.ToBoolean(rowsU[0]["Raovat_Status"]);
            if (isUse)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Raovat SET Raovat_Status=0 WHERE Raovat_ID=" + id01);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Raovat SET Raovat_Status=1 WHERE Raovat_ID=" + id01);
            }
            BindRaovat();
            break;

        case "isVIP1":
            string            idV1   = e.CommandArgument.ToString();
            DataSet           dsV1   = UpdateData.UpdateBySql("SELECT Raovat_VIP1 FROM tbl_Raovat WHERE Raovat_ID=" + idV1);
            DataRowCollection rowsV1 = dsV1.Tables[0].Rows;
            bool isVIP1 = false;
            isVIP1 = Convert.ToBoolean(rowsV1[0]["Raovat_VIP1"]);
            if (isVIP1)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Raovat SET Raovat_VIP1=0 WHERE Raovat_ID=" + idV1);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Raovat SET Raovat_VIP1=1 WHERE Raovat_ID=" + idV1);
            }
            BindRaovat();
            break;

        case "isVIP2":
            string            idV2   = e.CommandArgument.ToString();
            DataSet           dsV2   = UpdateData.UpdateBySql("SELECT Raovat_VIP2 FROM tbl_Raovat WHERE Raovat_ID=" + idV2);
            DataRowCollection rowsV2 = dsV2.Tables[0].Rows;
            bool isVIP2 = false;
            isVIP2 = Convert.ToBoolean(rowsV2[0]["Raovat_VIP2"]);
            if (isVIP2)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Raovat SET Raovat_VIP2=0 WHERE Raovat_ID=" + idV2);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Raovat SET Raovat_VIP2=1 WHERE Raovat_ID=" + idV2);
            }
            BindRaovat();
            break;
        }
    }
Пример #15
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sSc = "<script>\n";

        sSc += "alert('Đang tồn tại thông tin khác trong bài này!');\n";
        sSc += "</script>\n";
        switch (e.CommandName)
        {
        case "del":
            string iddel = e.CommandArgument.ToString();
            UpdateData.Delete("tbl_Content", "Content_ID=" + iddel);
            FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Xoá", "Bài: " + FunctionDB.GetName("Content", iddel.ToString()));
            BindData();
            break;

        case "isHot":
            string            id   = e.CommandArgument.ToString();
            DataSet           ds   = UpdateData.UpdateBySql("SELECT Content_Hot FROM tbl_Content WHERE Content_ID=" + id);
            DataRowCollection rows = ds.Tables[0].Rows;
            bool isHot             = false;
            isHot = Convert.ToBoolean(rows[0]["Content_Hot"]);
            if (isHot)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_Hot=0 WHERE Content_ID=" + id);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_Hot=1 WHERE Content_ID=" + id);
            }
            BindData();
            break;

        case "isUse":
            string            id01  = e.CommandArgument.ToString();
            DataSet           dsU   = UpdateData.UpdateBySql("SELECT Content_Status FROM tbl_Content WHERE Content_ID=" + id01);
            DataRowCollection rowsU = dsU.Tables[0].Rows;
            bool isUse = false;
            isUse = Convert.ToBoolean(rowsU[0]["Content_Status"]);
            if (isUse)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_Status=0 WHERE Content_ID=" + id01);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_Status=1 WHERE Content_ID=" + id01);
            }
            BindData();
            break;
            //case "isHome":
            //    string id02 = e.CommandArgument.ToString();
            //    DataSet dsHome = UpdateData.UpdateBySql("SELECT Content_Home FROM tbl_Content WHERE Content_ID=" + id02);
            //    DataRowCollection rowsHome = dsHome.Tables[0].Rows;
            //    bool isHome = false;
            //    isHome = Convert.ToBoolean(rowsHome[0]["Content_Home"]);
            //    if (isHome)
            //        UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_Home=0 WHERE Content_ID=" + id02);
            //    else
            //        UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_Home=1 WHERE Content_ID=" + id02);
            //    BindData();
            //    break;
            //case "isOK":
            //    string id03 = e.CommandArgument.ToString();
            //    DataSet dsOK = UpdateData.UpdateBySql("SELECT Content_OK FROM tbl_Content WHERE Content_ID=" + id03);
            //    DataRowCollection rowsOK = dsOK.Tables[0].Rows;
            //    bool isOK = false;
            //    isOK = Convert.ToBoolean(rowsOK[0]["Content_OK"]);
            //    if (isOK)
            //        UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_OK=0 WHERE Content_ID=" + id03);
            //    else
            //        UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_OK=1 WHERE Content_ID=" + id03);
            //    BindData();
            //    break;
            //case "isRSS":
            //    string id04 = e.CommandArgument.ToString();
            //    DataSet dsRSS = UpdateData.UpdateBySql("SELECT Content_RSS FROM tbl_Content WHERE Content_ID=" + id04);
            //    DataRowCollection rowsRSS = dsRSS.Tables[0].Rows;
            //    bool isRSS = false;
            //    isRSS = Convert.ToBoolean(rowsRSS[0]["Content_RSS"]);
            //    if (isRSS)
            //        UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_RSS=0 WHERE Content_ID=" + id04);
            //    else
            //        UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_RSS=1 WHERE Content_ID=" + id04);
            //    BindData();
            //    break;
            //case "isShare":
            //    int id05 = Convert.ToInt32(e.CommandArgument);
            //    DataSet dsShare = UpdateData.UpdateBySql("SELECT Content_Share FROM tbl_Content WHERE Content_ID=" + id05);
            //    DataRowCollection rowsShare = dsShare.Tables[0].Rows;
            //    bool isShare = false;
            //    isShare = Convert.ToBoolean(rowsShare[0]["Content_Share"]);
            //    if (isShare)
            //        UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_Share=0 WHERE Content_ID=" + id05);
            //    else
            //        UpdateData.UpdateOrder("UPDATE tbl_Content SET Content_Share=1 WHERE Content_ID=" + id05);
            //    BindData();
            //    vn.edu.tdcbachmai.ArticleService service = new vn.edu.tdcbachmai.ArticleService();
            //    string n = ContentControl.GetContentField("Name", id05);
            //    string intro = ContentControl.GetContentField("Intro", id05);
            //    string text = ContentControl.GetContentField("Text", id05);
            //    service.InsertArticle(n, intro, text);
            //    break;
        }
        if (e.CommandName == "Order01")
        {
            foreach (GridViewRow item in gvData.Rows)
            {
                int    order = Convert.ToInt32(((TextBox)item.Cells[3].FindControl("txtOrder01")).Text.ToString());
                int    id    = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
                string sql   = "UPDATE tbl_Content SET Content_Pos=" + order + " WHERE Content_ID=" + id;
                UpdateData.UpdateOrder(sql);
            }
            BindData();
        }
    }
Пример #16
0
    protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string sSc = "<script>\n";

        sSc += "alert('Đang tồn tại module khác bên trong hoặc đã bài viết của module này!');\n";
        sSc += "</script>\n";
        switch (e.CommandName)
        {
        case "del":
            if (TopicID != 1342 && ModControl.GetParent(TopicID) != 1342)
            {
                string            iddel = e.CommandArgument.ToString();
                string            sql   = "SELECT * FROM tbl_Mod WHERE Mod_Parent=" + iddel;
                string            sqlC  = "SELECT * FROM tbl_Content WHERE Mod_ID=" + iddel;
                DataSet           ds    = UpdateData.UpdateBySql(sql);
                DataRowCollection rows  = ds.Tables[0].Rows;
                DataSet           dsC   = UpdateData.UpdateBySql(sqlC);
                DataRowCollection rowsC = dsC.Tables[0].Rows;
                if ((rows.Count > 0) || (rowsC.Count > 0))
                {
                    Response.Write(sSc);
                }
                else
                {
                    try
                    {
                        UpdateData.Delete("tbl_Mod", "Mod_ID=" + iddel);
                    }
                    catch (Exception)
                    {
                        Response.Write("<script>alert('Module đang được sở hữu bởi người khác, bạn không được xóa nó.')</script>");
                    }


                    FunctionDB.AddLog(Session["DepartID"].ToString(), Session["Username"].ToString(), "Xoá", "Module:" + FunctionDB.GetName("Mod", iddel));
                }
                BindData();
            }
            break;

        case "isHot":
            string            id    = e.CommandArgument.ToString();
            DataSet           dsH   = UpdateData.UpdateBySql("SELECT Mod_Hot FROM tbl_Mod WHERE Mod_ID=" + id);
            DataRowCollection rowsH = dsH.Tables[0].Rows;
            bool isHot = false;
            isHot = Convert.ToBoolean(rowsH[0]["Mod_Hot"]);
            if (isHot)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Mod SET Mod_Hot=0 WHERE Mod_ID=" + id);
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Mod SET Mod_Hot=1 WHERE Mod_ID=" + id);
            }
            BindData();
            break;

        case "isUse":
            string id01  = e.CommandArgument.ToString();
            int    idcat = 0;
            //if (format == 17 || format == 18 || format == 21)
            //{
            //   idcat = ProductControl.GetShopFromMod(int.Parse(id01)).ShopCatID;
            //}
            DataSet           dsU   = UpdateData.UpdateBySql("SELECT Mod_Status FROM tbl_Mod WHERE Mod_ID=" + id01);
            DataRowCollection rowsU = dsU.Tables[0].Rows;
            bool isUse = false;
            isUse = Convert.ToBoolean(rowsU[0]["Mod_Status"]);
            if (isUse)
            {
                UpdateData.UpdateOrder("UPDATE tbl_Mod SET Mod_Status=0 WHERE Mod_ID=" + id01);
                if (format == 17 || format == 18 || format == 21)
                {
                    UpdateData.UpdateOrder("UPDATE Shop_Category SET isPublish=0 WHERE ID=" + idcat);
                }
            }
            else
            {
                UpdateData.UpdateOrder("UPDATE tbl_Mod SET Mod_Status=1 WHERE Mod_ID=" + id01);
                if (format == 17 || format == 18 || format == 21)
                {
                    UpdateData.UpdateOrder("UPDATE Shop_Category SET isPublish=0 WHERE ID=" + idcat);
                }
            }

            BindData();
            break;
        }
        if (e.CommandName == "Order01")
        {
            foreach (GridViewRow item in gvData.Rows)
            {
                int    order = Convert.ToInt32(((TextBox)item.Cells[3].FindControl("txtOrder01")).Text.ToString());
                int    id    = Convert.ToInt32(gvData.DataKeys[item.RowIndex].Value.ToString());
                string sql   = "UPDATE tbl_Mod SET Mod_Pos=" + order + " WHERE Mod_ID=" + id;
                UpdateData.UpdateOrder(sql);
            }
            BindData();
        }
    }