public void Initialize(InvoiceObject invoiceObject) { if (invoiceObject == null) { return; } InvoiceObject = invoiceObject; BringToFront(); }
public ActionResult DownloadInvoice(string co, string c) { InvoiceObject model = BillingManager.Instance.GetInvoice(co, c); ClientObject client = ClientManager.Instance.GetClient(c); ViewBag.ClientCode = client != null ? client.Code : ""; ViewBag.Client = client != null ? client.Name : ""; ViewBag.CutOff = co; return(View(model)); }
private void gridView1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { var rowObject = CommonViewsActions.GetSelectedRowObject(layoutView1); if (rowObject is ReadyInvoicesForAction) { InvoiceObject = MerkDBBusinessLogicEngine.GetInvoiceFullTree(Convert.ToInt32((rowObject as ReadyInvoicesForAction).InvoiceID)); btnPayments.Enabled = true; } }
public long UpdateInvoiceRefCode(InvoiceObject invoice) { try { return(_invoiceManager.UpdateInvoiceRefCode(invoice)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public ResponseObject UpdateInvoiceWithouthAttach(InvoiceObject invoice) { try { return(_invoiceManager.UpdateInvoiceWithouthAttach(invoice)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(new ResponseObject()); } }
public ResponseObject AddExpenditionaryInvoice(InvoiceObject invoice, long notificationId) { try { return(_invoiceManager.AddExpenditionaryInvoice(invoice, notificationId)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(new ResponseObject()); } }
public long UpdateInvoice(InvoiceObject invoice, List <InvoiceItemObject> newInvoiceItems) { try { return(_invoiceManager.UpdateInvoice(invoice, newInvoiceItems)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public ResponseObject AddInvoice(InvoiceObject invoice) { try { return(_invoiceManager.AddInvoice(invoice)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(new ResponseObject()); } }
public InvoiceObject getCustomer(string customer) { WebRequest req = HttpWebRequest.Create("https://webshockinnovations.com/invoiceapi/api.php?name=" + customer); WebResponse res = req.GetResponse(); StreamReader reader = new StreamReader(res.GetResponseStream()); string json = reader.ReadToEnd(); List <InvoiceObject> invoices = Newtonsoft.Json.JsonConvert.DeserializeObject <List <InvoiceObject> >(json); InvoiceObject invoice = invoices[0]; return(invoice); }
public InvoiceObject GetInvoice(string cutoff, string client) { InvoiceObject result = null; List <BillingObject> billing = GetBilling(cutoff, client); if (billing != null) { result = new InvoiceObject(); result.Total = billing.Sum(x => x.TotalAmount); result.VatableSale = billing.Sum(x => x.TotalWithFee); result.VatAmount = billing.Sum(x => x.VAT); } return(result); }
// POST: api/Unit public ServerResponse Post([FromBody] InvoiceObject InvoiceObj) { var res = new ServerResponse(); using (InvoiceBL InvoiceBL = new InvoiceBL()) { try { res.Data = InvoiceBL.SaveInvoice(InvoiceObj); } catch (Exception ex) { res.Success = false; } } return(res); }
private void gridControl1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { var rowObject = CommonViewsActions.GetSelectedRowObject(gridView1); if (rowObject is GetInvoiceForAddmission_Result) { InvoiceObject invoiceObject = MerkDBBusinessLogicEngine.GetInvoiceFullTree(((GetInvoiceForAddmission_Result)rowObject).InvoiceID); if (invoiceObject == null) { return; } MainPatientInvoiceActions patienActions = new MainPatientInvoiceActions(); patienActions.Initialize(invoiceObject); PopupBaseForm.ShowAsPopup(patienActions, this); } }
public InvoiceObject SaveInvoice(InvoiceObject InvoiceObj) { if (InvoiceObj.FormMode == FormMode.Insert) { //insert thằng master lấy id var masterID = InsertEntity <Invoice>(InvoiceObj.Invoice); InvoiceObj.Invoice.InvoiceID = masterID; //gán id cho thằng detail, thực hiện insert for (int i = 0; i < InvoiceObj.InvoiceDetails.Count; i++) { InvoiceObj.InvoiceDetails[i].InvoiceID = masterID; InsertEntity <InvoiceDetail>(InvoiceObj.InvoiceDetails[i]); var store = new Store(); store.ShopID = InvoiceObj.Invoice.ShopID; store.ChangeDate = InvoiceObj.Invoice.InvoiceDate; store.SKUCode = InvoiceObj.InvoiceDetails[i].SKUCode; store.ItemName = InvoiceObj.InvoiceDetails[i].ItemName; store.Unit = InvoiceObj.InvoiceDetails[i].Unit; store.UnitPrice = InvoiceObj.InvoiceDetails[i].UnitPrice; store.ItemGroupName = InvoiceObj.InvoiceDetails[i].ItemGroupName; store.OutAmount = InvoiceObj.InvoiceDetails[i].Amount; store.InAmount = 0; store.UnitPrice = InvoiceObj.InvoiceDetails[i].UnitPrice; storeBL.SaveStore(store); } } else if (InvoiceObj.FormMode == FormMode.Update) { //update thằng master lấy id InvoiceObj.Invoice = UpdateEntity <Invoice>(InvoiceObj.Invoice); //update cho từng thằng detail for (int i = 0; i < InvoiceObj.InvoiceDetails.Count; i++) { InvoiceObj.InvoiceDetails[i] = UpdateEntity <InvoiceDetail>(InvoiceObj.InvoiceDetails[i]); } } return(InvoiceObj); }
private void Page_Load(object sender, EventArgs e) { this.theInvoiceSearch = new InvoiceObject(this.get_connectionString()); if (this.GetParameter("ExecuteMethod") != null) { this.ExecuteMethod(this.GetParameter("ExecuteMethod")); } this.theInvoiceSearch.SearchBy = this.GetParameter("SearchBy"); this.theInvoiceSearch.SearchString = this.GetParameter("SearchString"); this.theInvoiceSearch.SortBy = this.GetParameter("SortBy", this.GetParameter("SearchString")); if (this.theInvoiceSearch.SearchBy != null) { this.SearchBy.SelectedValue = this.Server.HtmlEncode(this.theInvoiceSearch.SearchBy); } this.SearchString.Text = this.theInvoiceSearch.SearchString; this.xmlInvoiceSearch.TransformArgumentList = this.get_XsltArgumentSearch(); if (this.IsPostBack || this.theInvoiceSearch.SearchString != null) { this.xmlInvoiceSearch.DocumentContent = this.theInvoiceSearch.Search().GetXml(); } this.xmlInvoiceSearch.TransformSource = "InvoiceList.xslt"; }
private string FillRequestInvoices(InvoiceObject currentResponse, string lang, bool onlyShow) { var info = new LoginInfo(); info.SessionId = currentResponse.SessionID; if (string.IsNullOrEmpty(currentResponse.SessionID)) { return string.Empty; } if (!onlyShow) { if (string.IsNullOrEmpty(currentResponse.CaSySTransactionID)) { return string.Empty; } } try { var objectForSend = new ChargeInvoicesRequestData { DealerId = ConfigurationManager.AppSettings["DealerID"], SessionId = currentResponse.SessionID, CustomerData = new WebServices.eRecharge.Customer { Email = currentResponse.ConfirmationEmail, MSISDN = currentResponse.ConfirmationTelephone }, PaymentData = new Payment { AuthCode = currentResponse.CaSySTransactionID, BankID = Convert.ToInt32( ConfigurationManager.AppSettings["BankID"]), CardID = Convert.ToInt32( currentResponse.TmisIssuedByAcquirer) }, InvoiceData = new PaidInvoice[currentResponse.InvoiceDetais.Count] }; for (var i = 0; i < currentResponse.InvoiceDetais.Count; i++) { objectForSend.InvoiceData[i] = new PaidInvoice { Paid_Amount = currentResponse.InvoiceDetais[i].Amount, Invoice_Ref_Num = currentResponse.InvoiceDetais[i].InvoiceNumber }; } switch (lang.ToLower()) { case "mk": objectForSend.Language = WebServices.eRecharge.type_Language.MK; break; case "al": objectForSend.Language = WebServices.eRecharge.type_Language.AL; break; case "en": objectForSend.Language = WebServices.eRecharge.type_Language.EN; break; } if (!onlyShow) { var dorecharge = Invoices.DoChargeInvoices(objectForSend); if (dorecharge != null && dorecharge.ResponseType != null) { if (dorecharge.ResponseType.Status == 1) { return "1"; } } } else { AzurirajLabeli(objectForSend); } return string.Empty; } catch (Exception ex) { Log(ex); //Auditing.LogAction(AuditAction.InvoiceGeneralError, false, "0", info, DateTime.Now); } return string.Empty; }
private bool ProcessDialogRequest(SkillRequest input, SkillResponse response) { var intentRequest = input.Request; string speech_message = string.Empty; bool processed = false; switch (intentRequest.Intent.Name) { case "GetClientInvoice": speech_message = GetClientInfo(intentRequest); WebRequest req = HttpWebRequest.Create("https://webshockinnovations.com/invoiceapi/api.php?name=" + speech_message); WebResponse res = req.GetResponse(); StreamReader reader = new StreamReader(res.GetResponseStream()); string json = reader.ReadToEnd(); List <InvoiceObject> invoices = Newtonsoft.Json.JsonConvert.DeserializeObject <List <InvoiceObject> >(json); InvoiceObject invoice = invoices[0]; speech_message = "There are " + invoices.Count.ToString() + " invoices " + invoice.customer_name + " at company " + invoice.customer_company_name; if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "Help": speech_message = "With this skill you can add customers, companies, and create invoices. Say customer help, company help, and invoice help to learn how to do each."; if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "CustomerHelp": speech_message = "Say get customers to see all customers. To add a new customer, say New customer {customer_name} with email {customer_email} and company {customer_company_name} with phone {customer_phone_number} and address {customer_street_address}"; if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "CompanyHelp": speech_message = "Say get companies to see all companies. To add a new company, say new company {company_name} with email {email} and phone {phone_number} with address {street_address}"; if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "InvoiceHelp": speech_message = "Say get invoice of {customer} to get invoices for a customer. To create an invoice say Create invoice for {customer} with subject {subject} and description {description}. To add a product to an invoice say add {quantity} of {product} at {price} to {subject}"; if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "GetCustomers": WebRequest customerreq = HttpWebRequest.Create("https://webshockinnovations.com/invoiceapi/api.php?getcustomers=true"); WebResponse customerres = customerreq.GetResponse(); StreamReader customerreader = new StreamReader(customerres.GetResponseStream()); string customerjson = customerreader.ReadToEnd(); List <InvoiceObject> customers = Newtonsoft.Json.JsonConvert.DeserializeObject <List <InvoiceObject> >(customerjson); speech_message = "There are " + customers.Count.ToString() + " customers. "; foreach (InvoiceObject customern in customers) { speech_message += customern.customer_name + ", "; } if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "GetCompanies": WebRequest companyreq = HttpWebRequest.Create("https://webshockinnovations.com/invoiceapi/api.php?getcompanies=true"); WebResponse companyres = companyreq.GetResponse(); StreamReader companyreader = new StreamReader(companyres.GetResponseStream()); string companyjson = companyreader.ReadToEnd(); List <CompanyObject> companies = Newtonsoft.Json.JsonConvert.DeserializeObject <List <CompanyObject> >(companyjson); speech_message = "There are " + companies.Count.ToString() + " companies. "; foreach (CompanyObject companyn in companies) { speech_message += companyn.company_name + ", "; } if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "AddClient": speech_message = AddClient(intentRequest); string customer = speech_message; string company_id = "8"; InvoiceObject customerdata = getCustomer(customer); string urlAddress = "https://webshockinnovations.com/invoiceapi/api.php"; Slot departslot; string subject = ""; string description = ""; if (intentRequest.Intent.Slots.TryGetValue("subject", out departslot)) { subject = departslot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("description", out departslot)) { description = departslot.Value.ToString(); } using (WebClient client = new WebClient()) { NameValueCollection postData = new NameValueCollection() { { "subject", subject }, { "description", description }, { "customer_id", customerdata.id }, { "company_id", company_id }, }; speech_message = "Creating invoice for " + speech_message + " with subject " + subject; // client.UploadValues returns page's source as byte array (byte[]) // so it must be transformed into a string string pagesource = Encoding.UTF8.GetString(client.UploadValues(urlAddress, postData)); } if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "AddCustomer": speech_message = "what"; string addcustomerurl = "https://webshockinnovations.com/invoiceapi/api.php"; Slot addcustomerslot; string customer_company_name = ""; string customer_email = ""; string customer_name = ""; string customer_phone_number = ""; string customer_street_address = ""; if (intentRequest.Intent.Slots.TryGetValue("customer_company_name", out addcustomerslot)) { customer_company_name = addcustomerslot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("customer_email", out addcustomerslot)) { customer_email = addcustomerslot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("customer_name", out addcustomerslot)) { customer_name = addcustomerslot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("customer_phone_number", out addcustomerslot)) { customer_phone_number = addcustomerslot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("customer_street_address", out addcustomerslot)) { customer_street_address = addcustomerslot.Value.ToString(); } using (WebClient client = new WebClient()) { NameValueCollection postData = new NameValueCollection() { { "add_customer", "true" }, { "customer_company_name", customer_company_name }, { "customer_email", customer_email }, { "customer_name", customer_name }, { "customer_phone_number", customer_phone_number }, { "customer_street_address", customer_street_address }, }; speech_message = "Adding customer " + customer_name; // client.UploadValues returns page's source as byte array (byte[]) // so it must be transformed into a string string pagesource = Encoding.UTF8.GetString(client.UploadValues(addcustomerurl, postData)); } if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "AddCompany": string addcompanyurl = "https://webshockinnovations.com/invoiceapi/api.php"; Slot addcompanyslot; string company_name = ""; string email = ""; string phone_number = ""; string street_address = ""; if (intentRequest.Intent.Slots.TryGetValue("company_name", out addcompanyslot)) { company_name = addcompanyslot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("email", out addcompanyslot)) { email = addcompanyslot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("phone_number", out addcompanyslot)) { phone_number = addcompanyslot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("street_address", out addcompanyslot)) { street_address = addcompanyslot.Value.ToString(); } using (WebClient client = new WebClient()) { NameValueCollection postData = new NameValueCollection() { { "add_company", "true" }, { "company_name", company_name }, { "email", email }, { "phone_number", phone_number }, { "street_address", street_address }, }; speech_message = "Adding company " + company_name; // client.UploadValues returns page's source as byte array (byte[]) // so it must be transformed into a string string pagesource = Encoding.UTF8.GetString(client.UploadValues(addcompanyurl, postData)); } if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; case "AddProduct": speech_message = AddProduct(intentRequest); string invoice_subject = speech_message; QuoteObject quote = getInvoice(invoice_subject); string url = "https://webshockinnovations.com/invoiceapi/api.php"; Slot slot; string product = ""; string quantity = ""; string price = ""; if (intentRequest.Intent.Slots.TryGetValue("product", out slot)) { product = slot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("quantity", out slot)) { quantity = slot.Value.ToString(); } if (intentRequest.Intent.Slots.TryGetValue("price", out slot)) { price = slot.Value.ToString(); } using (WebClient client = new WebClient()) { NameValueCollection postData = new NameValueCollection() { { "add_invoice", "true" }, { "product", product }, { "quantity", quantity }, { "price", price }, { "quote_id", quote.id }, }; speech_message = "Adding " + product + " to invoice " + invoice_subject;; // client.UploadValues returns page's source as byte array (byte[]) // so it must be transformed into a string string pagesource = Encoding.UTF8.GetString(client.UploadValues(url, postData)); } if (!string.IsNullOrEmpty(speech_message)) { response.Response.OutputSpeech = new SsmlOutputSpeech(); (response.Response.OutputSpeech as SsmlOutputSpeech).Ssml = SsmlDecorate(speech_message); } processed = true; break; } return(processed); }