示例#1
0
        // Sparar alla utgifter
        protected void SaveExpenses()
        {
            if (Session["EXPENSE"] != null)
            {
                expense = (List<CompositeExpense>)Session["EXPENSE"];
            }
            using (var client = new Service1Client())
            {
                for (int i = 0; i < expense.Count; i++)
                {
                    CompositeExpense ex = new CompositeExpense();

                    ex.REPID = repID;
                    ex.CCID = expense[i].CCID;
                    ex.Sum = expense[i].Sum;
                    ex.VAT = expense[i].VAT;
                    ex.Date = expense[i].Date;
                    ex.Description = expense[i].Description;

                    client.SaveExpense(ex);

                }
            }
        }
示例#2
0
        // ________________________________________________ S**T TRAKTAMENTEN / AVVIKELSER ________________________________________________
        // ------------------------------------------------------------------------------------------------------
        protected void btnAddReceipt_Click(object sender, EventArgs e)
        {
            expense = new List<CompositeExpense>();

            if (Session["EXPENSE"] != null)
            {
                expense = (List<CompositeExpense>)Session["EXPENSE"];
            }

            if (repID != "")
            {
                CompositeExpense expenseObj = new CompositeExpense();
                expenseObj.REPID = repID;
                string value = ddlCategory.SelectedValue.ToString();
                int newVal = 0;

                switch (value)
                {
                    case "Mat":
                        {
                            newVal = 1;
                            break;
                        }
                    case "Transport":
                        {
                            newVal = 2;
                            break;
                    }
                    case "Boende":
                        {
                            newVal = 3;
                            break;
                        }
                    case "Övrigt":
                        {
                            newVal = 4;
                            break;
                        }

                }

                expenseObj.CCID = (byte) newVal;
                expenseObj.Date = Convert.ToDateTime(txtBoxDate.Text);
                expenseObj.Sum = int.Parse(txtBoxAmount.Text);
                expenseObj.Description = txtBoxDescription.Text;

                if (ddlCountry.SelectedValue.ToString().Equals("Sverige"))
                {
                    switch (ddlCategory.SelectedValue.ToString())
                    {
                        case "Mat":
                            {
                                expenseObj.VAT = 12;
                                break;
                            }
                        case "Transport":
                            {
                                expenseObj.VAT = 6;
                                break;
                            }

                        case "Boende":
                            {
                                expenseObj.VAT = 25;
                                break;
                            }
                        case "Övrigt":
                            {
                                expenseObj.VAT = 25;
                                break;
                            }
                        default:
                            {
                                expenseObj.VAT = 0;
                                break;
                            }
                    }
                }
                else
                {
                    expenseObj.VAT = 0;
                }

                expense.Add(expenseObj);

            }

                FillExpenseGrid();
                ClearExpenseFields();
                Session["EXPENSE"] = expense;
        }