private static void QuarterlyReportControl1SaveQuarter(object sender, WPFControls.ReportEventArgs e) { QuarterInfo qi = e.Info; SetMonthlySalesData.MonthlySales(Configuration.operatorID, qi.Month1.Date.Month, qi.Month1.Date.Year, qi.Month1); SetMonthlySalesData.MonthlySales(Configuration.operatorID, qi.Month2.Date.Month, qi.Month2.Date.Year, qi.Month2); SetMonthlySalesData.MonthlySales(Configuration.operatorID, qi.Month3.Date.Month, qi.Month3.Date.Year, qi.Month3); }
public static QuarterInfo GetPreviousQuarter(QuarterInfo presentQuarter) { int quarterNo = (int)presentQuarter.Quarter; int year = presentQuarter.Year; quarterNo--; if (quarterNo < (int)QuarterInfo.QuarterEnum.First) { year--; quarterNo = (int)QuarterInfo.QuarterEnum.Fourth; } return(new QuarterInfo((QuarterInfo.QuarterEnum)quarterNo, year)); }
public static QuarterInfo GetNextQuarter(QuarterInfo presentQuarter) { int quarterNo = (int)presentQuarter.Quarter; int year = presentQuarter.Year; quarterNo++; if (quarterNo > (int)QuarterInfo.QuarterEnum.Fourth) { year++; quarterNo = (int)QuarterInfo.QuarterEnum.First; } return(new QuarterInfo((QuarterInfo.QuarterEnum)quarterNo, year)); }
protected void Submit2_Click(object sender, EventArgs e) { if (EmpID.Text == "" || QuarterID.Text == "") { Response.Write("<script>alert('Please enter all of the details.');</script>"); ClearForm(); } else if (CheckIfExists()) { Response.Write("<script>alert('The employee is allocated to a quarter already or the quarter is already taken.');</script>"); ClearForm(); } else { AddNew(); QuarterInfo.DataBind(); ClearForm(); } }
private static void QuarterlyReportControl1LoadQuarter(object sender, WPFControls.ReportEventArgs e) { QuarterInfo qi = e.Info; GetMonthlySalesData.MonthlySales(Configuration.operatorID, qi.Month1.Date.Month, qi.Month1.Date.Year, qi.Month1); GetMonthlySalesData.MonthlySales(Configuration.operatorID, qi.Month2.Date.Month, qi.Month2.Date.Year, qi.Month2); GetMonthlySalesData.MonthlySales(Configuration.operatorID, qi.Month3.Date.Month, qi.Month3.Date.Year, qi.Month3); qi.Month1.SysBingoSales = GetMontlyBingoSalesData.MonthlyBingoSales(Configuration.operatorID, qi.Month1.Date.Month, qi.Month1.Date.Year); qi.Month2.SysBingoSales = GetMontlyBingoSalesData.MonthlyBingoSales(Configuration.operatorID, qi.Month2.Date.Month, qi.Month2.Date.Year); qi.Month3.SysBingoSales = GetMontlyBingoSalesData.MonthlyBingoSales(Configuration.operatorID, qi.Month3.Date.Month, qi.Month3.Date.Year); qi.Month1.SysOtherSales = GetMonthlyOtherSalesData.MonthlyOtherSales(Configuration.operatorID, qi.Month1.Date.Month, qi.Month1.Date.Year); qi.Month2.SysOtherSales = GetMonthlyOtherSalesData.MonthlyOtherSales(Configuration.operatorID, qi.Month2.Date.Month, qi.Month2.Date.Year); qi.Month3.SysOtherSales = GetMonthlyOtherSalesData.MonthlyOtherSales(Configuration.operatorID, qi.Month3.Date.Month, qi.Month3.Date.Year); }
protected void Page_Load(object sender, EventArgs e) { //This is to redirect the page if the user is not logged in if (string.IsNullOrEmpty((string)Session["role"])) { Response.Redirect("~/"); } if (!IsPostBack) { SqlConnection connection = new SqlConnection(Strcon); connection.Open(); SqlCommand Command = new SqlCommand("SELECT employee.emp_id from employee LEFT JOIN allocatedquarter ON allocatedquarter.emp_id=employee.emp_id WHERE allocatedquarter.emp_id IS NULL;", connection); SqlCommand Command2 = new SqlCommand("SELECT quarterlist.quarter_id from quarterlist LEFT JOIN allocatedquarter ON allocatedquarter.quarter_id=quarterlist.quarter_id WHERE allocatedquarter.quarter_id IS NULL;", connection); EmpID.DataSource = Command.ExecuteReader(); QuarterID.DataSource = Command2.ExecuteReader(); EmpID.DataBind(); QuarterID.DataBind(); QuarterID.Items.Insert(0, new ListItem("Select a quarter ID", "")); EmpID.Items.Insert(0, new ListItem("Select a employee ID", "")); QuarterInfo.DataBind(); connection.Close(); } }
public static void GetNextPrevDates(DTC.RangeEnum range, DateTime date, NextPrevEnum np, out DateTime startDate, out DateTime endDate) { startDate = DateTime.Today; endDate = DateTime.Today; if (range == DTC.RangeEnum.Day) { if (np == NextPrevEnum.Next) { startDate = date.AddDays(1); endDate = startDate; } if (np == NextPrevEnum.Previous) { startDate = date.AddDays(-1); endDate = startDate; } if (np == NextPrevEnum.Today) { startDate = date; endDate = startDate; } } else if (range == DTC.RangeEnum.Week) { WeekInfo week = new WeekInfo(date); if (np == NextPrevEnum.Next) { startDate = GetNextWeek(week).StartDate; endDate = GetNextWeek(week).EndDate; } if (np == NextPrevEnum.Previous) { startDate = GetPreviousWeek(week).StartDate; endDate = GetPreviousWeek(week).EndDate; } if (np == NextPrevEnum.Today) { startDate = week.StartDate; endDate = week.EndDate; } } else if (range == DTC.RangeEnum.Month) { MonthInfo month = new MonthInfo(date); if (np == NextPrevEnum.Next) { startDate = GetNextMonth(month).StartDate; endDate = GetNextMonth(month).EndDate; } if (np == NextPrevEnum.Previous) { startDate = GetPreviousMonth(month).StartDate; endDate = GetPreviousMonth(month).EndDate; } if (np == NextPrevEnum.Today) { startDate = month.StartDate; endDate = month.EndDate; } } else if (range == DTC.RangeEnum.Quarter) { QuarterInfo quarter = new QuarterInfo(date); if (np == NextPrevEnum.Next) { startDate = GetNextQuarter(quarter).StartDate; endDate = GetNextQuarter(quarter).EndDate; } if (np == NextPrevEnum.Previous) { startDate = GetPreviousQuarter(quarter).StartDate; endDate = GetPreviousQuarter(quarter).EndDate; } if (np == NextPrevEnum.Today) { startDate = quarter.StartDate; endDate = quarter.EndDate; } } else if (range == DTC.RangeEnum.Year) { if (np == NextPrevEnum.Next) { startDate = new YearInfo(date.Year + 1).StartDate; endDate = new YearInfo(date.Year + 1).EndDate; } if (np == NextPrevEnum.Previous) { startDate = new YearInfo(date.Year - 1).StartDate; endDate = new YearInfo(date.Year - 1).EndDate; } if (np == NextPrevEnum.Today) { startDate = new YearInfo(date.Year).StartDate; endDate = new YearInfo(date.Year).EndDate; } } }