public int CreateModules(Modules modules) { using (SqlConnection connection = base.GetConnection()) { SqlCommand command = new SqlCommand("_ModulesUpdate", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Type", 0); command.Parameters.AddWithValue("@Modules_ID", 1); command.Parameters.AddWithValue("@Modules_Name", modules.ModulesName); command.Parameters.AddWithValue("@Modules_Parent", modules.ModulesParent); command.Parameters.AddWithValue("@Modules_Url", modules.ModulesUrl); command.Parameters.AddWithValue("@Modules_Order", modules.ModulesOrder); command.Parameters.AddWithValue("@Modules_Help", modules.ModulesHelp); command.Parameters.AddWithValue("@Modules_Icon", modules.ModulesIcon); connection.Open(); return command.ExecuteNonQuery(); } }
public int AddModules(Modules _modules) { ModulesDAO modulesDAO = new ModulesDAO(); return modulesDAO.CreateModules(_modules); }
public int EditModules(Modules _modules) { ModulesDAO modulesDAO = new ModulesDAO(); return modulesDAO.UpdateModules(_modules); }
public int UpdateModules(Modules modules) { using (SqlConnection connection = base.GetConnection()) { SqlCommand command = new SqlCommand("_ModulesUpdate", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Type", 1); command.Parameters.AddWithValue("@Modules_ID", modules.ModulesID); command.Parameters.AddWithValue("@Modules_Name", modules.ModulesName); command.Parameters.AddWithValue("@Modules_Parent", modules.ModulesParent); command.Parameters.AddWithValue("@Modules_Url", modules.ModulesUrl); command.Parameters.AddWithValue("@Modules_Order", modules.ModulesOrder); command.Parameters.AddWithValue("@Modules_Help", modules.ModulesHelp); command.Parameters.AddWithValue("@Modules_Icon", modules.ModulesIcon); connection.Open(); int i = command.ExecuteNonQuery(); if (i <= 0) { throw new DataAccessException("lỗi kh\x00f4ng thể cập nhật"); } return i; } }
public Modules ReceiveHtml() { Modules modules = new Modules(); // string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Admin/Admin_Theme/Icons/"; string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/Admin_Theme/Icons/"; commonBSO commonBSO = new commonBSO(); string icon_upload = commonBSO.UploadImage(uploadIcon, path, 55, 55); modules.ModulesID = (txtModulesID.Value != "") ? Convert.ToInt32(txtModulesID.Value) : 0; modules.ModulesName = (txtModulesName.Text != "") ? txtModulesName.Text.Trim() : ""; modules.ModulesOrder = 0; modules.ModulesParent = (ddlModules.SelectedValue != "") ? Convert.ToInt32(ddlModules.SelectedValue) : 0; modules.ModulesUrl = (txtModulesUrl.Text != "") ? txtModulesUrl.Text.Trim() : ""; modules.ModulesHelp = txtRadHelp.Html; modules.ModulesIcon = (icon_upload != "") ? icon_upload : hddIcon.Value; return modules; }