Ejemplo n.º 1
0
        /// <summary>
        /// Executes Stored Procedure named CheckInvoiceLine.
        /// </summary>
        /// <param name="request">The request containing all parameters to call this stored procedure.</param>
        /// <returns>StoredProcResult of CheckInvoiceLine_Result</returns>
        public StoredProcResult <CheckInvoiceLine_Result> CheckInvoiceLine(CheckInvoiceLine_Request request)
        {
            #region Parameters
            var parameters = new QueryFilters <CheckInvoiceLine_RequestProperty> {
                QueryFilter.New(CheckInvoiceLine_RequestProperty.InvoiceLineId, FilterConditions.Equals, request.InvoiceLineId)
            };
            #endregion
            var result = new List <CheckInvoiceLine_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.
            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new CheckInvoiceLine_Result
                    {
                        BlankName_0 = r.GetValue(0) as bool?,
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_Accounting_CheckInvoiceLine, parameters.IFilters, materialize);
            var procResult     = new StoredProcResult <CheckInvoiceLine_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Executes Stored Procedure named GetInvoiceLinesByTrack.
        /// </summary>
        /// <param name="request">The request containing all parameters to call this stored procedure.</param>
        /// <returns>StoredProcResult of GetInvoiceLinesByTrack_Result</returns>
        public StoredProcResult <GetInvoiceLinesByTrack_Result> GetInvoiceLinesByTrack(GetInvoiceLinesByTrack_Request request)
        {
            #region Parameters
            var parameters = new QueryFilters <GetInvoiceLinesByTrack_RequestProperty> {
                QueryFilter.New(GetInvoiceLinesByTrack_RequestProperty.TrackId, FilterConditions.Equals, request.TrackId)
            };
            #endregion
            var result = new List <GetInvoiceLinesByTrack_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.
            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new GetInvoiceLinesByTrack_Result
                    {
                        InvoiceLineId = r.GetInt32(0),
                        InvoiceId     = r.GetInt32(1),
                        TrackId       = r.GetInt32(2),
                        UnitPrice     = r.GetDecimal(3),
                        Quantity      = r.GetInt32(4),
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_Accounting_GetInvoiceLinesByTrack, parameters.IFilters, materialize);
            var procResult     = new StoredProcResult <GetInvoiceLinesByTrack_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Executes Stored Procedure named GetAllInvoices.
        /// </summary>
        /// <returns>StoredProcResult of GetAllInvoices_Result</returns>
        public StoredProcResult <GetAllInvoices_Result> GetAllInvoices()
        {
            var result = new List <GetAllInvoices_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.

            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new GetAllInvoices_Result
                    {
                        InvoiceId         = r.GetInt32(0),
                        CustomerId        = r.GetInt32(1),
                        InvoiceDate       = r.GetDateTime(2),
                        BillingAddress    = r.GetValue(3) as string,
                        BillingCity       = r.GetValue(4) as string,
                        BillingState      = r.GetValue(5) as string,
                        BillingCountry    = r.GetValue(6) as string,
                        BillingPostalCode = r.GetValue(7) as string,
                        Total             = r.GetDecimal(8),
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_Accounting_GetAllInvoices, null, materialize);
            var procResult     = new StoredProcResult <GetAllInvoices_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Executes Stored Procedure named GetAllInvoiceLines.
        /// </summary>
        /// <returns>StoredProcResult of GetAllInvoiceLines_Result</returns>
        public StoredProcResult <GetAllInvoiceLines_Result> GetAllInvoiceLines()
        {
            var result = new List <GetAllInvoiceLines_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.

            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new GetAllInvoiceLines_Result
                    {
                        InvoiceLineId = r.GetInt32(0),
                        InvoiceId     = r.GetInt32(1),
                        TrackId       = r.GetInt32(2),
                        UnitPrice     = r.GetDecimal(3),
                        Quantity      = r.GetInt32(4),
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_Accounting_GetAllInvoiceLines, null, materialize);
            var procResult     = new StoredProcResult <GetAllInvoiceLines_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }
Ejemplo n.º 5
0
        protected ActionStatus GetDBResult(StoredProcResult spResult, string spError, DBActionType DBActionType)
        {
            var    dbResult = new ActionStatus();
            string action   = DBActionType.ToString().ToLower();

            switch (spResult)
            {
            case StoredProcResult.ErrChanged:   dbResult.Message = "Failed to " + action + " because records have been changed since last view. Please reload the page."; break;

            case StoredProcResult.ErrNoRecord:   dbResult.Message = "Failed to " + action + " because record doesn't exist."; break;

            case StoredProcResult.ErrRecExist:   dbResult.Message = "Failed to " + action + " because the record already exists."; break;

            case StoredProcResult.ErrRecHasLink:   dbResult.Message = "Failed to " + action + " because there are records that depend on this one."; break;

            case StoredProcResult.ErrUnknown:       dbResult.Message = "Failed to " + action + "."; break;

            case StoredProcResult.InvalidPassword:       dbResult.Message = "Failed to " + action + " because the password is invalid!"; break;

            case StoredProcResult.Success:       dbResult.Message = "The data was saved successfully!"; dbResult.Success = true; break;

            default:   dbResult.Message = "Failed to " + action + "."; break;
            }

            if (!String.IsNullOrWhiteSpace(spError))
            {
                dbResult.Message += " " + spError;
            }

            return(dbResult);
        }
        /// <summary>
        /// Executes Stored Procedure named GetEmployeesByReportsTo.
        /// </summary>
        /// <param name="request">The request containing all parameters to call this stored procedure.</param>
        /// <returns>StoredProcResult of GetEmployeesByReportsTo_Result</returns>
        public StoredProcResult <GetEmployeesByReportsTo_Result> GetEmployeesByReportsTo(GetEmployeesByReportsTo_Request request)
        {
            #region Parameters
            var parameters = new QueryFilters <GetEmployeesByReportsTo_RequestProperty> {
                QueryFilter.New(GetEmployeesByReportsTo_RequestProperty.EmployeeId, FilterConditions.Equals, request.EmployeeId)
            };
            #endregion
            var result = new List <GetEmployeesByReportsTo_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.
            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new GetEmployeesByReportsTo_Result
                    {
                        EmployeeId = r.GetInt32(0),
                        LastName   = r.GetString(1),
                        FirstName  = r.GetString(2),
                        Title      = r.GetValue(3) as string,
                        ReportsTo  = r.GetValue(4) as int?,
                        BirthDate  = r.GetValue(5) as DateTime?,
                        HireDate   = r.GetValue(6) as DateTime?,
                        Address    = r.GetValue(7) as string,
                        City       = r.GetValue(8) as string,
                        State      = r.GetValue(9) as string,
                        Country    = r.GetValue(10) as string,
                        PostalCode = r.GetValue(11) as string,
                        Phone      = r.GetValue(12) as string,
                        Fax        = r.GetValue(13) as string,
                        Email      = r.GetValue(14) as string,
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_People_GetEmployeesByReportsTo, parameters.IFilters, materialize);
            var procResult     = new StoredProcResult <GetEmployeesByReportsTo_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Executes Stored Procedure named GetInvoicesByEmployee.
        /// </summary>
        /// <param name="request">The request containing all parameters to call this stored procedure.</param>
        /// <returns>StoredProcResult of GetInvoicesByEmployee_Result</returns>
        public StoredProcResult <GetInvoicesByEmployee_Result> GetInvoicesByEmployee(GetInvoicesByEmployee_Request request)
        {
            #region Parameters
            var parameters = new QueryFilters <GetInvoicesByEmployee_RequestProperty> {
                QueryFilter.New(GetInvoicesByEmployee_RequestProperty.EmployeeId, FilterConditions.Equals, request.EmployeeId)
            };
            #endregion
            var result = new List <GetInvoicesByEmployee_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.
            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new GetInvoicesByEmployee_Result
                    {
                        InvoiceId         = r.GetInt32(0),
                        CustomerId        = r.GetInt32(1),
                        InvoiceDate       = r.GetDateTime(2),
                        BillingAddress    = r.GetValue(3) as string,
                        BillingCity       = r.GetValue(4) as string,
                        BillingState      = r.GetValue(5) as string,
                        BillingCountry    = r.GetValue(6) as string,
                        BillingPostalCode = r.GetValue(7) as string,
                        Total             = r.GetDecimal(8),
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_Accounting_GetInvoicesByEmployee, parameters.IFilters, materialize);
            var procResult     = new StoredProcResult <GetInvoicesByEmployee_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }
        /// <summary>
        /// Executes Stored Procedure named GetAllCustomers.
        /// </summary>
        /// <returns>StoredProcResult of GetAllCustomers_Result</returns>
        public StoredProcResult <GetAllCustomers_Result> GetAllCustomers()
        {
            var result = new List <GetAllCustomers_Result>(10000);//warmup the list to try to get a headstart by avoiding auto grow happenning too soon.

            void materialize(SqlDataReader r)
            {
                #region Materializer
                while (r.Read())
                {
                    result.Add(new GetAllCustomers_Result
                    {
                        CustomerId   = r.GetInt32(0),
                        FirstName    = r.GetString(1),
                        LastName     = r.GetString(2),
                        Company      = r.GetValue(3) as string,
                        Address      = r.GetValue(4) as string,
                        City         = r.GetValue(5) as string,
                        State        = r.GetValue(6) as string,
                        Country      = r.GetValue(7) as string,
                        PostalCode   = r.GetValue(8) as string,
                        Phone        = r.GetValue(9) as string,
                        Fax          = r.GetValue(10) as string,
                        Email        = r.GetString(11),
                        SupportRepId = r.GetValue(12) as int?,
                    });
                }
                #endregion
            }

            var procReturnVals = StoredProcedure(RepoLookup.StoredProcId.MainDb_People_GetAllCustomers, null, materialize);
            var procResult     = new StoredProcResult <GetAllCustomers_Result>
            {
                ReturnValue = (int)procReturnVals[ReturnParamId],
                Result      = result.Count > 0 ? result : null
            };
            return(procResult);
        }