示例#1
0
        public ActionResult Create(InvoiceCreateForm InvoiceCreateForm)
        {
            Invoice        invoice = invoiceProvider.CreateInvoice(InvoiceCreateForm);
            InvoiceApiPoco retour  = new InvoiceApiPoco(invoice);

            return(Json(retour));
        }
        public ActionResult Invoice(int idInvoice, int?selectedIDCampaign = null)
        {
            Invoice invoice = GetInvoice(idInvoice, selectedIDCampaign);

            if (invoice == null)
            {
                return(RedirectToAction("Index"));
            }
            if (invoice.IDInvoice < 0)
            {
                return(RedirectToAction("InvoiceEdition", new { idInvoice = invoice.IDInvoice }));
            }
            InvoiceCreateForm form = new InvoiceCreateForm();

            if (idInvoice > 0)
            {
                form.FromPo(invoice);
            }

            if (invoice.InvoiceState == SOLUTIONS.INVOICES.INVOICE.ENUM.InvoiceStateEnum.PREPARE)
            {
                return(RedirectToAction("InvoiceEdition", new { idInvoice = invoice.IDInvoice }));                                                                                 //InvoiceEdition
            }
            string templatenamemvc = "InvoiceTemplate1";

            ViewBag.templatenamemvc = templatenamemvc;

            return(View(form));
        }
        public ActionResult InvoiceCreateEdit(InvoiceCreateForm form, string submit = null)
        {
            Invoice invoice = GetInvoice(form.IDInvoice);

            if (invoice == null)
            {
                return(RedirectToAction("Index"));
            }



            form.ToPo(invoice);
            this.invoiceProvider.SaveFullInvoice(invoice);

            return(RedirectToAction("Invoice", new { IDInvoice = invoice.IDInvoice }));
        }
示例#4
0
        public Invoice UpdateInvoice(InvoiceCreateForm form)
        {
            try
            {
                Invoice invoice = GetInvoice(form.IDInvoice);
                if (invoice != null)
                {
                    invoice.FromObject(form);
                    invoice.IDAccount = idAccount;
                    base.SaveBubble(invoice);
                }


                return(invoice);
            }
            catch (Exception ex)
            {
                throw new Exception("UpdateInvoice " + ex.Message, ex);
            }
        }
        public ActionResult InvoiceEdition(int idInvoice)
        {
            Invoice invoice = GetInvoice(idInvoice);

            if (invoice == null)
            {
                return(RedirectToAction("Index"));
            }
            InvoiceCreateForm form = new InvoiceCreateForm();

            if (idInvoice > 0)
            {
                form.FromPo(invoice);
            }

            string templatenamemvc = "InvoiceTemplate1";

            ViewBag.templatenamemvc = templatenamemvc;
            ViewBag.campaigns       = campaignProvider.getListCampagne(this.MyUser.IDAccount);
            return(View(form));
        }
示例#6
0
        // CreateInvoice (form)
        public Invoice CreateInvoice(InvoiceCreateForm form)
        {
            try
            {
                Invoice nouveau = new Invoice();
                nouveau.FromObject(form);
                nouveau.InvoiceState = InvoiceStateEnum.PREPARE;

                nouveau.IDAccount = idAccount;


                // Insert
                this.InsertInvoice(nouveau);


                return(nouveau);
            }
            catch (Exception ex)
            {
                throw new Exception("create " + ex.Message, ex);
            }
        }