Esempio n. 1
0
 public InvoiceB GetInvoice(int InvoiceID)
 {
     using (var dbContext = new OTERTConnStr()) {
         try {
             dbContext.Configuration.ProxyCreationEnabled = false;
             InvoiceB data = (from us in dbContext.Invoices
                              select new InvoiceB {
                 ID = us.ID,
                 CustomerID = us.CustomerID,
                 Customer = new CustomerDTO {
                     ID = us.Customers.ID,
                     CountryID = us.Customers.CountryID,
                     NameGR = us.Customers.NameGR,
                     NameEN = us.Customers.NameEN,
                     NamedInvoiceGR = us.Customers.NamedInvoiceGR,
                     NamedInvoiceEN = us.Customers.NamedInvoiceEN,
                     ZIPCode = us.Customers.ZIPCode,
                     CityGR = us.Customers.CityGR,
                     CityEN = us.Customers.CityEN,
                     ChargeTelephone = us.Customers.ChargeTelephone,
                     Telephone1 = us.Customers.Telephone1,
                     Telephone2 = us.Customers.Telephone2,
                     FAX1 = us.Customers.FAX1,
                     FAX2 = us.Customers.FAX2,
                     Address1GR = us.Customers.Address1GR,
                     Address1EN = us.Customers.Address1EN,
                     Address2GR = us.Customers.Address2GR,
                     Address2EN = us.Customers.Address2EN,
                     ContactPersonGR = us.Customers.ContactPersonGR,
                     ContactPersonEN = us.Customers.ContactPersonEN,
                     CustomerTypeID = us.Customers.CustomerTypeID,
                     LanguageID = us.Customers.LanguageID,
                     Email = us.Customers.Email,
                     URL = us.Customers.URL,
                     AFM = us.Customers.AFM,
                     DOY = us.Customers.DOY,
                     SAPCode = us.Customers.SAPCode,
                     UserID = us.Customers.UserID,
                     Comments = us.Customers.Comments,
                     IsProvider = us.Customers.IsProvider,
                     IsOTE = us.Customers.IsOTE
                 },
                 DateFrom = us.DateFrom,
                 DateTo = us.DateTo,
                 DateCreated = us.DateCreated,
                 RegNo = us.RegNo,
                 DatePaid = us.DatePaid,
                 TasksLineAmount = us.TasksLineAmount,
                 DiscountLineAmount = us.DiscountLineAmount,
                 IsLocked = us.IsLocked
             }).Where(o => o.ID == InvoiceID).FirstOrDefault();
             return(data);
         }
         catch (Exception) { return(null); }
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            wizardData wData;

            if (!Page.IsPostBack)
            {
                pageTitle = ConfigurationManager.AppSettings["AppTitle"].ToString() + "Τιμολόγια > Επεξεργασία Τιμολογίου";
                int invoiceID = -1;
                if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != string.Empty)
                {
                    int.TryParse(Request.QueryString["ID"], out invoiceID);
                }
                wData = new wizardData();
                if (invoiceID > 0)
                {
                    try {
                        InvoicesController cont          = new InvoicesController();
                        InvoiceB           singleInvoice = cont.GetInvoice(invoiceID);
                        if (singleInvoice != null)
                        {
                            lblCustomer.Text       = singleInvoice.Customer.NameGR;
                            lblDateFrom.Text       = singleInvoice.DateFrom.GetValueOrDefault().ToString("dd/MM/yyyy");
                            lblDateTo.Text         = singleInvoice.DateTo.GetValueOrDefault().ToString("dd/MM/yyyy");
                            lblDateCreated.Text    = singleInvoice.DateCreated.GetValueOrDefault().ToString("dd/MM/yyyy");
                            txtAccountNo.Text      = singleInvoice.RegNo;
                            dpDatePay.SelectedDate = singleInvoice.DatePaid;
                            chkIsLocked.Checked    = singleInvoice.IsLocked;
                            wData.CustomerID       = invoiceID;
                        }
                    }
                    catch (Exception) { }
                }
                Session["wizardStep"] = wData;
            }
            if (Session["LoggedUser"] != null)
            {
                loggedUser = Session["LoggedUser"] as UserB;
            }
            else
            {
                Response.Redirect("/Default.aspx", true);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Will execute generating pdf with Invoice template.
        /// </summary>
        /// <param name="client">SimpeliClient instance.</param>
        private static void SendInvoiceB(SimpeliClient client)
        {
            try
            {
                SavePdfResponse response = null;

                InvoiceB invoice = new InvoiceB();

                FillInvoceData(invoice);

                response = client.SavePdf(invoice, WEB_HOOK, "my_ref_number");

                Console.WriteLine("Result of sending: " + response.message);
            }
            catch (SimpeliException ex)
            {
                HandleSimpeliException(ex);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }