public DataTable ExecDataSet(string pSql, ParamStruct[] pParameterArray)
        {
            SqlConnection vCon = new SqlConnection(_glCadenaConexion);
            SqlCommand vCmd = new SqlCommand(pSql, vCon);
            vCmd.CommandType = CommandType.StoredProcedure;

            if (pParameterArray != null)
            {
                for (int i = 0; i < pParameterArray.Length; i++)
                {
                    ParamStruct vParam = pParameterArray[i];
                    IDbDataParameter vPm = GetParameter(vParam.ParamName, vParam.direction, vParam.value, vParam.DataType, vParam.sourceColumn, vParam.size);
                    vCmd.Parameters.Add(vPm);
                }
            }

            vCon.Open();

            DataSet vDs = new DataSet();
            SqlDataAdapter vDa = new SqlDataAdapter();
            vDa.SelectCommand = vCmd;
            vDa.Fill(vDs);
            vCon.Close();

            if (vDs != null & vDs.Tables.Count > 0)
                return vDs.Tables[0];
            else
                return null;
        }
Exemplo n.º 2
0
        public void sp_Save_RMOrder(int pID, string pOrderNumber, string pCustomerName, string pDeliveryAddress, DateTime pOrderDate)
        {
            ParamStruct[] vParam = new ParamStruct[5];

            vParam[0].ParamName = "@Id";
            vParam[0].DataType = DbType.Int32;
            vParam[0].value = pID;

            vParam[1].ParamName = "@OrderNumber";
            vParam[1].DataType = DbType.String;
            vParam[1].value = pOrderNumber;

            vParam[2].ParamName = "@CustomerName";
            vParam[2].DataType = DbType.String;
            vParam[2].value = pCustomerName;

            vParam[3].ParamName = "@DeliveryAddress";
            vParam[3].DataType = DbType.String;
            vParam[3].value = pDeliveryAddress;

            vParam[4].ParamName = "@OrderDate";
            vParam[4].DataType = DbType.DateTime;
            vParam[4].value = pOrderDate;

            _ConfigurationManager.ExecSql("sp_Save_RMOrder", vParam);
        }
Exemplo n.º 3
0
        public DataTable sp_Get_RMOrder_ID(int pId)
        {
            ParamStruct[] vParam = new ParamStruct[1];

            vParam[0].ParamName = "@Id";
            vParam[0].DataType = DbType.Int32;
            vParam[0].value = pId;

            return _ConfigurationManager.ExecDataSet("sp_Get_RMOrder_ID", vParam);
        }
Exemplo n.º 4
0
        public void sp_Delete_Order(int pID)
        {
            ParamStruct[] vParam = new ParamStruct[1];

            vParam[0].ParamName = "@OrderId";
            vParam[0].DataType = DbType.Int32;
            vParam[0].value = pID;

            _ConfigurationManager.ExecDataSet("sp_Delete_Order", vParam);
        }
Exemplo n.º 5
0
        public DataTable sp_Get_RMUser_Email(string pEmail)
        {
            ParamStruct[] vParam = new ParamStruct[1];

            vParam[0].ParamName = "@Email";
            vParam[0].DataType = DbType.String;
            vParam[0].value = pEmail;

            return _ConfigurationManager.ExecDataSet("sp_Get_RMUser_Email", vParam);
        }
Exemplo n.º 6
0
        public void sp_Save_RMUser(string pEmail, string pPassword)
        {
            ParamStruct[] vParam = new ParamStruct[2];

            vParam[0].ParamName = "@Email";
            vParam[0].DataType = DbType.String;
            vParam[0].value = pEmail;

            vParam[1].ParamName = "@Password";
            vParam[1].DataType = DbType.String;
            vParam[1].value = pPassword;

            _ConfigurationManager.ExecSql("sp_Save_RMUser", vParam);
        }
        public void ExecSql(string pSql, ParamStruct[] pParameterArray)
        {
            SqlConnection pCon = new SqlConnection(_glCadenaConexion);
            SqlCommand pCmd = new SqlCommand(pSql, pCon);
            pCmd.CommandType = CommandType.StoredProcedure;

            if (pParameterArray != null)
            {
                for (int i = 0; i < pParameterArray.Length; i++)
                {
                    ParamStruct vPs = pParameterArray[i];
                    IDbDataParameter vPm = GetParameter(vPs.ParamName, vPs.direction, vPs.value, vPs.DataType, vPs.sourceColumn, vPs.size);
                    pCmd.Parameters.Add(vPm);
                }
            }

            pCon.Open();
            pCmd.ExecuteNonQuery();
            pCon.Close();
        }