protected void btnAddPlan_Click(object sender, EventArgs e) { divError.Visible = false; divSuccess.Visible = false; if (Page.IsValid) { if (!string.IsNullOrEmpty(txtEnergyPlanName.Text) && !string.IsNullOrEmpty(txtFixedCost.Text) && !string.IsNullOrEmpty(txtVarCost.Text)) { EnergyPlanDal pdal = new EnergyPlanDal(); EnergyPlan ep = new EnergyPlan(); ep.CreateDate = DateTime.Now; ep.EnergyPlanName = txtEnergyPlanName.Text; ep.EnergyPlanFixedCost = Decimal.Parse(String.Format("{0:N2}", txtFixedCost.Text)); ep.EnergyPlanVarCost = Decimal.Parse(String.Format("{0:N2}", txtVarCost.Text)); var savedPlan = pdal.SaveEnergyPlan(ep); divSuccess.Visible = true; if (savedPlan != null && savedPlan.EnergyPlanId > 0) { divSuccess.Visible = true; } gvPlan.DataSource = pdal.GetAllPlans(); gvPlan.DataBind(); ClearForm(); } else { divError.Visible = true; } } else { divError.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Page.Title = "Add Customer"; divError.Visible = false; divSuccess.Visible = false; EnergyPlanDal pdal = new EnergyPlanDal(); gvPlan.DataSource = pdal.GetAllPlans(); gvPlan.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Page.Title = "View Files"; DocumentDal dal = new DocumentDal(); EnergyPlanDal pdal = new EnergyPlanDal(); gvFiles.DataSource = dal.GetAllFiles(); gvFiles.DataBind(); } }