Пример #1
0
        public int ValidateUser(string emailid, string password)
        {
            context = new CodinovaDBContext();
            int result = context.Database.SqlQuery <int>("Select [dbo].ufn_ValidateUser(@EmailId,@Password)", new SqlParameter("@EmailId", emailid), new SqlParameter("@Password", password)).First();

            return(result);
        }
        public int InsertSaleDetails(double?totalSaleAmount, string emailId, out int saleid)
        {
            int retvalue = 0;

            try
            {
                context = new CodinovaDBContext();
                var saleidparam = new ObjectParameter("SaleId", typeof(int));
                retvalue = context.usp_InsertSaleDetails(emailId, totalSaleAmount, saleidparam);
                saleid   = Convert.ToInt32(saleidparam.Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                saleid = 0;
            }
            return(retvalue);
        }
        public List <POSSystem.Common.Product> GetAllProducts()
        {
            context = new CodinovaDBContext();
            List <POSSystem.Common.Product> commonprodlist = new List <POSSystem.Common.Product>();

            List <Product> prodlist;

            prodlist = (from p in context.Products select p).ToList <Product>();
            foreach (Product prod in prodlist)
            {
                POSSystem.Common.Product p1 = new POSSystem.Common.Product()
                {
                    ProductId   = prod.ProductId,
                    ProductName = prod.ProductName,
                    Price       = prod.Price,
                    CategoryId  = prod.CategoryId
                };
                commonprodlist.Add(p1);
            }

            return(commonprodlist);
        }