示例#1
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     MealPlan mp = new MealPlan();
     mp.find("PlanID = '" + this.ddlMealPlan.Text + "'");
     this.customer = (Customer)ViewState["customer"];
     this.tbCurrentMeals.Text = (this.customer.CurrentMeals + mp.MealsPerWeek).ToString();
 }
示例#2
0
 protected void btnCreate_Click(object sender, EventArgs e)
 {
     try
     {
         Customer customer = new Customer();
         customer.find("(c.[PeopleID]='" + this.tbID.Text + "')");
         if (customer.PeopleID != null)
         {
             throw new Exception("Already Exists");
         }
         customer.PeopleID = this.tbID.Text;
         customer.FirstName = this.lblFirstName.Text;
         customer.LastName = this.lblLastName.Text;
         customer.PlanId = this.ddlMealPlan.SelectedValue;
         customer.CustomerType = this.ddlCustType.SelectedValue;
         MealPlan plan = new MealPlan();
         plan.find("planID = '" + customer.PlanId + "'");
         if (plan.PlanId != null)
         {
             customer.CurrentMeals = plan.MealsPerWeek;
             customer.MunchMoney = plan.MunchMoney;
         }
         customer.create(this.txtNotes.Text);
         this.prepareError("Created!!");
         this.txtNotes.Text = "";
     }
     catch (Exception exception)
     {
         this.lblError.Text = exception.Message;
         this.lblError.Visible = true;
     }
     this.tbID.Focus();
 }
示例#3
0
 protected void btnSet_Click(object sender, EventArgs e)
 {
     MealPlan mp = new MealPlan();
     mp.find("PlanID = '" + this.ddlMealPlan.Text + "'");
     this.tbCurrentMeals.Text = mp.MealsPerWeek.ToString();
 }