public MODEL.DashboardCashier getDashboardCashier([FromBody] MODEL.Criteria.reqDashboard req)
 {
     MODEL.DashboardCashier result = new MODEL.DashboardCashier();
     result.ResultOk = "false";
     try
     {
         if (req != null)
         {
             result.ResultOk              = "true";
             result.ErrorMessage          = "";
             result.FoodsOrder            = "15";
             result.CountTable            = "2";
             result.CountSalesOrderPerDay = "45,000";
             List <Bill> listBill = new List <Bill>();
             Bill        mBill;
             mBill                = new Bill();
             mBill.billID         = "20191020002";
             mBill.billNo         = "20191020002";
             mBill.billCreateDate = "20-10-2019 08:30:00";
             mBill.billCreateName = "sombut";
             mBill.billTableName  = "10";
             mBill.billMenuCount  = "6";
             mBill.billTotalPrice = "4000";
             mBill.billStatusText = "Complete";
             listBill.Add(mBill);
             mBill                = new Bill();
             mBill.billID         = "20191020003";
             mBill.billNo         = "20191020003";
             mBill.billCreateDate = "20-10-2019 10:30:00";
             mBill.billCreateName = "nathan";
             mBill.billTableName  = "15";
             mBill.billMenuCount  = "4";
             mBill.billTotalPrice = "7500";
             mBill.billStatusText = "Complete";
             listBill.Add(mBill);
             result.list = listBill;
         }
     }
     catch (Exception e)
     {
         result.ErrorMessage = e.Message;
         result.ResultOk     = "false";
     }
     finally
     {
     }
     return(result);
 }
Beispiel #2
0
        public MODEL.DashboardCashier getDashboardCashier(MODEL.Criteria.reqDashboard req)
        {
            SqlConnection conn = new SqlConnection(DataHelper.GetConnectionString());
            DataSet       ds   = new DataSet();

            MODEL.DashboardCashier result = new MODEL.DashboardCashier();
            List <Bill>            bill   = new List <Bill>();

            try
            {
                conn.Open();

                string         Sql;
                SqlDataAdapter adp = new SqlDataAdapter("sp_getDashboard_Cashier", conn);
                adp.SelectCommand.CommandType = CommandType.StoredProcedure;
                adp.SelectCommand.Parameters.Add(new SqlParameter("@restaurantID", req.RestaurantID));
                adp.SelectCommand.Parameters.Add(new SqlParameter("@StartDate", req.DashboardDate + " 00:00"));
                adp.SelectCommand.Parameters.Add(new SqlParameter("@EndDate", req.DashboardDate + " 23:59"));
                //adp.Fill(ds);
                adp.Fill(ds);
                if (ds.Tables.Count > 0)
                {
                    result.ResultOk              = "true";
                    result.FoodsOrder            = ds.Tables[0].Rows[0][0].ToString().Trim();
                    result.CountTable            = ds.Tables[1].Rows[0][0].ToString().Trim();
                    result.CountSalesOrderPerDay = ds.Tables[2].Rows[0][0].ToString().Trim();
                    result.CountNoticeBill       = ds.Tables[3].Rows[0][0].ToString().Trim();
                    if (ds.Tables[4].Rows.Count > 0)
                    {
                        DataTable dt = new DataTable();
                        dt = ds.Tables[4];
                        Bill f;
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            f                = new Bill();
                            f.queue_no       = dt.Rows[i]["queue_no"].ToString().Trim();
                            f.billNo         = dt.Rows[i]["order_no"].ToString().Trim();
                            f.billTableName  = dt.Rows[i]["table_name"].ToString().Trim();
                            f.billMenuCount  = dt.Rows[i]["CountFoods2"].ToString().Trim();
                            f.billTotalPrice = dt.Rows[i]["SumPrice2"].ToString().Trim();
                            f.billStatusText = dt.Rows[i]["status_order"].ToString().Trim();
                            bill.Add(f);
                        }
                    }
                    result.list = bill;
                }
                else
                {
                    result.ResultOk = "false";
                }
            }
            catch (Exception ex)
            {
                result.ResultOk     = "false";
                result.ErrorMessage = ex.Message;
            }
            finally
            {
                conn.Close();
            }
            return(result);
        }