Example #1
0
 // Methods
 public void Execute(Customer customer)
 {
     if (customer.CustomerType.Equals("INACTIVE"))
     {
         throw new Exception("INACTIVE ID");
     }
     Transaction transaction = new Transaction();
     transaction.PeopleID = customer.PeopleID;
     transaction.Amount = customer.MealCost.Amout;
     transaction.PlanID = customer.PlanId;
     transaction.LocationID = this.location;
     transaction.Ttid = this.ttid;
     transaction.employeeCredit(customer);
 }
Example #2
0
 protected void btnAddMunchCharge_Click(object sender, EventArgs e)
 {
     try
     {
         this.lblMunchError.Text = "";
         Location location = (Location) this.Session["location"];
         decimal num = 0M;
         string s = "";
         if (location.isCafe())
         {
             s = this.txtTotalChargeCopy.Text;
         }
         else
         {
             s = this.txtTotalCharge.Text;
         }
         num = num = decimal.Parse(s, NumberStyles.Currency);
         if (num == 0M)
         {
             throw new Exception("The transaction amount is 0");
         }
         if (num > 500M)
         {
             throw new Exception("The transaction amount(" + num +") is excessive.  Did you put a campus id into the amount field?");
         }
         Customer c = (Customer) this.Session["customer"];
         if (c == null)
         {
             throw new Exception("You must set the customer first");
         }
         bool flag = c.isEmployee();
         decimal munchMoney = c.MunchMoney;
         if (!flag && (num > munchMoney))
         {
             throw new Exception("Not enough munch money");
         }
         Transaction transaction = new Transaction(c);
         transaction.Amount = num;
         transaction.LocationID = location.LocationId;
         if (!flag)
         {
             transaction.munchMoney();
             this.lblMMAvailable.Text = c.MunchMoney.ToString("#,##0.00");
         }
         else
         {
             transaction.employeeCredit(c);
             this.lblMMAvailable.Text = c.EmployeeCharges.ToString("#,##0.00");
         }
         this.txtTotalCharge.Text = "";
         this.txtTotalChargeCopy.Text = "";
         this.transactionCompleted(true);
     }
     catch (Exception exception)
     {
         this.PrepareError(exception.Message);
     }
 }