Beispiel #1
0
 public RevenueCalc(DateTime d, decimal feeRate)
 {
     FeeRate      = feeRate;
     m_WorkingDay = new WorkingDay();
     m_WorkingDay.Set(d);
     m_OrderAdapter.Connection = MapPath.BasicConnection;
 }
Beispiel #2
0
        void LoadData(int year, int month, int day)
        {
            string sql   = "80101";
            int    count = basicDataSet1.Header.Rows.Count;

            if (count != 0)
            {
                BasicDataSet.HeaderRow row = (BasicDataSet.HeaderRow)basicDataSet1.Header.Rows[count - 1]; // 沒指定用最後一個
                if (month != 0 && day > 0)                                                                 // 有指定找到那天
                {
                    foreach (BasicDataSet.HeaderRow r in basicDataSet1.Header.Rows)
                    {
                        if (r.DataDate.Month != month)
                        {
                            continue;
                        }
                        if (r.DataDate.Year != year)
                        {
                            continue;
                        }
                        if (r.DataDate.Day == day)
                        {
                            row = r;
                            break;
                        }
                    }
                }
                else
                {
                    SetupSelectCombo(row.DataDate.Month);
                }
                sql = CreateSql(row.DataDate.Year, row.DataDate.Month, row.DataDate.Day);
                //    "Where INT(ID/10000)=" + (row.DataDate.Year % 100).ToString() + row.DataDate.Month.ToString("d2") + row.DataDate.Day.ToString("d2");
                SetTitle(row.DataDate, row.Closed);
            }
            else
            {
                sql = CreateSql(2000, 1, 1);
                SetTitle(new DateTime(2000, 1, 1), false);
            }
            MaxID = 0;
            try
            {
//                orderTableAdapter1.Fill(basicDataSet1.Order);
//                orderItemTableAdapter1.Fill(basicDataSet1.OrderItem);
                if (checkBoxUse12.Checked)
                {
                    BasicDataSet.OrderDataTable temp = new BasicDataSet.OrderDataTable();
                    m_OrderAdapter.FillBySelectStr(temp, "Select * From [Order] " + sql + " Order by ID");
                    int      todayID = WorkingDay.IDTagHead(year, month, day);
                    DateTime d       = new DateTime(year, month, day);
                    d = d.Subtract(new TimeSpan(24, 0, 0));
                    int prevID = WorkingDay.IDTagHead(d.Year, d.Month, d.Day);
                    basicDataSet1.Order.Clear();
                    foreach (BasicDataSet.OrderRow r in temp)
                    {
                        int idHead = r.ID / 10000;
                        if (idHead == todayID)
                        {
                            if (r.PrintTime.Hour < 7)
                            {
                                continue;
                            }
                        }
                        else if (idHead == prevID)
                        {
                            if (r.PrintTime.Hour >= 7)
                            {
                                continue;
                            }
                        }
                        BasicDataSet.OrderRow oRow = basicDataSet1.Order.NewOrderRow();
                        oRow.ItemArray = r.ItemArray;
                        basicDataSet1.Order.AddOrderRow(oRow);
                    }
                }
                else
                {
                    m_OrderAdapter.FillBySelectStr(basicDataSet1.Order, "Select * From [Order] " + sql + " Order by ID");
                }
                m_OrderItemAdapter.FillBySelectStr(basicDataSet1.OrderItem, "Select * From [OrderItem] " + sql);
                foreach (BasicDataSet.OrderRow R in basicDataSet1.Order.Rows)
                {
                    int id = R.ID % 10000;
                    if (id > MaxID)
                    {
                        MaxID = id;
                    }
                }
            }
            catch (Exception ex)
            {
                string str = ex.Message;
                MessageBox.Show("訂菜單資料庫讀取錯誤!");
            }
            Table2ListView();
        }
Beispiel #3
0
 public RevenueCalcBakery(DateTime d, decimal feeRate)
 {
     FeeRate      = feeRate;
     m_WorkingDay = new WorkingDay();
     m_WorkingDay.Set(d);
 }
Beispiel #4
0
        public bool LoadData(BasicDataSet basicDataSet1, int year, int month, int day, bool Use12)
        {
            int count = basicDataSet1.Header.Rows.Count;

            if (count == 0)
            {
                return(false);
            }
            if (month < 1 || month > 12)
            {
                return(false);
            }
            if (day < 1 || day > 31)
            {
                return(false);
            }
            if (year < 2008 || year > 2020)
            {
                return(false);
            }
            BasicDataSet.HeaderRow row;
            foreach (BasicDataSet.HeaderRow r in basicDataSet1.Header.Rows)
            {
                if (r.DataDate.Month != month)
                {
                    continue;
                }
                if (r.DataDate.Year != year)
                {
                    continue;
                }
                if (r.DataDate.Day == day)
                {
                    row = r;
                    goto Yes;
                }
            }
            return(false);

Yes:
            string sql = CreateSql(row.DataDate.Year, row.DataDate.Month, row.DataDate.Day, Use12);

            try
            {
                if (Use12)
                {
                    BasicDataSet.OrderDataTable temp = new BasicDataSet.OrderDataTable();
                    m_OrderAdapter.FillBySelectStr(temp, "Select * From [Order] " + sql + " Order by ID");
                    int      todayID = WorkingDay.IDTagHead(year, month, day);
                    DateTime d       = new DateTime(year, month, day);
                    d = d.Subtract(new TimeSpan(24, 0, 0));
                    int prevID = WorkingDay.IDTagHead(d.Year, d.Month, d.Day);
                    basicDataSet1.Order.Clear();
                    foreach (BasicDataSet.OrderRow r in temp)
                    {
                        int idHead = r.ID / 10000;
                        if (idHead == todayID)
                        {
                            if (r.PrintTime.Hour < 7)
                            {
                                continue;
                            }
                        }
                        else if (idHead == prevID)
                        {
                            if (r.PrintTime.Hour >= 7)
                            {
                                continue;
                            }
                        }
                        BasicDataSet.OrderRow oRow = basicDataSet1.Order.NewOrderRow();
                        oRow.ItemArray = r.ItemArray;
                        basicDataSet1.Order.AddOrderRow(oRow);
                    }
                }
                else
                {
                    m_OrderAdapter.FillBySelectStr(basicDataSet1.Order, "Select * From [Order] " + sql + " Order by ID");
                }
                //                m_OrderItemAdapter.FillBySelectStr(basicDataSet1.OrderItem, "Select * From [OrderItem] " + sql);
                m_WorkingDay.Set(row.DataDate);
                return(true);
            }
            catch (Exception ex)
            {
                LastErrorString = ex.Message;
            }
            return(false);
        }