コード例 #1
0
ファイル: ExportData.cs プロジェクト: allanckw/GEMS-Web
 public ExportData(Events evnt, EventDay[] days, Task[] tasks, FacilityBookingConfirmed[][] facilities, Program[][] programs, Guest[][] guests, Participant[] participants
     , OptimizedBudgetItems optitems, BudgetIncome[] budgetincomes, Field[] field)
 {
     this.evnts = evnt;
     this.days = days;
     this.tasks = tasks;
     this.facilities = facilities;
     this.programs = programs;
     this.guests = guests;
     this.participants = participants;
     this.optitems = optitems;
     this.budgetincomes = budgetincomes;
     this.field = field;
 }
コード例 #2
0
        public static void EditBudgetIncome(User user, int EventID, int IncomeID, BudgetIncome bIncome)
        {
            if (!user.isAuthorized(EventController.GetEvent(EventID), EnumFunctions.Manage_Income))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Edit Income!"));

            if (IncomeID == -1)
                throw new FaultException<SException>(new SException(),
                    new FaultReason("Cannot edit partipants payment data!"));

            try
            {
                DAL dalDataContext = new DAL();

                BudgetIncome matchedincome = (from income in dalDataContext.income
                                              where income.IncomeID == IncomeID &&
                                              income.EventID == EventID
                                              select income).FirstOrDefault();

                if (matchedincome == null)
                {
                    throw new FaultException<SException>(new SException(),
                       new FaultReason("Invalid Income Item"));
                }
                else
                {
                    matchedincome.Name = bIncome.Name;
                    matchedincome.Description = bIncome.Description;
                    matchedincome.IsGstLiable = bIncome.IsGstLiable;
                    matchedincome.IncomeBeforeGST = bIncome.IncomeBeforeGST;
                    matchedincome.GstValue = bIncome.GstValue;
                    matchedincome.Source = bIncome.Source;
                    matchedincome.DateReceived = bIncome.DateReceived;
                    dalDataContext.SubmitChanges();

                }
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Editing Income, Please Try Again!"));
            }
        }
コード例 #3
0
        public static int AddBudgetIncome(User user, int EventID, BudgetIncome bIncome)
        {
            if (!user.isAuthorized(EventController.GetEvent(EventID), EnumFunctions.Manage_Income))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To Add Income!"));
            try
            {
                DAL dalDataContext = new DAL();
                Table<BudgetIncome> income = dalDataContext.income;

                income.InsertOnSubmit(bIncome);
                income.Context.SubmitChanges();

                return bIncome.IncomeID;
            }
            catch
            {
                throw new FaultException<SException>(new SException(),
                   new FaultReason("An Error occured While Adding New Income, Please Try Again!"));
            }
        }
コード例 #4
0
        public static List<BudgetIncome> ViewBudgetIncome(User user, int eventID)
        {
            if (!user.isAuthorized(EventController.GetEvent(eventID), EnumFunctions.Manage_Income))
                throw new FaultException<SException>(new SException(),
                   new FaultReason("Invalid User, User Does Not Have Rights To View income!"));
            try
            {
                DAL dalDataContext = new DAL();

                List<BudgetIncome> BudgetIncomes = (from income in dalDataContext.income
                                                    where income.EventID == eventID
                                                    select income).ToList<BudgetIncome>();

                //Todo, add a new budgetIncome item to the list for participant payments
                decimal participantsIncome = ParticipantController.GetEventParticipantIncome(eventID);

                if (participantsIncome > 0)
                {
                    BudgetIncome partiIncome = new BudgetIncome(eventID, "Participants Registration Fees",
                                                                "Income that came from participants Income",
                                                                false, participantsIncome, 0, "Participants Registration",
                                                                DateTime.Now, -1);

                    BudgetIncomes.Add(partiIncome);
                }

                return BudgetIncomes;
            }
            catch (Exception ex)
            {
                throw new FaultException<SException>(new SException(ex.Message),
                   new FaultReason("An Error occured Retrieving Income data, Please Try Again!"));
            }
        }
コード例 #5
0
        //TODO: Save Changes and Test Method!
        public override bool saveChanges()
        {
            if (txtName.Text.Trim().Length == 0)
            {
                MessageBox.Show("Please enter the income's name.", "Invalid Input",
                    MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return false;
            }
            else if (txtSource.Text.Trim().Length == 0)
            {
                MessageBox.Show("Please enter the source of the income.", "Invalid Input",
                  MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return false;
            }
            else if (txtIncb4Gst.Text.Trim().Length == 0)
            {
                MessageBox.Show("Income must be numeric!", "Invalid Input",
                    MessageBoxButton.OK, MessageBoxImage.Exclamation);
                txtIncb4Gst.Focus();
                return false;
            }
            else if (dtpReceivedDate.SelectedDate==null)
            {
                MessageBox.Show("Please Select your received date!", "Invalid Date",
                    MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return false;
            }
            try
            {
                BudgetHelper client = new BudgetHelper();
                if (selectedIndex == -1)
                {
                    BudgetIncome bIncome = new BudgetIncome();
                    bIncome.Name = txtName.Text;
                    bIncome.Description = txtDescription.Text;
                    bIncome.DateReceived = dtpReceivedDate.SelectedDate.Value;
                    bIncome.EventID = event_.EventID;
                    bIncome.GstValue = decimal.Parse(txtGst.Text.Trim());
                    bIncome.IncomeBeforeGST = decimal.Parse(txtIncb4Gst.Text.Trim());
                    bIncome.IsGstLiable = chkGSTLiable.IsChecked.Value;
                    bIncome.Source = txtSource.Text;
                    bIncome.IncomeID = client.AddIncome(user, event_.EventID, bIncome);
                    incomeList.Add(bIncome);
                    CollectionViewSource.GetDefaultView(lstIncomeList.ItemsSource).Refresh();
                    clearAll();
                }
                else
                {
                    BudgetIncome bIncome = incomeList[selectedIndex];
                    bIncome.Name = txtName.Text;
                    bIncome.Description = txtDescription.Text;
                    bIncome.DateReceived = dtpReceivedDate.SelectedDate.Value;
                    bIncome.EventID = event_.EventID;
                    bIncome.GstValue = decimal.Parse(txtGst.Text.Trim());
                    bIncome.IncomeBeforeGST = decimal.Parse(txtIncb4Gst.Text.Trim());
                    bIncome.IsGstLiable = chkGSTLiable.IsChecked.Value;
                    bIncome.Source = txtSource.Text;
                    client.EditBudgetIncome(user, event_.EventID, bIncome.IncomeID, bIncome);
                    incomeList[selectedIndex] = bIncome;
                    CollectionViewSource.GetDefaultView(lstIncomeList.ItemsSource).Refresh();
                    changed = false;
                }
                client.Close();

                MessageBox.Show("Operation succeeded!");
                loadIncome();
                return true;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
        }
コード例 #6
0
ファイル: EvmsService.svc.cs プロジェクト: allanckw/GEMS-Web
 public int AddIncome(User user, int eventID, BudgetIncome bIncome)
 {
     return BudgetIncomeController.AddBudgetIncome(user, eventID, bIncome);
 }
コード例 #7
0
ファイル: EvmsService.svc.cs プロジェクト: allanckw/GEMS-Web
 public void EditBudgetIncome(User user, int eventID, int incomeID, BudgetIncome bIncome)
 {
     BudgetIncomeController.EditBudgetIncome(user, eventID, incomeID, bIncome);
 }