Exemple #1
0
        //this is get One Function
        public vw_HG_UsersDetails Checkvw_HG_UsersDetails()
        {
            DBCon              dBCon  = new DBCon();
            SqlCommand         cmd    = null;
            SqlDataReader      SDR    = null;
            vw_HG_UsersDetails ObjTmp = null;

            try
            {
                string Query = "SELECT TOP 1 * FROM HG_UsersDetails WHERE UserID = @UserID AND Password = @Password COLLATE Latin1_General_CS_AS;";
                cmd = new SqlCommand(Query, dBCon.Con);
                cmd.Parameters.AddWithValue("@UserID", UserId);
                cmd.Parameters.AddWithValue("@Password", Password);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp               = new vw_HG_UsersDetails();
                    ObjTmp.UserCode      = SDR.GetInt32(0);
                    ObjTmp.OrgID         = SDR.GetInt32(1);
                    ObjTmp.UserType      = SDR.GetString(2);
                    ObjTmp.UserName      = SDR.GetString(3);
                    ObjTmp.UserId        = SDR.GetString(4);
                    ObjTmp.Password      = SDR.GetString(5);
                    ObjTmp.EMail         = SDR.GetString(6);
                    ObjTmp.UPhoto        = SDR.IsDBNull(7) ? "" : SDR.GetString(7);
                    ObjTmp.EntryBy       = SDR.GetInt32(8);
                    ObjTmp.EntryDate     = SDR.GetDateTime(9);
                    ObjTmp.UpdateDate    = SDR.GetDateTime(10);
                    ObjTmp.Status        = SDR.GetBoolean(11);
                    ObjTmp.CurrentStatus = SDR.IsDBNull(12) ? false : SDR.GetBoolean(12);
                    ObjTmp.JoinByOrg     = SDR.GetInt32(13);
                    ObjTmp.IsHeadChef    = SDR.GetBoolean(14);
                    ObjTmp.TickUntick    = SDR.GetBoolean(15);
                    ObjTmp.RateNow       = SDR.GetInt32(16);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); dBCon.Con.Close(); dBCon.Con.Dispose(); SDR.Close(); }
            return(ObjTmp);
        }
        public Int64 Save()
        {
            int        ROW   = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Query = "";
                if (this.ID == 0)
                {
                    Query = "INSERT INTO pendingprint values (@OID,@OrgId,@InvoiceNoCopy,@KotNoOfCopy,@Createdate,@TicketNo)";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("Createdate", DateTime.Now.Date);
                    cmd.Parameters.AddWithValue("OID", this.OID);
                    cmd.Parameters.AddWithValue("OrgId", this.OrgId);
                    cmd.Parameters.AddWithValue("TicketNo", this.TicketNo);
                }
                else
                {
                    Query = "Update pendingprint set InvoiceNoCopy=@InvoiceNoCopy,KotNoOfCopy=@KotNoOfCopy where  ID=@ID";
                    cmd.Parameters.AddWithValue("ID", this.ID);
                }
                cmd.Parameters.AddWithValue("InvoiceNoCopy", this.InvoiceNoCopy);
                cmd.Parameters.AddWithValue("KotNoOfCopy", this.KotNoOfCopy);
                if (this.ID == 0)
                {
                    ROW     = Convert.ToInt32(cmd.ExecuteScalar());
                    this.ID = ROW;
                }
                else
                {
                    ROW = cmd.ExecuteNonQuery();
                    //this.CategoryID = Row;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); dBCon.Con.Close(); }
            return(ROW);
        }
Exemple #3
0
        public static bool IsJoined(Int64 CID, int OrgId)
        {
            string        Query    = "SELECT CID,OrgId from MyCustomer where CID=" + CID.ToString() + " and OrgId=" + OrgId.ToString();
            bool          joindSts = false;
            SqlCommand    cmd      = null;
            SqlDataReader SDR      = null;
            DBCon         Obj      = new DBCon();

            try
            {
                cmd = new SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    joindSts = true;
                    //Cnt++;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(joindSts);
        }
Exemple #4
0
        public List <HG_Ticket> GetAll(int OrgId, DateTime?onDate = null)
        {
            if (!onDate.HasValue)
            {
                onDate = DateTime.Now;
            }
            var CurrOrgID             = HttpContext.Current.Request.Cookies["UserInfo"];
            List <HG_Ticket> listtemp = new List <HG_Ticket>();
            DBCon            con      = new DBCon();
            SqlCommand       cmd      = new SqlCommand();
            string           query    = "select * from HG_Ticket where OrgId =" + OrgId.ToString() + " and CreateDate='" + onDate.Value.Date.ToString("MM/dd/yyyy") + "'";

            try
            {
                cmd = new SqlCommand(query, con.Con);
                SqlDataReader sqlDataReader = cmd.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    HG_Ticket hG_Ticket = new HG_Ticket();
                    hG_Ticket.TicketId       = sqlDataReader.GetInt64(0);
                    hG_Ticket.TicketNo       = sqlDataReader.GetInt32(1);
                    hG_Ticket.OrgId          = sqlDataReader.GetInt32(2);
                    hG_Ticket.OID            = sqlDataReader.GetInt64(3);
                    hG_Ticket.CreationDate   = sqlDataReader.GetDateTime(4);
                    hG_Ticket.DeliveryCharge = sqlDataReader.GetDouble(5);
                    listtemp.Add(hG_Ticket);
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }
            finally
            {
                con.Con.Close(); con.Con.Dispose(); cmd.Dispose();
            }

            return(listtemp);
        }
Exemple #5
0
        public static PaytmResn Getone(Int64 OID)
        {
            PaytmResn  Temp  = new PaytmResn();
            DBCon      con   = new DBCon();
            SqlCommand cmd   = new SqlCommand();
            string     query = "select * from PaytmTxn where OID=@OID";

            try
            {
                cmd = new SqlCommand(query, con.Con);
                cmd.Parameters.AddWithValue("@OID", OID);
                SqlDataReader sqlDataReader = cmd.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    int       index     = -1;
                    PaytmResn hG_Ticket = new PaytmResn();
                    hG_Ticket.id         = sqlDataReader.GetInt32(++index);
                    hG_Ticket.OID        = sqlDataReader.GetInt64(++index);
                    hG_Ticket.OIDkey     = sqlDataReader.GetString(++index);
                    hG_Ticket.TxnId      = sqlDataReader.GetString(++index);
                    hG_Ticket.TxnSts     = sqlDataReader.GetInt32(++index);
                    hG_Ticket.TxtDate    = sqlDataReader.GetDateTime(++index);
                    hG_Ticket.CID        = sqlDataReader.GetInt64(++index);
                    hG_Ticket.PaytmResp  = sqlDataReader.GetString(++index);
                    hG_Ticket.PaidAmount = sqlDataReader.GetString(++index);
                    Temp = hG_Ticket;
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }
            finally
            {
                con.Con.Close(); con.Con.Dispose(); cmd.Dispose();
            }

            return(Temp);
        }
Exemple #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);
        }
Exemple #7
0
        public static List <PaytmResn> GetAll()
        {
            List <PaytmResn> listtemp = new List <PaytmResn>();
            DBCon            con      = new DBCon();
            SqlCommand       cmd      = new SqlCommand();
            string           query    = "select * from PaytmTxn";

            try
            {
                cmd = new SqlCommand(query, con.Con);
                SqlDataReader sqlDataReader = cmd.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    int       index     = -1;
                    PaytmResn hG_Ticket = new PaytmResn();
                    hG_Ticket.id         = sqlDataReader.GetInt32(++index);
                    hG_Ticket.OID        = sqlDataReader.GetInt64(++index);
                    hG_Ticket.OIDkey     = sqlDataReader.GetString(++index);
                    hG_Ticket.TxnId      = sqlDataReader.GetString(++index);
                    hG_Ticket.TxnSts     = sqlDataReader.GetInt32(++index);
                    hG_Ticket.TxtDate    = sqlDataReader.GetDateTime(++index);
                    hG_Ticket.CID        = sqlDataReader.GetInt64(++index);
                    hG_Ticket.PaytmResp  = sqlDataReader.GetString(++index);
                    hG_Ticket.PaidAmount = sqlDataReader.GetString(++index);
                    listtemp.Add(hG_Ticket);
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }
            finally
            {
                con.Con.Close(); con.Con.Dispose(); cmd.Dispose();
            }

            return(listtemp);
        }
Exemple #8
0
        public static List <JoinFoodDo> GetAll(int UserId = 0)
        {
            List <JoinFoodDo> listtemp = new List <JoinFoodDo>();
            DBCon             con      = new DBCon();
            SqlCommand        cmd      = new SqlCommand();
            string            query    = "select * from JoinFoodDo";

            if (UserId > 0)
            {
                query = "select * from JoinFoodDo where JoinedUserd=" + UserId;
            }
            try
            {
                cmd = new SqlCommand(query, con.Con);
                SqlDataReader sqlDataReader = cmd.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    JoinFoodDo hG_Ticket = new JoinFoodDo();
                    hG_Ticket.JoinId      = sqlDataReader.GetInt32(0);
                    hG_Ticket.JoinType    = sqlDataReader.GetInt32(1);
                    hG_Ticket.ProductType = sqlDataReader.GetString(2);
                    hG_Ticket.JoinedUserd = sqlDataReader.GetInt32(3);
                    hG_Ticket.JoinDate    = sqlDataReader.GetDateTime(4);
                    listtemp.Add(hG_Ticket);
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }
            finally
            {
                con.Con.Close(); con.Con.Dispose(); cmd.Dispose();
            }

            return(listtemp);
        }
Exemple #9
0
        public static int UnseenOrd(int OrgId)
        {
            string Query = "SELECT distinct TickedNo,OID FROM HG_OrderItem WHERE  (Status=1 or Status=2) and OID In(select OID from HG_Orders where  Status='1' ";
            int    Count = 0;
            HG_OrganizationDetails ObjOrg = new HG_OrganizationDetails().GetOne(OrgId);

            if (OrgId == 0 || (ObjOrg.OrgID > 0 && ObjOrg.PaymentType == 1))
            {
                Query = "SELECT distinct TickedNo,OID FROM HG_OrderItem WHERE  (Status=1 or Status=2) and OID In(select OID from HG_Orders where  Status='1' and PaymentStatus!= 0 ";
            }
            if (OrgId > 0)
            {
                Query += "and OrgId=" + OrgId.ToString() + " )";
            }
            else
            {
                Query += ")";
            }

            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            HG_OrderItem ObjTmp = new HG_OrderItem();
            DBCon        Obj    = new DBCon();

            try
            {
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    Count = Count + 1;
                }
            }
            catch (System.Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(Count);
        }
Exemple #10
0
        public int Save()
        {
            int        Row = 0;
            DBCon      con = new DBCon();
            SqlCommand cmd = null;

            try
            {
                string Quary = "";
                if (this.ContctID == 0)
                {
                    Quary = "Insert Into LocalContacts Values (@MobileNo,@Cust_Name,@OrgId);SELECT SCOPE_IDENTITY();";
                }
                else
                {
                    Quary = "Update LocalContacts Set MobileNo=@MobileNo,Cust_Name=@Cust_Name where ContctID=@ContctID";
                }
                cmd = new SqlCommand(Quary, con.Con);
                cmd.Parameters.AddWithValue("@ContctID", this.ContctID);
                cmd.Parameters.AddWithValue("@MobileNo", this.MobileNo);
                cmd.Parameters.AddWithValue("@Cust_Name", this.Cust_Name);
                if (this.ContctID == 0)
                {
                    cmd.Parameters.AddWithValue("@OrgId", this.OrgId);
                    Row           = Convert.ToInt32(cmd.ExecuteScalar());
                    this.ContctID = Row;
                }
                else
                {
                    Row = cmd.ExecuteNonQuery();
                    //this.CategoryID = Row;
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); con.Con.Close(); }
            return(Row);
        }
Exemple #11
0
        public int save()
        {
            DBCon      con = new DBCon();
            SqlCommand cmd = new SqlCommand();

            try
            {
                cmd = new SqlCommand("insert into MyCustomer values(@CID,@OrgId,@JoinDate)", con.Con);
                cmd.Parameters.AddWithValue("@CID", this.CID);
                cmd.Parameters.AddWithValue("@OrgId", this.OrgId);
                cmd.Parameters.AddWithValue("@JoinDate", DateTime.Now);
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                e.Message.ToString();
                return(0);
            }
            finally
            {
                cmd.Dispose(); con.Con.Close();
            }
            return(this.OrgId);
        }
Exemple #12
0
        public int TicketCnt(int OrgID, DateTime?onDate = null)
        {
            int TicketOnDate = 0;

            if (!onDate.HasValue)
            {
                onDate = DateTime.Now;
            }
            DBCon      con = new DBCon();
            SqlCommand cmd = new SqlCommand();

            //string query = "select * from HG_Ticket where OrgId =" + OrgId.ToString() + " and CreateDate='" + onDate.Value.Date.ToString("MM/dd/yyyy") + "'";
            try
            {
                cmd             = new SqlCommand("TicketCntOnDate", con.Con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@OrgID", OrgID);
                cmd.Parameters.AddWithValue("@Ondate", onDate.Value.Date.ToString("MM/dd/yyyy"));
                SqlDataReader sqlDataReader = cmd.ExecuteReader();
                while (sqlDataReader.Read())
                {
                    TicketOnDate = sqlDataReader.GetInt32(0);
                    break;
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }
            finally
            {
                con.Con.Close(); con.Con.Dispose(); cmd.Dispose();
            }

            return(TicketOnDate);
        }
Exemple #13
0
        public static List <OrdDiscntChrge> GetAll(string IDS)
        {
            DBCon                 Con     = new DBCon();
            SqlCommand            cmd     = null;
            SqlDataReader         SDR     = null;
            List <OrdDiscntChrge> TmpList = new List <OrdDiscntChrge>();

            try
            {
                string Query = "SELECT * FROM OrderDiscntCharge where ID IN(" + IDS + ")";

                cmd = new SqlCommand(Query, Con.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int            Index  = 0;
                    OrdDiscntChrge ObjTmp = new OrdDiscntChrge();
                    ObjTmp.ID       = SDR.GetInt32(Index++);
                    ObjTmp.Title    = SDR.GetString(Index++);
                    ObjTmp.OID      = SDR.GetInt64(Index++);
                    ObjTmp.Type     = SDR.GetInt32(Index++);
                    ObjTmp.Amt      = SDR.GetDouble(Index++);
                    ObjTmp.Tax      = SDR.GetDouble(Index++);
                    ObjTmp.Remark   = SDR.GetString(Index++);
                    ObjTmp.Datetime = SDR.GetDateTime(Index++);
                    ObjTmp.CBID     = SDR.GetInt32(Index++);
                    TmpList.Add(ObjTmp);
                }
            }
            catch (Exception e)
            { e.ToString(); }

            finally { SDR.Close(); cmd.Dispose(); Con.Con.Close(); Con = null; }

            return(TmpList);
        }
Exemple #14
0
        public int Save()
        {
            int        Row   = 0;
            DBCon      dBCon = new DBCon();
            SqlCommand cmd   = null;

            try
            {
                string Query = "";
                if (this.ItemID == 0)
                {
                    Query = "Insert into  HG_Items  values(@CategoryID,@OrgID,@Items,@Price,@Plates,@ItemMode,@Discount,@EntryBy,@EntryDate,@UpdateDate,@Status,@Item_Img,@ApplyAddOn,@CostPrice,@AddOnCatId,@Type,@AddOnType,@ItmDiscriptn,@ItemAvaibility,@MultiServing); SELECT SCOPE_IDENTITY();";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@EntryBy", this.EntryBy);
                    cmd.Parameters.AddWithValue("@EntryDate", DateTime.Now);
                    cmd.Parameters.AddWithValue("@UpdateDate", DateTime.Now);
                }
                else
                {
                    Query = "update  HG_Items set CategoryID=@CategoryID,OrgID =@OrgID,Items=@Items,Price=@Price,Plates=@Plates,ItemMode=@ItemMode,Discount=@Discount,EntryBy=@EntryBy,UpdateDate=@UpdateDate,Status=@Status,Item_Img=@Item_Img,ApplyAddOn=@ApplyAddOn,CostPrice=@CostPrice,AddOnCatId=@AddOnCatId,Type=@Type,AddOnType=@AddOnType,ItmDiscriptn=@ItmDiscriptn,ItemAvaibility=@ItemAvaibility,MultiServing=@MultiServing where ItemID=@ItemID";
                    cmd   = new SqlCommand(Query, dBCon.Con);
                    cmd.Parameters.AddWithValue("@ItemID", this.ItemID);
                    cmd.Parameters.AddWithValue("@EntryBy", EntryBy);
                    cmd.Parameters.AddWithValue("@UpdateDate", DateTime.Now);
                }
                cmd.Parameters.AddWithValue("@CategoryID", this.CategoryID);
                cmd.Parameters.AddWithValue("@OrgID", this.OrgID);
                cmd.Parameters.AddWithValue("@Items", this.Items);
                cmd.Parameters.AddWithValue("@Price", this.Price);
                cmd.Parameters.AddWithValue("@Plates", this.Qty);
                cmd.Parameters.AddWithValue("@ItemMode ", this.ItemMode);
                cmd.Parameters.AddWithValue("@Discount ", this.Tax);
                cmd.Parameters.AddWithValue("@Status", this.Status);
                cmd.Parameters.AddWithValue("@Item_Img", this.Image);
                cmd.Parameters.AddWithValue("@ApplyAddOn", this.ApplyAddOn);
                cmd.Parameters.AddWithValue("@CostPrice", this.CostPrice);
                cmd.Parameters.AddWithValue("@AddOnCatId", this.AddOnCatId);
                cmd.Parameters.AddWithValue("@Type", this.Type);
                cmd.Parameters.AddWithValue("@AddOnType", this.AddOnType);
                cmd.Parameters.AddWithValue("@ItmDiscriptn", this.ItemDiscription);
                cmd.Parameters.AddWithValue("@ItemAvaibility", this.ItemAvaibility);
                cmd.Parameters.AddWithValue("@MultiServing", this.MultiServing);
                if (this.ItemID == 0)
                {
                    Row         = System.Convert.ToInt32(cmd.ExecuteScalar());
                    this.ItemID = Row;
                }
                else
                {
                    Row = cmd.ExecuteNonQuery();
                    if (Row > 0)
                    {
                        Row = this.ItemID;
                    }
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { dBCon.Con.Close();
                      if (cmd != null)
                      {
                          cmd.Dispose();
                      }
            }
            return(Row);
        }
Exemple #15
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);
        }
Exemple #16
0
        public List <HG_OrderItem> GetAllByOrg(int OrgId, int ChefId = 0, int ItemStatus = 0, bool TodayOnly = false, string Status = null)
        {
            System.Data.SqlClient.SqlCommand    cmd = null;
            System.Data.SqlClient.SqlDataReader SDR = null;
            List <HG_OrderItem> ListTmp             = new List <HG_OrderItem>();
            DBCon Obj = new DBCon();

            try
            {
                string Query = "";
                if (OrgId > 0)
                {
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OrgId=" + OrgId.ToString() + "";
                }
                else if (OrgId <= 0)//super admin && postpaid-admin
                {
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OrgId>0";
                }
                if (ChefId > 0)
                {
                    Query += " and (ChefSeenBy=" + ChefId.ToString() + " or ChefSeenBy=0)";
                }
                if (ItemStatus > 0)
                {
                    Query += " and Status=" + ItemStatus.ToString();
                }
                if (TodayOnly)
                {
                    var Formdate = DateTime.Now;
                    var theDate  = new DateTime(Formdate.Year, Formdate.Month, Formdate.Day, 23, 59, 00);
                    Query = "SELECT * FROM HG_ORDERITEM WHERE OrderDate between '" + Formdate.ToString("MM/dd/yyyy") + "' and '" + theDate.ToString("MM/dd/yyyy HH:mm:ss") + "' and OrgId=" + OrgId.ToString() + "";
                }
                if (Status != null && ItemStatus == 0)
                {
                    Query += " and " + Status;
                }
                cmd = new System.Data.SqlClient.SqlCommand(Query, Obj.Con);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    HG_OrderItem ObjTmp = new HG_OrderItem();
                    ObjTmp.OIID         = SDR.GetInt64(0);
                    ObjTmp.FID          = SDR.GetInt64(1);
                    ObjTmp.Price        = SDR.GetDouble(2);
                    ObjTmp.Count        = SDR.GetInt32(3);
                    ObjTmp.IsAddon      = SDR.GetString(4);
                    ObjTmp.OID          = SDR.GetInt64(5);
                    ObjTmp.Status       = SDR.GetInt32(7);
                    ObjTmp.OrderDate    = SDR.GetDateTime(8);
                    ObjTmp.UpdatedBy    = SDR.GetInt32(9);
                    ObjTmp.UpdationDate = SDR.GetDateTime(10);
                    ObjTmp.TickedNo     = SDR.GetInt32(11);
                    ObjTmp.ChefSeenBy   = SDR.GetInt32(12);
                    ObjTmp.OrgId        = SDR.GetInt32(13);
                    ObjTmp.OrdById      = SDR.GetInt64(14);
                    ObjTmp.TaxInItm     = SDR.GetDouble(15);
                    ObjTmp.CostPrice    = SDR.GetDouble(16);
                    ListTmp.Add(ObjTmp);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); SDR.Close(); Obj.Con.Close(); Obj.Con.Dispose(); Obj.Con = null; }
            return(ListTmp);
        }