using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.Odbc;
namespace InfoSoftGlobal.BluePrintApp.FC_ASP
{
///
/// Summary description for Data_EmpYearlySales.
///
public class Data_EmpYearlySales : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
//'This method writes the employee yearly sales data as XML.
//'To this page, we're provided employeed Id.
string eId;
eId = Request.QueryString["id"];
Functions functionForWriter = new Functions();
functionForWriter.Write("");
//'Get the data for employee for 3 years - 1994,95,96
functionForWriter.Write("");
functionForWriter.Write("");
functionForWriter.Write("");
functionForWriter.Write("");
}
private string getSalesFigure(string eId, string intYear)
{
//'Initialize database objects
string query;
string salesFigure;
//'Retrieve the data
query = "SELECT e.lastname, SUM(d.quantity*p.UnitPrice) As Total FROM FC_Employees as e,FC_Orders as o, FC_OrderDetails as d, FC_Products as p WHERE YEAR(OrderDate)=" + intYear + " and e.EmployeeID=" + eId + " and e.employeeid= o.employeeid and o.orderid= d.orderid and d.productid=p.productid GROUP BY e.lastname,e.EmployeeID ORDER BY SUM(d.quantity*p.UnitPrice*(1- d.discount)) DESC" ;
using (OdbcConnection connection = DbHelper.Connection(DbHelper.ConnectionStringFisionChart))
{
using (OdbcCommand command = new OdbcCommand(query, connection))
{
using (OdbcDataReader reader= command.ExecuteReader())
{
if (reader.HasRows)
salesFigure = ((int)(decimal)reader["Total"]).ToString();
else
salesFigure = "0";
}
}
connection.Close();
}
return salesFigure;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}