/// <summary> /// /// </summary> /// <param name="pIdTipoParametro">Tipo (gasto, clase, forma pago etc)</param> /// <param name="pIdParamComercialRef">Relacion con otro param</param> /// <param name="vigente">Vigentes o no</param> /// <returns></returns> public static ParamComercialList GetByParams(int?pIdTipoParametro, int?pIdParamComercialRef, bool?vigente, string pCompanyId) { Database wDatabase = null; DbCommand wCmd = null; ParamComercialList list = new ParamComercialList(); ParamComercialBE wParamComercialBE = null; try { wDatabase = DatabaseFactory.CreateDatabase(CommonDAC.clinica_cnnstring); wCmd = wDatabase.GetStoredProcCommand("ParamComercial_s_ByParam"); wDatabase.AddInParameter(wCmd, "IdTipoParametro", System.Data.DbType.Int32, pIdTipoParametro); wDatabase.AddInParameter(wCmd, "IdParamComercialRef", System.Data.DbType.Int32, pIdParamComercialRef); wDatabase.AddInParameter(wCmd, "Vigente", System.Data.DbType.Boolean, vigente); //if( //wDatabase.AddInParameter(wCmd, "CompanyId", System.Data.DbType.String, pCompanyId); IDataReader reader = wDatabase.ExecuteReader(wCmd); #region Fill wGastoBECollection while (reader.Read()) { wParamComercialBE = new ParamComercialBE(); wParamComercialBE.IdParamComercial = Convert.ToInt32(reader["IdParamComercial"]); if (reader["IdTipoParametro"] != DBNull.Value) { wParamComercialBE.IdTipoParametro = Convert.ToInt32(reader["IdTipoParametro"]); } wParamComercialBE.Nombre = reader["Nombre"].ToString().Trim(); if (reader["IdParamComercialRef"] != DBNull.Value) { wParamComercialBE.IdParamComercialRef = Convert.ToInt32(reader["IdParamComercialRef"]); } if (reader["NombreRef"] != DBNull.Value) { wParamComercialBE.NombreRef = reader["NombreRef"].ToString(); } list.Add(wParamComercialBE); } #endregion reader.Dispose(); return(list); } catch (Exception ex) { throw ex; } }
public ParamComercialList GetChecked() { _CheckedsList.Clear(); foreach (object itemChecked in chkListSectorGastoGasto.CheckedItems) { ParamComercialBE wTipoGastoBE = (ParamComercialBE)itemChecked; _CheckedsList.Add(wTipoGastoBE); } return(_CheckedsList); }
private void btnDelette_Click(object sender, EventArgs e) { if (selectedConsultaGrid != null) { ParamComercialBE tipoConsulta = Controller.TipoConsultaList.GetById(selectedConsultaGrid.IdTipoConsulta.Value); this.MessageViewer.MessageBoxIcon = Fwk.UI.Common.MessageBoxIcon.Question; this.MessageViewer.MessageBoxButtons = MessageBoxButtons.OKCancel; DialogResult d = this.MessageViewer.Show(String.Format("Desea eliminar la {0}, para cliente {1}", tipoConsulta.Nombre, selectedConsultaGrid.NombreCliente)); if (d == DialogResult.OK) { Controller.DeleteConsulta(selectedConsultaGrid.IdConsulta); Populate(DateTime.Now); } base.SetMessageViewInfoDefault(); } }
/// <summary> /// /// </summary> /// <param name="pParamComercialBE"></param> /// <param name="pUserId"></param> /// <param name="pCompanyId"></param> public static void Create(ParamComercialBE pParamComercialBE, Guid pUserId, string pCompanyId) { Database wDatabase = null; DbCommand wCmd = null; try { wDatabase = DatabaseFactory.CreateDatabase(CommonDAC.clinica_cnnstring); wCmd = wDatabase.GetStoredProcCommand("ParamComercial_i"); wDatabase.AddOutParameter(wCmd, "IdParamComercial", DbType.Int32, 4); wDatabase.AddInParameter(wCmd, "@IdTipoParametro", System.Data.DbType.Int32, pParamComercialBE.IdTipoParametro.Value); if (pParamComercialBE.IdParamComercialRef != null) { wDatabase.AddInParameter(wCmd, "@IdParamComercialRef", System.Data.DbType.Int32, pParamComercialBE.IdParamComercialRef); } wDatabase.AddInParameter(wCmd, "Nombre", System.Data.DbType.String, pParamComercialBE.Nombre); wDatabase.AddInParameter(wCmd, "UserId", DbType.Guid, pUserId); wDatabase.AddInParameter(wCmd, "CompanyId", System.Data.DbType.String, pCompanyId); if (!string.IsNullOrEmpty(pParamComercialBE.Descripcion)) { wDatabase.AddInParameter(wCmd, "Descripcion", System.Data.DbType.String, pParamComercialBE.Descripcion); } wDatabase.ExecuteNonQuery(wCmd); pParamComercialBE.IdParamComercial = (System.Int32)wDatabase.GetParameterValue(wCmd, "IdParamComercial"); } catch (Exception ex) { throw ex; } }