Ejemplo n.º 1
0
        public string updateInvoiceStatement(InvoiceStatement invoiceStatement)
        {
            string result;

            result = AllStored("U", invoiceStatement);
            return(result);
        }
Ejemplo n.º 2
0
        public string insertInvoiceStatement(InvoiceStatement invoiceStatement)
        {
            string result;

            result = AllStored("I", invoiceStatement);

            return(result);
        }
Ejemplo n.º 3
0
        public ActionResult updateInvBusinessUnit([FromBody] InvoiceStatement upInvStat)
        {
            var result = invoiceStatement.updateInvoiceStatement(upInvStat);

            if (result == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(result));
            }
        }
Ejemplo n.º 4
0
        public ActionResult insertInvBusinessUnit([FromBody] InvoiceStatement invoiceStat)
        {
            var result = invoiceStatement.insertInvoiceStatement(invoiceStat);

            if (result == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(result));
            }
        }
Ejemplo n.º 5
0
        public void Should_Run_Statement()
        {
            var invoiceStorage   = new InvoiceStorage();
            var invoice          = invoiceStorage.GetAll().FirstOrDefault();
            var invoiceStatement = new InvoiceStatement(invoice).Calculate();

            var summaryReportEn = invoiceStatement
                                  .Report(template => Reports.EnglishUs(template).Summary());

            var summaryReportPt = invoiceStatement
                                  .Report(template => Reports.CustomCulture(template, "pt-BR").Summary());

            Assert.Equal(expectedOutput, summaryReportEn);
            Assert.Equal(expectedOutputPt, summaryReportPt);
        }
Ejemplo n.º 6
0
        public String AllStored(String action, InvoiceStatement invoiceStatement)
        {
            string result;

            if (invoiceStatement == null)
            {
                OracleDataAdapter obj_ORCL = new OracleDataAdapter("Crol_dml_inv_st", this.GetConnection().ConnectionString);
                obj_ORCL.SelectCommand.CommandType = CommandType.StoredProcedure;
                obj_ORCL.SelectCommand.BindByName  = true;
                obj_ORCL.SelectCommand.Parameters.Add("p_custid", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_invoiceno", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_invoicedate", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_crfno", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_orderno", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_invamount", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_gstamount", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_totalamount", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_recamount", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_busunit", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_costid", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_remarks", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_usercd", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_updusercd", "");
                obj_ORCL.SelectCommand.Parameters.Add("p_action", action);
                obj_ORCL.SelectCommand.Parameters.Add("p_dataset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
                DataTable bu_dt = new DataTable();
                try
                {
                    obj_ORCL.Fill(bu_dt);
                    result = Newtonsoft.Json.JsonConvert.SerializeObject(bu_dt);
                }
                catch (Exception ex)
                {
                    result = Newtonsoft.Json.JsonConvert.SerializeObject(ex.Message);
                }
                finally
                {
                    bu_dt.Dispose();
                    obj_ORCL.Dispose();
                }
            }
            else
            {
                OracleDataAdapter obj_ORCL = new OracleDataAdapter("Crol_dml_inv_st", this.GetConnection().ConnectionString);
                obj_ORCL.SelectCommand.CommandType = CommandType.StoredProcedure;
                obj_ORCL.SelectCommand.BindByName  = true;
                obj_ORCL.SelectCommand.Parameters.Add("p_custid", invoiceStatement.custID);
                obj_ORCL.SelectCommand.Parameters.Add("p_invoiceno", invoiceStatement.invoiceNo);
                obj_ORCL.SelectCommand.Parameters.Add("p_invoicedate", invoiceStatement.invoiceDate);
                obj_ORCL.SelectCommand.Parameters.Add("p_crfno", invoiceStatement.crfNo);
                obj_ORCL.SelectCommand.Parameters.Add("p_orderno", invoiceStatement.orderNo);
                obj_ORCL.SelectCommand.Parameters.Add("p_invamount", invoiceStatement.invoiceAmount);
                obj_ORCL.SelectCommand.Parameters.Add("p_gstamount", invoiceStatement.gstAmount);
                obj_ORCL.SelectCommand.Parameters.Add("p_totalamount", invoiceStatement.totalAmount);
                obj_ORCL.SelectCommand.Parameters.Add("p_recamount", invoiceStatement.recAmount);
                obj_ORCL.SelectCommand.Parameters.Add("p_busunit", invoiceStatement.busUnit);
                obj_ORCL.SelectCommand.Parameters.Add("p_costid", invoiceStatement.costID);
                obj_ORCL.SelectCommand.Parameters.Add("p_remarks", invoiceStatement.remarks);
                obj_ORCL.SelectCommand.Parameters.Add("p_usercd", invoiceStatement.userCD);
                obj_ORCL.SelectCommand.Parameters.Add("p_updusercd", invoiceStatement.upUserCD);
                obj_ORCL.SelectCommand.Parameters.Add("p_action", action);
                obj_ORCL.SelectCommand.Parameters.Add("p_dataset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
                DataTable bu_dt = new DataTable();
                try
                {
                    obj_ORCL.Fill(bu_dt);
                    result = Newtonsoft.Json.JsonConvert.SerializeObject(bu_dt);
                }
                catch (Exception ex)
                {
                    result = Newtonsoft.Json.JsonConvert.SerializeObject(ex.Message);
                }
                finally
                {
                    bu_dt.Dispose();
                    obj_ORCL.Dispose();
                }
            }
            return(result);
        }
Ejemplo n.º 7
0
 public static Reports CustomCulture(InvoiceStatement invoiceStatement, string cultureInfo) => new Reports(invoiceStatement, new CultureInfo(cultureInfo));
Ejemplo n.º 8
0
 public static Reports EnglishUs(InvoiceStatement invoiceStatement) => new Reports(invoiceStatement, new CultureInfo("en-US"));
Ejemplo n.º 9
0
 private Reports(InvoiceStatement invoiceStatement, CultureInfo cultureInfo)
 {
     _invoiceStatement = invoiceStatement;
     _cultureInfo      = cultureInfo;
     _builder          = new StringBuilder();
 }