Beispiel #1
0
 public int CreateMenuLinks(MenuLinks menuLinks)
 {
     using (SqlConnection connection = base.GetConnection())
     {
         SqlCommand command = new SqlCommand("_MenuLinksUpdate", connection) {
             CommandType = CommandType.StoredProcedure
         };
         command.Parameters.AddWithValue("@Type", 0);
         command.Parameters.AddWithValue("@MenuLinksID", 1);
         command.Parameters.AddWithValue("@MenuLinksName", menuLinks.MenuLinksName);
         command.Parameters.AddWithValue("@MenuLinksParent", menuLinks.MenuLinksParent);
         command.Parameters.AddWithValue("@MenuLinksUrl", menuLinks.MenuLinksUrl);
         command.Parameters.AddWithValue("@MenuLinksOrder", menuLinks.MenuLinksOrder);
         command.Parameters.AddWithValue("@MenuLinksHelp", menuLinks.MenuLinksHelp);
         command.Parameters.AddWithValue("@MenuLinksIcon", menuLinks.MenuLinksIcon);
         command.Parameters.AddWithValue("@Status", menuLinks.Status);
         command.Parameters.AddWithValue("@IsView", menuLinks.IsView);
         command.Parameters.AddWithValue("@Target", menuLinks.Target);
         connection.Open();
         return command.ExecuteNonQuery();
     }
 }
        public MenuLinks ReceiveHtml()
        {
            MenuLinks menuLinks = new MenuLinks();

            //      string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Admin/Admin_Theme/Icons/";
            string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/MenuLinks/";
            commonBSO commonBSO = new commonBSO();
            string icon_upload = commonBSO.UploadImage(uploadIcon, path, 80, 80);

            menuLinks.MenuLinksID = (txtMenuLinksID.Value != "") ? Convert.ToInt32(txtMenuLinksID.Value) : 0;
            menuLinks.MenuLinksName = (txtMenuLinksName.Text != "") ? txtMenuLinksName.Text.Trim() : "";
            menuLinks.MenuLinksOrder = 0;
            menuLinks.MenuLinksParent = (ddlMenuLinks.SelectedValue != "") ? Convert.ToInt32(ddlMenuLinks.SelectedValue) : 0;
            menuLinks.MenuLinksUrl = (txtMenuLinksUrl.Text != "") ? txtMenuLinksUrl.Text.Trim() : "";
            menuLinks.MenuLinksHelp = txtRadHelp.Html;
            menuLinks.MenuLinksIcon = (icon_upload != "") ? icon_upload : hddIcon.Value;

            menuLinks.Status = Convert.ToBoolean(rdbStatus.SelectedValue);
            menuLinks.IsView = Convert.ToBoolean(rdbIsView.SelectedValue);
            menuLinks.Target = ddlTarget.SelectedValue;


            return menuLinks;
        }
Beispiel #3
0
 public int EditMenuLinks(MenuLinks _menuLinks)
 {
     MenuLinksDAO menuLinksDAO = new MenuLinksDAO();
     return menuLinksDAO.UpdateMenuLinks(_menuLinks);
 }
Beispiel #4
0
 public int AddMenuLinks(MenuLinks _menuLinks)
 {
     MenuLinksDAO menuLinksDAO = new MenuLinksDAO();
     return menuLinksDAO.CreateMenuLinks(_menuLinks);
 }
Beispiel #5
0
 public int UpdateMenuLinks(MenuLinks menuLinks)
 {
     using (SqlConnection connection = base.GetConnection())
     {
         SqlCommand command = new SqlCommand("_MenuLinksUpdate", connection) {
             CommandType = CommandType.StoredProcedure
         };
         command.Parameters.AddWithValue("@Type", 1);
         command.Parameters.AddWithValue("@MenuLinksID", menuLinks.MenuLinksID);
         command.Parameters.AddWithValue("@MenuLinksName", menuLinks.MenuLinksName);
         command.Parameters.AddWithValue("@MenuLinksParent", menuLinks.MenuLinksParent);
         command.Parameters.AddWithValue("@MenuLinksUrl", menuLinks.MenuLinksUrl);
         command.Parameters.AddWithValue("@MenuLinksOrder", menuLinks.MenuLinksOrder);
         command.Parameters.AddWithValue("@MenuLinksHelp", menuLinks.MenuLinksHelp);
         command.Parameters.AddWithValue("@MenuLinksIcon", menuLinks.MenuLinksIcon);
         command.Parameters.AddWithValue("@Status", menuLinks.Status);
         command.Parameters.AddWithValue("@IsView", menuLinks.IsView);
         command.Parameters.AddWithValue("@Target", menuLinks.Target);
         connection.Open();
         int i = command.ExecuteNonQuery();
         if (i <= 0)
         {
             throw new DataAccessException("lỗi kh\x00f4ng thể cập nhật");
         }
         return i;
     }
 }