Exemple #1
0
        public List <tHistory> getInvoices(int UserID)
        {
            List <tHistory> transactionHistories = new List <tHistory>();

            dynamic tings = (from th in db.TransactionHistories
                             select th);

            foreach (TransactionHistory t in tings)
            {
                bDetails details = getBillDetail(t.Order_ID);

                if (details.User_ID.Equals(UserID))
                {
                    tHistory thi = new tHistory
                    {
                        Order_ID    = t.Order_ID,
                        Prod_ID     = t.Prod_ID,
                        purchase_ID = t.Purchase_ID,
                        Quantity    = Convert.ToInt32(t.Quantity),
                        Date        = Convert.ToDateTime(t.Date)
                    };

                    transactionHistories.Add(thi);
                }
            }

            return(transactionHistories);
        }
Exemple #2
0
        public int addDetails(bDetails details)
        {
            var newDetails = new billingDetail
            {
                OrderID       = details.Order_ID,
                User_ID       = details.User_ID,
                Name          = details.Name,
                Surname       = details.Surname,
                Email         = details.Email,
                Province      = details.Province,
                House_Adress  = details.House_Adress,
                Street_Adress = details.Street_Adress,
                City          = details.City,
                ZIP           = details.ZIP,
                Phone         = details.Phone
            };

            db.billingDetails.InsertOnSubmit(newDetails);

            try
            {
                db.SubmitChanges();
                return(1);
            }
            catch (Exception e)
            {
                e.GetBaseException();
                return(0);
            }
        }
Exemple #3
0
        public bDetails getBillDetail(int order)
        {
            billingDetail detail = (from det in db.billingDetails
                                    where det.OrderID.Equals(order)
                                    select det).FirstOrDefault();

            bDetails details = new bDetails
            {
                User_ID       = detail.User_ID,
                Order_ID      = detail.OrderID,
                City          = detail.City,
                Email         = detail.Email,
                House_Adress  = detail.House_Adress,
                Name          = detail.Name,
                Phone         = detail.Phone,
                Province      = detail.Province,
                Street_Adress = detail.Street_Adress,
                Surname       = detail.Surname,
                ZIP           = detail.ZIP
            };

            return(details);
        }