Example #1
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                    bill = null;
                    lineItems.Clear();
                    payModes.Clear();
                    lineItems = null;
                    payModes  = null;
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
Example #2
0
        public void InsertBillData(VoygerBillWithLinq voygerBill)
        {
            VoyBill             bill         = voygerBill.bill;
            List <LineItems>    lineItemList = voygerBill.lineItems;
            List <VPaymentMode> paymentList  = voygerBill.payModes;

            ConnectLinqDataBase();
            var v = from vyb in voyDatabase.VoyBill
                    where vyb.BillNumber == bill.BillNumber && vyb.BillTime == bill.BillTime
                    select new { vyb.ID };

            if (v.Count() > 0)
            {
                Console.WriteLine("Invoice all ready Present in file");
                return;
            }
            voyDatabase.VoyBill.InsertOnSubmit(bill);
            voyDatabase.SubmitChanges();
            foreach (LineItems item in lineItemList)
            {
                item.VoyBillId = bill.ID;
                voyDatabase.LineItems.InsertOnSubmit(item);
            }
            foreach (VPaymentMode item in paymentList)
            {
                item.VoyBillId = bill.ID;
                voyDatabase.VPaymentMode.InsertOnSubmit(item);
            }
            InsertDataLog dataLog = new InsertDataLog()
            {
                BillNumber = bill.BillNumber,
                Remark     = "First Step",
                VoyBillId  = bill.ID,
            };

            voyDatabase.InsertDataLogs.InsertOnSubmit(dataLog);
            voyDatabase.SubmitChanges();
        }
        public void InsertBillData(VoygerBill voygerBill)
        {
            if (voygerBill != null)
            {
                if (voygerBill.bill.BillType != null)
                {
                    LogEvent.WriteEvent("bill tye: " + voygerBill.bill.BillType);
                }
            }
            VoyBill bill = voygerBill.bill;

            List <LineItem>     lineItemList = voygerBill.lineItems;
            List <VPaymentMode> paymentList  = voygerBill.payModes;

            VoyagerContext voyDatabase;

            using (voyDatabase = new VoyagerContext())
            {
                // TODO:Need to Check line below here
                var v = from vyb in voyDatabase.VoyBills
                        where vyb.BillNumber == bill.BillNumber && vyb.BillTime == bill.BillTime
                        select new { vyb.VoyBillId };

                if (v.Count() > 0)
                {
                    LogEvent.WriteEvent($"Invoice all ready Present in file {v.FirstOrDefault().VoyBillId},{bill.BillNumber}");
                    return;
                }
                else
                {
                    LogEvent.WriteEvent($"Invoice is new with bill no {bill.BillNumber}");
                }

                voyDatabase.VoyBills.Add(bill);
                if (voyDatabase.SaveChanges() > 0)
                {
                    LogEvent.WriteEvent($"Bill with ID: {bill.VoyBillId} is saved!!! ");
                }
                else
                {
                    LogEvent.WriteEvent("bill is not Saved");
                }
                foreach (LineItem item in lineItemList)
                {
                    item.VoyBillId = bill.VoyBillId;
                    voyDatabase.LineItems.Add(item);
                }
                //   LogEvent.WriteEvent("Inserted LinesItem");
                foreach (VPaymentMode item in paymentList)
                {
                    item.VoyBillId = bill.VoyBillId;
                    voyDatabase.VPaymentModes.Add(item);
                }
                //  LogEvent.WriteEvent("Inserted payments");
                InsertDataLog dataLog = new InsertDataLog()
                {
                    BillNumber = bill.BillNumber,
                    Remark     = "First Step",
                    VoyBillId  = bill.VoyBillId,
                };
                LogEvent.WriteEvent("Inserted Datalog,payments,LinesItem,payments");
                voyDatabase.InsertDataLogs.Add(dataLog);

                voyDatabase.SaveChanges();
                LogEvent.WriteEvent("VoyBill is added with BillId: [" + bill.VoyBillId + "]and BillNo: [" + bill.BillNumber + "]");
            }
        }
 partial void DeleteVoyBill(VoyBill instance);
 partial void UpdateVoyBill(VoyBill instance);
 partial void InsertVoyBill(VoyBill instance);
Example #7
0
 public void AddBillDetails(VoyBill voyBill)
 {
     bill = voyBill;
 }
Example #8
0
 public VoygerBill()
 {
     bill      = new VoyBill();
     lineItems = new List <LineItem>();
     payModes  = new List <VPaymentMode>();
 }