protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { dsAuxCost = ContextBase.GetCacheData(); if (dsAuxCost == null) { Response.Redirect("~"); } else if (dsAuxCost.DataSetName != "ConAuxCost") { Response.Redirect("~"); } } else { ContextBase.RemoveCacheData(); //remove anything left in cache dsAuxCost = new DataSet("ConAuxCost"); DataCommand().Param("CostType", "All").MapSchema().FillDataSet(dsAuxCost, "dbo.AuxCost_Select", "AuxCost"); ContextBase.SetCacheData(dsAuxCost); BindGrids(); } }
protected void Page_Load(object sender, EventArgs e) { lblWarning.Text = string.Empty; lblWarning.Visible = false; if (Page.IsPostBack) { dsReport = ContextBase.GetCacheData(); if (dsReport == null) { Response.Redirect("~"); } else if (dsReport.DataSetName != "DatHistorical") { Response.Redirect("~"); } } else { ContextBase.RemoveCacheData(); //remove anything left in cache dsReport = new DataSet("DatHistorical"); DataCommand().Param("Action", "All").Param("sDate", DateTime.Parse("1/1/2000")).FillDataSet(dsReport, "dbo.Client_Select", "Client"); dsReport.Tables["Client"].PrimaryKey = new[] { dsReport.Tables["Client"].Columns["ClientID"] }; using (var reader = DataCommand().Param("Action", "All").ExecuteReader("dbo.Org_Select")) { ddlOrg.DataSource = reader; ddlOrg.DataValueField = "OrgID"; ddlOrg.DataTextField = "OrgName"; ddlOrg.DataBind(); ddlOrg.Items.Insert(0, new ListItem("-- Select --", "0")); ddlOrg.ClearSelection(); reader.Close(); } ContextBase.SetCacheData(dsReport); // populate site dropdown - preselect using site linked in from } }
protected void Page_Load(object sender, EventArgs e) { lblError.Visible = false; txtFormula.Attributes.Add("spellcheck", "false"); if (Page.IsPostBack) { dsFormula = ContextBase.GetCacheData(); if (dsFormula == null) { Response.Redirect("~"); } else if (dsFormula.DataSetName != "ConFormula") { Response.Redirect("~"); } } else { ContextBase.RemoveCacheData(); //remove anything left in cache Session["ItemType"] = Request.QueryString["ItemType"]; Session["Exp"] = Request.QueryString["Exp"]; string exp = Convert.ToString(Session["Exp"]); if (!string.IsNullOrEmpty(exp)) { tableNamePrefix = exp; btnBack.Text = "Return to Experimental Cost Config"; } litHeader.Text = string.Format("Configure {0} costing fomulas", tableNamePrefix); dsFormula = new DataSet("ConFormula"); DataCommand().Param("sDate", DateTime.Now).MapSchema().FillDataSet(dsFormula, $"dbo.{tableNamePrefix}CostFormula_Select", "Formula"); ContextBase.SetCacheData(dsFormula); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { dsReport = ContextBase.GetCacheData(); if (dsReport == null) { Response.Redirect("~"); } else if (dsReport.DataSetName != "DatClient") { Response.Redirect("~"); } } else { dsReport = new DataSet("DatClient"); //get Role info DataCommand() .Param("TableName", "Role") .FillDataSet(dsReport, "dbo.Global_Select", "Role"); //get UserType info DataCommand() .Param("TableName", "Community") .FillDataSet(dsReport, "dbo.Global_Select", "Communities"); //grab all departments DataCommand() .Param("Action", "All") .FillDataSet(dsReport, "dbo.Department_Select", "Department"); ContextBase.SetCacheData(dsReport); UpdateClientDDL(); } }
private void BindPerUseBilling(DateTime period, int clientId) { gvRoom.DataSource = null; gvRoom.DataBind(); //Create the list to contain all summary total for each organization //IList<UsageSummaryTotal> mylist = new List<UsageSummaryTotal>(); DataTable SummaryTable = new DataTable(); SummaryTable.Columns.Add("OrgID", typeof(int)); SummaryTable.Columns.Add("OrgName", typeof(string)); SummaryTable.Columns.Add("BillingTypeID", typeof(int)); SummaryTable.Columns.Add("RoomTotal", typeof(double)); SummaryTable.Columns.Add("ToolTotal", typeof(double)); SummaryTable.Columns.Add("StoreTotal", typeof(double)); double sumCost = 0.0; var dsReport = ContextBase.GetCacheData(); gvRoom.DataSource = BillingManager.GetRoomCost(dsReport, period, clientId, SummaryTable, ref sumCost); gvRoom.DataBind(); lblRoom2.Text = string.Format("Total lab usage fees: {0:C}", sumCost); DataTable dtCancelled = null; DataTable dtForgiven = null; gvTool2.DataSource = BillingManager.GetToolCost(dsReport, period, clientId, SummaryTable, ref sumCost, dtCancelled, dtForgiven); gvTool2.DataBind(); gvToolCancelled2.DataSource = dtCancelled; gvToolCancelled2.DataBind(); gvToolForgiven2.DataSource = dtForgiven; gvToolForgiven2.DataBind(); double cancelledCost; double forgivenCost; if (dtCancelled == null || dtCancelled.Rows.Count == 0) { cancelledCost = 0; } else { cancelledCost = Convert.ToDouble(dtCancelled.Compute("SUM(TotalCalcCost)", string.Empty)); } if (dtForgiven == null || dtForgiven.Rows.Count == 0) { forgivenCost = 0; } else { forgivenCost = Convert.ToDouble(dtForgiven.Compute("SUM(TotalCalcCost)", string.Empty)); } lblTool2.Text = string.Format("Total tool usage fees: {0:C}", sumCost + cancelledCost); lblActivatedToolFee2.Text = string.Format("Sub Total: {0:C}", sumCost); lblCancelledToolFee2.Text = string.Format("Sub Total: {0:C}", cancelledCost); lblForgivenToolFee2.Text = string.Format("Sub Total: {0:$#,##0.00;($#,##0.00)}", forgivenCost); //Store //gvStore2.DataSource = BillingManager.GetStoreCost(period, clientId, SummaryTable, sumCost); //gvStore2.DataBind(); //lblStore2.Text = string.Format("Total store usage fees: {0:C}", sumCost); if (dtStore2.Rows.Count > 0) { foreach (DataRow r in SummaryTable.Rows) { r["StoreTotal"] = dtStore2.Compute("SUM(CalcCost)", string.Format("OrgID = {0}", r["OrgID"])); if (r["StoreTotal"] == null || r["StoreTotal"] == DBNull.Value) { r["StoreTotal"] = 0.0; } } gvStore2.DataSource = dtStore2; gvStore2.DataBind(); object sumobj; //2009-08-05 it's possible that a user bought stuff but didn't use the lab at all sumobj = SummaryTable.Compute("SUM(StoreTotal)", string.Empty); if (sumobj == null || sumobj == DBNull.Value) { sumCost = 0.0; //no lab usage, only store usage sumobj = dtStore2.Compute("SUM(CalcCost)", string.Empty); if (sumobj != null && sumobj != DBNull.Value) { sumCost = Convert.ToDouble(sumobj); } } else { sumCost = Convert.ToDouble(sumobj); } lblStore2.Text = string.Format("Total store usage fees: {0:C}", sumCost); } else { lblStore2.Text = "No store usage during period"; foreach (DataRow r in SummaryTable.Rows) { r["StoreTotal"] = 0.0; } } dlSummary2.DataSource = SummaryTable; dlSummary2.DataBind(); }