예제 #1
0
        public List <HG_Orders> GetListByGetDate(DateTime Formdate, DateTime Todate)
        {
            SqlCommand       cmd     = null;
            SqlDataReader    SDR     = null;
            List <HG_Orders> ListTmp = new List <HG_Orders>();
            var       theDate        = new DateTime(Todate.Year, Todate.Month, Todate.Day, 23, 59, 00);
            HG_Orders ObjTmp         = null;
            DBCon     Obj            = new DBCon();

            try
            {
                //  string Query = "SELECT * FROM HG_ORDERS WHERE Create_Date between '" + Formdate.ToString("MM/dd/yyyy")+"' and '"+ theDate.ToString("MM/dd/yyyy HH:mm:ss")+"' ORDER BY OID DESC";
                cmd             = new SqlCommand("GetOrderByDates", Obj.Con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@FromDate", Formdate.ToString("MM/dd/yyyy"));
                cmd.Parameters.AddWithValue("@Todate", theDate.ToString("MM/dd/yyyy HH:mm:ss"));
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new HG_Orders
                    {
                        OID              = SDR.GetInt64(0),
                        CID              = SDR.GetInt64(1),
                        Status           = SDR.GetString(2),
                        Create_By        = SDR.GetInt64(3),
                        Create_Date      = SDR.GetDateTime(4),
                        Update_By        = SDR.GetInt64(5),
                        Update_Date      = SDR.GetDateTime(6),
                        OrgId            = SDR.GetInt32(8),
                        Table_or_SheatId = SDR.GetInt64(9),
                        PaymentStatus    = SDR.GetInt32(10),
                        PayReceivedBy    = SDR.GetInt32(11),
                        TableOtp         = SDR.GetInt32(12),
                        DisntChargeIDs   = SDR.GetString(13),
                        OrderApprovlSts  = SDR.GetInt32(14),
                        DeliveryCharge   = SDR.GetDouble(15),
                        ContactId        = SDR.GetInt32(16),
                        OfferDishCBID    = SDR.GetInt32(17)
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); }
            return(ListTmp);
        }
예제 #2
0
        //if (ObjOrg.OrderDisplay == 2 && AppType != 3 && ObjOrg.PrinttingType == 2 && (PaymtSts > 0 ||ObjOrg.PaymentType==2))
        // {
        //     PendingPrints.SaveKotPrint(ObjOrders, ObjOrg.Copy, Ticketno);
        // }
        public static void SaveInvoicePrint(HG_Orders order, int NoOfCopy)
        {
            PendingPrints pendingPrints = new PendingPrints();

            pendingPrints.OID           = order.OID;
            pendingPrints.OrgId         = order.OrgId;
            pendingPrints.InvoiceNoCopy = NoOfCopy;
            pendingPrints.KotNoOfCopy   = 0;
            pendingPrints.TicketNo      = 0;
            try
            {
                pendingPrints.Save();
            }
            catch (Exception e)
            {
            }
        }
예제 #3
0
        public List <HG_Orders> GetAllForBS(int OrgId = 0, int CID = 0, int Status = 0)
        {
            SqlCommand       cmd     = null;
            SqlDataReader    SDR     = null;
            List <HG_Orders> ListTmp = new List <HG_Orders>();
            HG_Orders        ObjTmp  = null;
            DBCon            Obj     = new DBCon();

            try
            {
                string Query = "SELECT * FROM HG_ORDERS WHERE OrgId=" + OrgId + "ORDER BY Create_Date ASC";

                cmd = new SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new HG_Orders
                    {
                        OID              = SDR.GetInt64(0),
                        CID              = SDR.GetInt64(1),
                        Status           = SDR.GetString(2),
                        Create_By        = SDR.GetInt64(3),
                        Create_Date      = SDR.GetDateTime(4),
                        Update_By        = SDR.GetInt64(5),
                        Update_Date      = SDR.GetDateTime(6),
                        OrgId            = SDR.GetInt32(8),
                        Table_or_SheatId = SDR.GetInt64(9),
                        PaymentStatus    = SDR.GetInt32(10),
                        PayReceivedBy    = SDR.GetInt32(11),
                        TableOtp         = SDR.GetInt32(12),
                        DisntChargeIDs   = SDR.GetString(13),
                        OrderApprovlSts  = SDR.GetInt32(14),
                        DeliveryCharge   = SDR.GetDouble(15),
                        ContactId        = SDR.GetInt32(16),
                        OfferDishCBID    = SDR.GetInt32(17)
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }
예제 #4
0
        public int DeleteOrderAndOrderItem(System.Int64 OID, bool DeleteOItem)
        {
            HG_Orders Order = new HG_Orders().GetOne(OID);

            if (Order != null)
            {
                Order.Deleted = true;
                Order.Save();
            }
            if (DeleteOItem)
            {
                List <HG_OrderItem> list = new HG_OrderItem().GetAll(OID);
                foreach (var obj in list)
                {
                    obj.Deleted = true;
                    obj.Save();
                }
            }
            return(0);
        }
예제 #5
0
 public static void SaveKotPrint(HG_Orders order, int NoOfCopy, int TicketNo = 0, List <HG_OrderItem> hG_OrderItems = null)
 {
     if (TicketNo == 0)
     {
         var tickets = hG_OrderItems.GroupBy(x => x.TickedNo);
         foreach (var ticket in tickets)
         {
             PendingPrints pendingPrints = new PendingPrints();
             pendingPrints.OID           = order.OID;
             pendingPrints.OrgId         = order.OrgId;
             pendingPrints.KotNoOfCopy   = NoOfCopy;
             pendingPrints.InvoiceNoCopy = 0;
             pendingPrints.TicketNo      = ticket.Key;
             try
             {
                 pendingPrints.Save();
             }
             catch (Exception e)
             {
             }
         }
     }
     else
     {
         PendingPrints pendingPrints = new PendingPrints();
         pendingPrints.OID           = order.OID;
         pendingPrints.OrgId         = order.OrgId;
         pendingPrints.KotNoOfCopy   = NoOfCopy;
         pendingPrints.InvoiceNoCopy = 0;
         pendingPrints.TicketNo      = TicketNo;
         try
         {
             pendingPrints.Save();
         }
         catch (Exception e)
         {
         }
     }
 }
예제 #6
0
        public HG_Orders  GetOne(Int64 OID)
        {
            DBCon         dBCon   = new DBCon();
            SqlCommand    cmd     = null;
            SqlDataReader SDR     = null;
            HG_Orders     ObjTemp = new HG_Orders();

            try
            {
                string Query = "SELECT * FROM HG_Orders Where OID=" + OID.ToString();
                cmd = new SqlCommand(Query, dBCon.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTemp.OID              = SDR.GetInt64(0);
                    ObjTemp.CID              = SDR.GetInt64(1);
                    ObjTemp.Status           = SDR.GetString(2);
                    ObjTemp.Create_By        = SDR.GetInt64(3);
                    ObjTemp.Create_Date      = SDR.GetDateTime(4);
                    ObjTemp.Update_By        = SDR.GetInt64(5);
                    ObjTemp.Update_Date      = SDR.GetDateTime(6);
                    ObjTemp.OrgId            = SDR.GetInt32(8);
                    ObjTemp.Table_or_SheatId = SDR.GetInt64(9);
                    ObjTemp.PaymentStatus    = SDR.GetInt32(10);
                    ObjTemp.PayReceivedBy    = SDR.GetInt32(11);
                    ObjTemp.TableOtp         = SDR.GetInt32(12);
                    ObjTemp.DisntChargeIDs   = SDR.GetString(13);
                    ObjTemp.OrderApprovlSts  = SDR.GetInt32(14);
                    ObjTemp.DeliveryCharge   = SDR.GetDouble(15);
                    ObjTemp.ContactId        = SDR.GetInt32(16);
                    ObjTemp.OfferDishCBID    = SDR.GetInt32(17);
                }
            }
            catch (Exception e) { e.ToString(); }

            finally { dBCon.Close(); cmd.Dispose(); }
            return(ObjTemp);
        }
예제 #7
0
        public static void RemoveDiscntCharge(Int64 SeatingId, int Otp, Int64 OID)
        {
            List <OrdDiscntChrge> discntCharges = DiscntCharge.ListDiscntChrge.FindAll(x => x.SeatingId == SeatingId && x.SeatingOtp == Otp);
            string DisntChargeIDs = "";

            for (int i = 0; i < discntCharges.Count; i++)
            {
                discntCharges[i].Save();
                if (i == 0)
                {
                    DisntChargeIDs += discntCharges[i].ID.ToString();
                }
                else
                {
                    DisntChargeIDs += "," + discntCharges[i].ID.ToString();
                }
            }
            if (DisntChargeIDs != "")
            {
                HG_Orders hG_Orders = new HG_Orders().GetOne(OID);
                if (hG_Orders.OID > 0)
                {
                    if (hG_Orders.DisntChargeIDs != "" && hG_Orders.DisntChargeIDs != "0")
                    {
                        hG_Orders.DisntChargeIDs = hG_Orders.DisntChargeIDs + "," + DisntChargeIDs;
                    }
                    else
                    {
                        hG_Orders.DisntChargeIDs = DisntChargeIDs;
                    }
                    hG_Orders.Save();
                }
            }
            if (discntCharges.Count > 0)
            {
                DiscntCharge.ListDiscntChrge.RemoveAll(x => x.SeatingId == SeatingId && x.SeatingOtp == Otp);
            }
        }
예제 #8
0
        public List <HG_Orders> GetAll(int OrgId = 0, int CID = 0, int Status = 0)
        {
            SqlCommand       cmd     = null;
            SqlDataReader    SDR     = null;
            List <HG_Orders> ListTmp = new List <HG_Orders>();
            HG_Orders        ObjTmp  = null;
            DBCon            Obj     = new DBCon();

            try
            {
                string Query = "SELECT * FROM HG_ORDERS WHERE OrgId=" + OrgId + "";
                if (OrgId > 0)
                {
                    Query = "SELECT * FROM HG_ORDERS WHERE OrgId=" + OrgId + "";
                }
                else if (CID == 0 && OrgId <= 0)
                {
                    Query = "SELECT * FROM HG_ORDERS WHERE OrgId>0";
                }
                if (CID > 0)
                {
                    Query = "select * from HG_Orders where OID in (select Distinct(OID) from HG_OrderItem where OrdById=" + CID + ") ";
                }
                if (Status > 0)
                {
                    Query += "and Status=" + Status.ToString() + " ";
                }
                if (OrgId == 0)
                {
                    Query += " ORDER BY OID DESC";
                }
                else
                {
                    Query += " ORDER BY Create_Date ASC";
                }
                cmd = new SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp = new HG_Orders
                    {
                        OID              = SDR.GetInt64(0),
                        CID              = SDR.GetInt64(1),
                        Status           = SDR.GetString(2),
                        Create_By        = SDR.GetInt64(3),
                        Create_Date      = SDR.GetDateTime(4),
                        Update_By        = SDR.GetInt64(5),
                        Update_Date      = SDR.GetDateTime(6),
                        OrgId            = SDR.GetInt32(8),
                        Table_or_SheatId = SDR.GetInt64(9),
                        PaymentStatus    = SDR.GetInt32(10),
                        PayReceivedBy    = SDR.GetInt32(11),
                        TableOtp         = SDR.GetInt32(12),
                        DisntChargeIDs   = SDR.GetString(13),
                        OrderApprovlSts  = SDR.GetInt32(14),
                        DeliveryCharge   = SDR.GetDouble(15),
                        ContactId        = SDR.GetInt32(16),
                        OfferDishCBID    = SDR.GetInt32(17)
                    };
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }