예제 #1
0
        public Orders getFoodHistory(string userid)
        {
            Orders orders = new Orders();

            try
            {
                DataSet        ds    = new DataSet();
                SqlParameter[] param = new SqlParameter[1];
                param[0] = new SqlParameter("@userid", userid);
                ds       = DBConnectionSQL.gettable("GetFoodHistory", param);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        orders.id         = Convert.ToInt32(dr["id"]);
                        orders.orderBy    = dr["email_id"].ToString();
                        orders.full_name  = dr["full_name"].ToString();
                        orders.is_ready   = Convert.ToBoolean(dr["is_ready"]);
                        orders.orderAt    = dr["order_at"].ToString();
                        orders.totalPrice = Convert.ToDouble(dr["total_price"]);
                        orders.foodOrders = getFoodOrderDetails(orders.id);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error" + ex.Message);
            }
            return(orders);
        }
예제 #2
0
        public Orders getOrderByAdmin()
        {
            Orders orders = new Orders();

            try
            {
                DataSet ds = new DataSet();
                ds = DBConnectionSQL.gettable("GetFoodOrder", null);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        orders.id         = Convert.ToInt32(dr["id"]);
                        orders.orderBy    = dr["email_id"].ToString();
                        orders.full_name  = dr["full_name"].ToString();
                        orders.orderAt    = dr["order_at"].ToString();
                        orders.totalPrice = Convert.ToDouble(dr["total_price"]);
                        orders.foodOrders = getFoodOrderDetails(orders.id);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error" + ex.Message);
            }
            return(orders);
        }
예제 #3
0
        public AdminLogin LoginIn(AdminLogin admin)
        {
            DataSet    ds       = new DataSet();
            AdminLogin objLogin = new AdminLogin();

            try
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@username", admin.userName);
                param[1] = new SqlParameter("@password", admin.password);
                ds       = DBConnectionSQL.gettable("getLoginAdmin", param);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    objLogin.userName     = dr["user_name"].ToString();
                    objLogin.userFullName = dr["full_name"].ToString();
                    objLogin.isLogin      = true;
                }
            }
            catch (Exception)
            {
                objLogin.isLogin = false;
                throw;
            }
            return(objLogin);
        }
예제 #4
0
        public List <FoodOrders> getFoodOrderDetails(int orderId)
        {
            List <FoodOrders> lst = new List <FoodOrders>();
            DataSet           ds  = new DataSet();

            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@orderid", orderId);
            ds       = DBConnectionSQL.gettable("GetFoodOrder", param);
            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    FoodOrders objATT = new FoodOrders();
                    objATT.foodName = dr["menu_name,"].ToString();
                    objATT.quantity = dr["quantity"].ToString();
                    objATT.price    = Convert.ToDouble(dr["price"]);
                    lst.Add(objATT);
                }
            }
            return(lst);
        }
예제 #5
0
        public List <Menu> getMenu()
        {
            List <Menu> lst = new List <Menu>();
            DataSet     ds  = new DataSet();

            ds = DBConnectionSQL.gettable("GetMenu", null);
            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Menu objATT = new Menu();
                    objATT._id         = Convert.ToInt32(dr["id"]);
                    objATT.menuName    = dr["menu_name"].ToString();
                    objATT.price       = Convert.ToDouble(dr["price"]);
                    objATT.stock       = dr["quantity"].ToString();
                    objATT.isAvailable = Convert.ToBoolean(dr["is_available"]);
                    lst.Add(objATT);
                }
            }
            return(lst);
        }
예제 #6
0
        public List <Orders> getSalesReport(SalesReport sales)
        {
            List <Orders> lst = new List <Orders>();
            DataSet       ds  = new DataSet();

            SqlParameter[] param = new SqlParameter[2];
            param[0] = new SqlParameter("@fromDate", sales.fromDate);
            param[1] = new SqlParameter("@toDate", sales.toDate);
            ds       = DBConnectionSQL.gettable("GetSalesReports", param);
            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Orders objATT = new Orders();
                    objATT.orderBy    = dr["menu_name,"].ToString();
                    objATT.orderAt    = dr["quantity"].ToString();
                    objATT.totalPrice = Convert.ToDouble(dr["price"]);
                    lst.Add(objATT);
                }
            }
            return(lst);
        }