public bool LoadData(DamaiDataSet orderSet, int month, int day) { int count = orderSet.Header.Rows.Count; if (count == 0) { return(false); } if (month < 1 || month > 12) { return(false); } if (day < 1 || day > 31) { return(false); } DamaiDataSet.HeaderRow row; foreach (var r in orderSet.Header) { if (r.DataDate.Year != MyFunction.IntHeaderYear) { continue; } if (r.DataDate.Month != month) { continue; } if (r.DataDate.Day == day) { row = r; goto Yes; } } return(false); Yes: string sql = CreateSql(row.DataDate.Month, row.DataDate.Day); try { m_OrderAdapter.FillBySelectStr(orderSet.Order, "Select * From [Order] " + sql + " Order by ID"); m_WorkingDay.Set(row.DataDate); return(true); } catch (Exception ex) { LastErrorString = ex.Message; if (MessageBox.Show(LastErrorString, "", MessageBoxButtons.RetryCancel) == DialogResult.Cancel) { throw ex; } } return(false); }
public RevenueCalc(DateTime d, decimal feeRate) { FeeRate = feeRate; m_WorkingDay = new WorkingDay(); m_WorkingDay.Set(d); m_OrderAdapter.Connection = MapPath.BasicConnection; }
public RevenueCalcBakery(DateTime d, decimal feeRate) { FeeRate = feeRate; m_WorkingDay = new WorkingDay(); m_WorkingDay.Set(d); }
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); }