Beispiel #1
0
        public List <InvoiceHistory> Get_List_Invoice_By_CustomerID_All(string id)
        {
            List <InvoiceHistory> list = new List <InvoiceHistory>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var listvar = dbContext.GET_LIST_INVOICE_BY_CUSTOMERID_ALL(id).ToList();

            foreach (var obj in listvar)
            {
                InvoiceHistory entity = new InvoiceHistory
                {
                    InvoiceID       = "" + obj.InvoiceID,
                    OrderDate       = "" + obj.OrderDate,
                    DeliveryDate    = "" + obj.DeliveryDate,
                    Sale            = (decimal)obj.Sale,
                    ServiceChange   = (decimal)obj.ServiceChange,
                    ShippingFee     = (decimal)obj.ShippingFee,
                    TotalPrice      = (decimal)obj.TotalPrice,
                    StoreID         = "" + obj.StoreID,
                    StoreName       = obj.StoreName,
                    StoreAddress    = obj.Address,
                    CustomerID      = "" + obj.CustomerID,
                    AddressDelivery = obj.AddressDelivery,
                    CustomerName    = obj.CustomerName,
                    CustomerPhone   = obj.CustomerPhone,
                    Status          = (int)obj.Status
                };
                list.Add(entity);
            }
            return(list);
        }
Beispiel #2
0
        public List <StoreEntity> Find_List_Store(string storeName, string address, string storeType)
        {
            List <StoreEntity> list = new List <StoreEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var listvar = dbContext.FIND_STORE(storeName, address, storeType).ToList();

            foreach (var obj in listvar)
            {
                StoreEntity entity = new StoreEntity
                {
                    StoreID       = "" + obj.StoreID,
                    StoreName     = obj.StoreName,
                    Address       = obj.Address,
                    OpenDoor      = "" + obj.OpenDoor,
                    CloserDoor    = "" + obj.CloserDoor,
                    ServiceCharge = (decimal)obj.ServiceCharge,
                    ShippingFee   = (decimal)obj.ShippingFee,
                    Manner        = obj.Manner,
                    Website       = obj.Website,
                    StoreType     = obj.StoreType,
                    StoreBanner   = obj.StoreBanner,
                    Rating        = (double)obj.Rating,
                    Evaluation    = (int)obj.Evaluation,
                    ConditionShip = (long)obj.ConditionShip,
                    StartDate     = (int)obj.StartDate,
                    EndDate       = (int)obj.EndDate,
                };
                list.Add(entity);
            }
            return(list);
        }
Beispiel #3
0
        public InvoiceEntity Get_Object_Invoice_By_InvoiceID(string id)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var obj = dbContext.GET_OBJECT_INVOICE_BY_INVOICEID(id).FirstOrDefault();

            InvoiceEntity entity = new InvoiceEntity
            {
                InvoiceID       = "" + obj.InvoiceID,
                OrderDate       = "" + obj.OrderDate,
                DeliveryDate    = "" + obj.DeliveryDate,
                Sale            = (decimal)obj.Sale,
                ServiceChange   = (decimal)obj.ServiceChange,
                ShippingFee     = (decimal)obj.ShippingFee,
                TotalPrice      = (decimal)obj.TotalPrice,
                StoreID         = "" + obj.StoreID,
                CustomerID      = "" + obj.CustomerID,
                AddressDelivery = obj.AddressDelivery,
                CustomerName    = obj.CustomerName,
                CustomerPhone   = obj.CustomerPhone,
                Status          = (int)obj.Status
            };

            return(entity);
        }
Beispiel #4
0
        public List <StoreEntity> Get_List_Store()
        {
            List <StoreEntity> list = new List <StoreEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var listvar = dbContext.GET_LIST_STORE().ToList();

            foreach (var obj in listvar)
            {
                StoreEntity entity = new StoreEntity
                {
                    StoreID       = "" + obj.StoreID,
                    StoreName     = obj.StoreName,
                    Address       = obj.Address,
                    OpenDoor      = "" + obj.OpenDoor,
                    CloserDoor    = "" + obj.CloserDoor,
                    ServiceCharge = (decimal)obj.ServiceCharge,
                    ShippingFee   = (decimal)obj.ShippingFee,
                    Manner        = obj.Manner,
                    Website       = obj.Website,
                    StoreType     = obj.StoreType,
                    StoreBanner   = "http://localhost:63116/Data/Originals/t.PNG",
                    Rating        = (double)obj.Rating,
                    Evaluation    = (int)obj.Evaluation,
                    ConditionShip = (long)obj.ConditionShip,
                    StartDate     = (int)obj.StartDate,
                    EndDate       = (int)obj.EndDate,
                };
                list.Add(entity);
            }
            return(list);
        }
Beispiel #5
0
        public StoreEntity Get_Object_Store_By_StoreID(string id)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var obj = dbContext.GET_OBJECT_STORE_BY_STOREID(id).FirstOrDefault();

            StoreEntity entity = new StoreEntity
            {
                StoreID       = "" + obj.StoreID,
                StoreName     = obj.StoreName,
                Address       = obj.Address,
                OpenDoor      = "" + obj.OpenDoor,
                CloserDoor    = "" + obj.CloserDoor,
                ServiceCharge = (decimal)obj.ServiceCharge,
                ShippingFee   = (decimal)obj.ShippingFee,
                Manner        = obj.Manner,
                Website       = obj.Website,
                StoreType     = obj.StoreType,
                StoreBanner   = obj.StoreBanner,
                Rating        = (double)obj.Rating,
                Evaluation    = (int)obj.Evaluation,
                ConditionShip = (long)obj.ConditionShip,
                StartDate     = (int)obj.StartDate,
                EndDate       = (int)obj.EndDate,
            };


            return(entity);
        }
        public List<FoodEntity> Get_List_Food_By_StoreID(string id)
        {
            List<FoodEntity> list = new List<FoodEntity>();
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();

            }
            var listvar = dbContext.GET_LIST_FOOD_BY_STOREID(id).ToList();
            foreach (var obj in listvar)
            {
                FoodEntity entity = new FoodEntity
                {
                    FoodID = "" + obj.FoodID,
                    FoodName = obj.FoodName,
                    FoodImage = obj.FoodImage,
                    Price = (decimal)obj.Price,
                    CategoryID = "" + obj.CategoryID,
                    StoreID=""+obj.StoreID
                  
                };
                list.Add(entity);
            }
            return list;
        }
Beispiel #7
0
        public List <StoreSaleEntity> Get_List_StoreSale_Open()
        {
            List <StoreSaleEntity> list = new List <StoreSaleEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var listvar = dbContext.GET_SALE_OPEN().ToList();

            foreach (var obj in listvar)
            {
                StoreSaleEntity entity = new StoreSaleEntity
                {
                    StoreSaleID = obj.StoreSaleID,
                    Sale        = (int)obj.Sale,
                    StratSale   = "" + obj.StartSale,
                    StoreID     = "" + obj.StoreID,
                    StopSale    = "" + obj.StopSale
                };
                list.Add(entity);
            }

            return(list);
        }
        public List <InvoiceDetailEntity> Get_List_InvoiceDetail_By_InvoiceID(string id)
        {
            List <InvoiceDetailEntity> list = new List <InvoiceDetailEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }

            var listvar = dbContext.GET_LIST_INVOICEDETAIL_BY_INVOICEID(id).ToList();

            foreach (var obj in listvar)
            {
                InvoiceDetailEntity entity = new InvoiceDetailEntity
                {
                    ID         = obj.ID,
                    FoodID     = "" + obj.FoodID,
                    NumberFood = (int)obj.NumberFood,
                    Size       = obj.Size,
                    PriceSize  = (decimal)obj.PriceSize,
                    Type       = obj.Type,
                    PriceType  = (decimal)obj.PriceType,
                    InvoiceID  = "" + obj.InvoiceID,
                    FoodImage  = obj.FoodImage,
                    FoodName   = obj.FoodName,
                    Price      = (decimal)obj.Price
                };
                list.Add(entity);
            }

            return(list);
        }
Beispiel #9
0
        public bool Update_Status_Invoice(int status, string invoiceID)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            bool isUpdate = false;
            int  update   = dbContext.UPDATE_STATUS_INVOICE(status, invoiceID);

            if (update > 0)
            {
                isUpdate = true;
            }
            return(isUpdate);
        }
Beispiel #10
0
        public bool Check_User_FB_And_GG(string username, string usertype)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            bool ischeck = false;
            var  entity  = dbContext.CHECK_USER_LOGIN(username, usertype).FirstOrDefault();

            if (entity != null)
            {
                ischeck = true;
            }
            return(ischeck);
        }
Beispiel #11
0
        public bool Update_Customer(CustomerEntity customer)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            bool isUpdate = false;
            int  update   = dbContext.UPDATE_CUSTOMER_TOSQL(customer.UserName, customer.FullName, customer.Address, customer.Mobile, customer.UserType, customer.Password, customer.Email, customer.Avatar);

            if (update > 0)
            {
                isUpdate = true;
            }
            return(isUpdate);
        }
Beispiel #12
0
        public bool Insert_Customer(CustomerEntity customer)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            bool isInsert = false;
            int  insert   = dbContext.INSERT_CUSTOMER_TOSQL(customer.FullName, customer.Address, customer.Mobile, customer.UserName, customer.Password, customer.Email, customer.Avatar, customer.UserType);

            if (insert > 0)
            {
                isInsert = true;
            }
            return(isInsert);
        }
Beispiel #13
0
        public bool Insert_Invoice(InvoiceEntity invoice)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            bool isInsert = false;
            int  insert   = dbContext.INSERT_INVOICE_TOSQL(invoice.OrderDate, invoice.DeliveryDate, invoice.Sale, invoice.ServiceChange, invoice.ShippingFee, invoice.TotalPrice, invoice.Status, invoice.CustomerName, invoice.CustomerPhone, invoice.AddressDelivery, invoice.CustomerID, invoice.StoreID);

            if (insert > 0)
            {
                isInsert = true;
            }
            return(isInsert);
        }
        public List <StoreImageEntity> Get_List_StoreImage_By_StoreID(string id)
        {
            List <StoreImageEntity> list = new List <StoreImageEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var listvar = dbContext.GET_LIST_STOREIMAGE_BY_STOREID(id).ToList();

            foreach (var obj in listvar)
            {
                StoreImageEntity entity = new StoreImageEntity
                {
                    StoreID      = "" + obj.StoreID,
                    URL          = obj.URL,
                    StoreImageID = obj.StoreImageID,
                };
                list.Add(entity);
            }
            return(list);
        }
Beispiel #15
0
        public StoreSaleEntity Get_Object_StoreSale_By_StoreID(string id)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            if (dbContext.GET_OBJECT_STORESALE_BY_STOREID(id).FirstOrDefault() == null)
            {
                return(null);
            }
            var             obj    = dbContext.GET_OBJECT_STORESALE_BY_STOREID(id).FirstOrDefault();
            StoreSaleEntity entity = new StoreSaleEntity
            {
                StoreSaleID = obj.StoreSaleID,
                Sale        = (int)obj.Sale,
                StratSale   = "" + obj.StartSale,
                StoreID     = "" + obj.StoreID,
                StopSale    = "" + obj.StopSale
            };

            return(entity);
        }
        public bool Insert_List_Detail_Invoice(List <InvoiceDetailEntity> list)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            bool isInsert = false;

            for (int i = 0; i < list.Count; i++)
            {
                int insert = dbContext.INSERT_INVOICEDETAIL_TOSQL(list[i].FoodID, list[i].NumberFood, list[i].Size, (long)list[i].PriceSize, list[i].Type, (long)list[i].PriceType, list[i].InvoiceID);
                if (insert > 0)
                {
                    isInsert = true;
                }
                else
                {
                    return(false);
                }
            }

            return(isInsert);
        }
        public List <FoodSizeEntity> Get_List_FoodSize_by_FoodID(string id)
        {
            List <FoodSizeEntity> list = new List <FoodSizeEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var listvar = dbContext.GET_LIST_FOODSIZE_BY_FOODID(id).ToList();

            foreach (var obj in listvar)
            {
                FoodSizeEntity entity = new FoodSizeEntity
                {
                    FoodSizeID = obj.FoodSizeID,
                    SizeName   = obj.SizeName,
                    PriceSize  = (decimal)obj.PriceSize,
                    FoodID     = "" + obj.FoodID
                };
                list.Add(entity);
            }
            return(list);
        }
        public FoodEntity Get_Object_Food_By_FoodID(string id)
        {

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();

            }
            var obj = dbContext.GET_OBJECT_FOOD_BY_FOODID(id).FirstOrDefault();

            FoodEntity entity = new FoodEntity
            {
                FoodID = "" + obj.FoodID,
                FoodName = obj.FoodName,
                FoodImage = obj.FoodImage,
                Price = (decimal)obj.Price,
                CategoryID = "" + obj.CategoryID,
                StoreID = "" + obj.StoreID
            };
         


            return entity;
        }
        public List <CategoryEntity> Get_List_Category_by_StoreID(string id)
        {
            List <CategoryEntity> list = new List <CategoryEntity>();

            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }

            var listvar = dbContext.GET_LIST_CATEGORY_BY_STOREID(id).ToList();

            foreach (var obj in listvar)
            {
                CategoryEntity entity = new CategoryEntity
                {
                    CategoryID   = "" + obj.CategoryID,
                    CategoryName = obj.CategoryName,
                    StoreID      = "" + obj.StoreID
                };
                list.Add(entity);
            }

            return(list);
        }
Beispiel #20
0
        public CustomerEntity Get_Object_Customer_By_UserName(string userName)
        {
            if (dbContext == null)
            {
                dbContext = new FoodDeliveryEntities();
            }
            var obj = dbContext.GET_OBJECT_CUSTOMER_BY_USERNAME(userName).FirstOrDefault();

            CustomerEntity entity = new CustomerEntity
            {
                CustomerID = "" + obj.CustomerID,
                FullName   = obj.FullName,
                Address    = obj.Address,
                Email      = obj.Email,
                Mobile     = obj.Mobile,
                Avatar     = obj.Avatar,
                UserName   = obj.UserName,
                Password   = obj.Password,
                UserType   = obj.UserType,
            };


            return(entity);
        }
Beispiel #21
0
 public StoreController()
 {
     db = new FoodDeliveryEntities();
 }
 public AdminCustomerController()
 {
     db = new FoodDeliveryEntities();
 }
 public AccountController()
 {
     db = new FoodDeliveryEntities();
 }
 public PostController()
 {
     db = new FoodDeliveryEntities();
 }
 public AdminHomeController()
 {
     db = new FoodDeliveryEntities();
 }
 public InvoiceController()
 {
     db = new FoodDeliveryEntities();
 }
Beispiel #27
0
 public CategoryController()
 {
     db = new FoodDeliveryEntities();
 }