Ejemplo n.º 1
0
        public Models.ReportOrderHistoryResultDo GetReportOrderHistory(Models.ReportOrderCriteriaDo criteria)
        {
            Models.ReportOrderHistoryResultDo result = new Models.ReportOrderHistoryResultDo();

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Get_ReportOrderHistory]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(string), "FrontEndID", criteria.FrontEndID);
                command.AddParameter(typeof(int), "BranchID", criteria.BranchID);
                command.AddParameter(typeof(int), "OrderID", criteria.OrderID);

                result.Rows         = command.ToList <Models.ReportOrderHistoryDo>();
                result.TotalRecords = result.Rows.Count;
            }));

            return(result);
        }
Ejemplo n.º 2
0
        public Models.ReportOrderDo GetReportOrder(Models.ReportOrderCriteriaDo criteria)
        {
            Models.ReportOrderDo result = null;

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "[dbo].[sp_Get_ReportOrder]";

                command.AddParameter(typeof(string), "FrontEndID", criteria.FrontEndID);
                command.AddParameter(typeof(int), "BranchID", criteria.BranchID);
                command.AddParameter(typeof(int), "OrderID", criteria.OrderID);

                System.Collections.IList[] dbls = command.ToList(
                    typeof(Models.ReportOrderDo), typeof(Models.OrderTableDo));
                if (dbls != null)
                {
                    List <Models.ReportOrderDo> dbos = dbls[0] as List <Models.ReportOrderDo>;
                    List <Models.OrderTableDo> dbots = dbls[1] as List <Models.OrderTableDo>;

                    if (dbos != null)
                    {
                        if (dbos.Count > 0)
                        {
                            if (dbots != null)
                            {
                                dbos[0].Tables = dbots;
                            }

                            result = dbos[0];
                        }
                    }
                }
            }));

            return(result);
        }
Ejemplo n.º 3
0
        public Models.ReportOrderItemResultDo GetReportOrderItem(Models.ReportOrderCriteriaDo criteria)
        {
            Models.ReportOrderItemResultDo result = new Models.ReportOrderItemResultDo();

            db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) =>
            {
                command.CommandText = "[dbo].[sp_Get_ReportOrderItem]";
                command.CommandType = System.Data.CommandType.StoredProcedure;

                command.AddParameter(typeof(string), "FrontEndID", criteria.FrontEndID);
                command.AddParameter(typeof(int), "BranchID", criteria.BranchID);
                command.AddParameter(typeof(int), "OrderID", criteria.OrderID);

                result.Rows = new List <Models.ReportOrderItemGroupDo>();

                List <Models.ReportOrderItemDo> items = command.ToList <Models.ReportOrderItemDo>();
                if (items != null)
                {
                    foreach (Models.ReportOrderItemDo item in items)
                    {
                        if (item.ItemType == "ITEM" || item.ItemType == "SPCL")
                        {
                            Models.ReportOrderItemGroupDo gitem = result.Rows.Find(x => x.ItemID == item.ItemID);
                            if (gitem == null)
                            {
                                gitem = new Models.ReportOrderItemGroupDo()
                                {
                                    ItemID = item.ItemID
                                };

                                result.Rows.Add(gitem);
                            }

                            gitem.Item = item;
                        }
                        else
                        {
                            Models.ReportOrderItemGroupDo gitem = result.Rows.Find(x => x.ItemID == item.ParentID);
                            if (gitem != null)
                            {
                                if (item.ItemType == "COMT")
                                {
                                    if (gitem.Comments == null)
                                    {
                                        gitem.Comments = new List <Models.ReportOrderItemDo>();
                                    }
                                    gitem.Comments.Add(item);
                                }
                                else if (item.ItemType == "DISC")
                                {
                                    gitem.DiscountItem = item;
                                }
                                else if (item.ItemType == "VOID")
                                {
                                    gitem.VoidItem = item;
                                }
                            }
                        }
                    }
                }

                result.TotalRecords = result.Rows.Count;
            }));

            return(result);
        }