Exemplo n.º 1
0
        public SalesEnquiryOptionQM GetSalesEnquiryForGrid(DateTime FromDate, DateTime ToDate, Int16 WorkOrdeType, Int16 Option, string Type)
        {
            SalesEnquiryOptionQM salesEnquiryOptionQM = new SalesEnquiryOptionQM();

            using (var connection = new DbConnectionProvider().CreateConnection())
            {
                connection.Open();

                var command = new GetSalesEnquiryForGridSelectCommand {
                    Connection = connection
                };
                salesEnquiryOptionQM = command.Execute(FromDate, ToDate, WorkOrdeType, Option, Type);
            }

            return(salesEnquiryOptionQM);
        }
        public SalesEnquiryOptionQM Execute(DateTime FromDate, DateTime ToDate, Int16 WorkOrdeType, Int16 Option, string Type)
        {
            SalesEnquiryOptionQM response = new SalesEnquiryOptionQM();

            using (var sqlCommand = CreateCommand())
            {
                sqlCommand.Connection  = Connection;
                sqlCommand.CommandText = "[dbo].[uspGetSalesEnquiry]";
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.Parameters.Add(AddParameter("@FromDate", SsDbType.DateTime, ParameterDirection.Input, FromDate));
                sqlCommand.Parameters.Add(AddParameter("@ToDate", SsDbType.DateTime, ParameterDirection.Input, ToDate));
                sqlCommand.Parameters.Add(AddParameter("@WorkOrderType", SsDbType.SmallInt, ParameterDirection.Input, WorkOrdeType));
                sqlCommand.Parameters.Add(AddParameter("@IsOption", SsDbType.SmallInt, ParameterDirection.Input, Option));
                sqlCommand.Parameters.Add(AddParameter("@Type", SsDbType.NVarChar, ParameterDirection.Input, Type));

                using (var reader = SsDbCommandHelper.ExecuteReader(sqlCommand))
                {
                    response.getSalesEnquiryOptionModel = reader.ToList <SalesEnquiryOptionModel>();
                }
            }

            return(response);
        }