示例#1
0
 public string GetAllInvoiceDetails(int InvoiceID, string CustomerName, DateTime InvoiceDate, string InvoiceAmount, string PaymentAmount)
 {
     try
     {
         using (var context = new TestDetailContext())
             using (var command = context.Database.GetDbConnection().CreateCommand())
             {
                 command.CommandText = "proc_GetAllInvoiceDetail";
                 command.CommandType = CommandType.StoredProcedure;
                 command.Parameters.Add(new SqlParameter("@InvoiceID", InvoiceID));
                 command.Parameters.Add(new SqlParameter("@CustomerName", CustomerName));
                 command.Parameters.Add(new SqlParameter("@InvoiceDate", InvoiceDate));
                 command.Parameters.Add(new SqlParameter("@InvoiceAmount", InvoiceAmount));
                 command.Parameters.Add(new SqlParameter("@PaymentAmount", PaymentAmount));
                 //DbDataAdapter da = APIHelperMethods.CreateDataAdapter(command);
                 DbDataAdapter adapter = DbProviderFactories.GetFactory(command.Connection).CreateDataAdapter();
                 adapter.SelectCommand = command;
                 DataSet result = new DataSet();
                 adapter.Fill(result);
                 string JSONString = string.Empty;
                 JSONString = JsonConvert.SerializeObject(result);
                 return(JSONString);
             }
     }
     catch (Exception ex)
     {
         //_logger.LogError(ex.Message);
         return(null);
     }
 }
        public List <Payment> ShowPayment()
        {
            List <Payment> Invoices  = new List <Payment>();
            List <Payment> Invoices1 = new List <Payment>();

            using (var db = new TestDetailContext())
            {
                //GetPaymentNO
                Payment Payment1;
                foreach (var pay in db.PaymentTbl.ToList())
                {
                    Payment1           = new Payment();
                    Payment1.PaymentNo = pay.PaymentNo;
                    Invoices.Add(Payment1);
                }


                {
                    string s      = "0";
                    int    number = Convert.ToInt32(s);
                    number += 1;
                    c       = "P" + number.ToString("D5");
X:
                    bool No = Invoices.Any(x => x.PaymentNo == c);
                    if (No == true)
                    {
                        //   str = str.Substring(1);
                        number += 1;
                        c       = "P" + number.ToString("D5");
                        goto X;
                    }
                }

                Payment Payment2;
                Payment2           = new Payment();
                Payment2.PaymentNo = c;
                Invoices1.Add(Payment2);
                return(Invoices1);
            }
        }
        public List <Customer> ShowcustomerNo()
        {
            List <Customer> Customers  = new List <Customer>();
            List <Customer> Customers1 = new List <Customer>();

            using (var db = new TestDetailContext())
            {
                Customer Customer1;
                foreach (var Cust in db.CustomerTbl.ToList())
                {
                    Customer1            = new Customer();
                    Customer1.CustomerNo = Cust.CustomerNo;
                    Customers.Add(Customer1);
                }


                {
                    string s      = "0";
                    int    number = Convert.ToInt32(s);
                    number += 1;
                    a       = "C" + number.ToString("D5");
X:
                    bool No = Customers.Any(x => x.CustomerNo == a);
                    if (No == true)
                    {
                        number += 1;
                        a       = "C" + number.ToString("D5");
                        goto X;
                    }
                }

                Customer Customer2;
                Customer2            = new Customer();
                Customer2.CustomerNo = a;
                Customers1.Add(Customer2);
                return(Customers1);
            }
        }
        public List <Invoices> ShowInvoice()
        {
            List <Invoices> Invoice = new List <Invoices>();
            List <Invoices> Invo    = new List <Invoices>();

            using (var db = new TestDetailContext())
            {
                Invoices Inv;
                foreach (var inv in db.InvoiceTbl.ToList())
                {
                    Inv           = new Invoices();
                    Inv.InvoiceNo = inv.InvoiceNo;
                    Invoice.Add(Inv);
                }


                {
                    string s      = "0";
                    int    number = Convert.ToInt32(s);
                    number += 1;
                    b       = "I" + number.ToString("D5");
X:
                    bool No = Invoice.Any(x => x.InvoiceNo == b);
                    if (No == true)
                    {
                        number += 1;
                        b       = "I" + number.ToString("D5");
                        goto X;
                    }
                }

                Invoices Invoice2;
                Invoice2           = new Invoices();
                Invoice2.InvoiceNo = b;
                Invo.Add(Invoice2);
                return(Invo);
            }
        }