public static void InsertData(aeMenu pMenu, ref string pResult) { SqlConnection oCnnData = daConnection.Connect(); try { aeMenu oRow = new aeMenu(); SqlCommand oCmd = new SqlCommand("uspMenuInsert", oCnnData); oCmd.CommandType = CommandType.StoredProcedure; oCmd.Parameters.Clear(); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.Name); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.NameCode); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.IdApplication); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.IdParent); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.Estate); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.Level); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.Estate); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.UserInsert); oCmd.Parameters.AddWithValue("@pIdMenu", pMenu.DateInsert); oCmd.ExecuteNonQuery(); oCnnData.Close(); return; } catch (Exception ex) { pResult = ex.Message; } oCnnData.Close(); }
public List <aeMenu> GetDataByRole(int pIdRole, string pResult) { SqlConnection oCnnData = daConnection.Connect(); try { List <aeMenu> oLista = new List <aeMenu>(); SqlCommand oCmd = new SqlCommand("spMenuSelectByIdRole", oCnnData); oCmd.CommandType = CommandType.StoredProcedure; oCmd.Parameters.Clear(); oCmd.Parameters.AddWithValue("@pIdRole", pIdRole); SqlDataReader oRdr; oRdr = oCmd.ExecuteReader(); while (oRdr.Read()) { aeMenu oRow = new aeMenu(); oRow.IdMenu = Convert.ToInt16(oRdr["IdMenu"].ToString()); oRow.Name = (oRdr["Descripcion"] == DBNull.Value) ? null : oRdr["Descripcion"].ToString(); oRow.IdApplication = (oRdr["IdApplication"] == DBNull.Value) ? 0 : Convert.ToInt16(oRdr["IdApplication"]); oRow.Level = oRdr["Level"] == DBNull.Value ? 0 : Convert.ToInt16(oRdr["Level"]); oRow.Estate = (oRdr["Estate"] == DBNull.Value) ? false : Convert.ToInt16(oRdr["Estate"]) == 1? true:false; oLista.Add(oRow); } return(oLista); } catch (Exception ex) { pResult = ex.Message; } oCnnData.Close(); return(null); }
private void CargarDatos(int idMenu) { aeMen = blMen.GetRow(idMenu, ref error); if (aeMen != null) { txtIdMenu.Text = aeMen.IdMenu.ToString(); txtNombre.Text = aeMen.Name.ToString(); txtCodigo.Text = aeMen.NameCode.ToString(); txtIdAplicacion.Text = aeMen.IdApplication.ToString(); txtLevel.Text = aeMen.Level.ToString(); chkEstado.Checked = aeMen.Estate; switch (aeMen.Level) { case 1: this.cboPadre.DataSource = null; break; case 2: this.cboPadre.DisplayMember = "Name"; this.cboPadre.ValueMember = "IdMenu"; this.cboPadre.DataSource = listModulo; break; case 3: this.cboPadre.DisplayMember = "Name"; this.cboPadre.ValueMember = "IdMenu"; this.cboPadre.DataSource = listMenu; break; } } }
public static aeMenu GetDataById(int pIdMenu, ref string pResult) { SqlConnection oCnnData = daConnection.Connect(); try { aeMenu oRow = new aeMenu(); SqlCommand oCmd = new SqlCommand("uspMenuSelectById", oCnnData); oCmd.CommandType = CommandType.StoredProcedure; oCmd.Parameters.Clear(); oCmd.Parameters.AddWithValue("@pIdMenu", pIdMenu); SqlDataReader oRdr; oRdr = oCmd.ExecuteReader(); if (oRdr.Read()) { oRow.IdMenu = Convert.ToInt16(oRdr["IdMenu"].ToString()); oRow.Name = (oRdr["Name"] == DBNull.Value) ? null : oRdr["Name"].ToString(); oRow.NameCode = (oRdr["NameCode"] == DBNull.Value) ? null : oRdr["NameCode"].ToString(); oRow.IdApplication = (oRdr["IdApplication"] == DBNull.Value) ? 0 : Convert.ToInt16(oRdr["IdApplication"]); oRow.IdParent = (oRdr["IdParent"] == DBNull.Value) ? 0 : Convert.ToInt16(oRdr["IdParent"]); oRow.Estate = (oRdr["IdParent"] == DBNull.Value) ? false : Convert.ToInt16(oRdr["IdParent"]) == 1? true:false; oRow.RowVersion = (oRdr["NameCode"] == DBNull.Value) ? null : oRdr["NameCode"].ToString(); oRow.Level = (oRdr["Level"] == DBNull.Value) ? 0 : Convert.ToInt16(oRdr["Level"]); oRow.Estate = (oRdr["Estate"] == DBNull.Value) ? false : Convert.ToInt16(oRdr["Estate"]) == 1? true:false; } oCnnData.Close(); return(oRow); } catch (Exception ex) { pResult = ex.Message; } oCnnData.Close(); return(null); }
public void UpdateRow(aeMenu pMenu, ref string pResult) { daMenu.UpdateData(pMenu, ref pResult); }
public void InsertRow(aeMenu pMenu, ref string pResult) { daMenu.InsertData(pMenu, ref pResult); }
public aeMenu GetRow(int pIdMenu, ref string pResult) { aeMenu oList = daMenu.GetDataById(pIdMenu, ref pResult); return(oList); }