示例#1
0
        public List <Models.MProducts> GetAll()
        {
            List <Models.MProducts> model = new List <Models.MProducts>();
            var query = from o in obj.Products select o;

            foreach (var item in query)
            {
                Models.MProducts m = new Models.MProducts();
                m.id           = Convert.ToString(item.id);
                m.ProductCode  = item.ProductCode;
                m.Name         = item.Name;
                m.tag1         = item.tag2;
                m.tag2         = item.tag2;
                m.tag3         = item.tag3;
                m.CostPrice    = item.costPrice;
                m.SalePrice    = item.salePrice;
                m.Manufacturer = item.Manufacturer;
                m.description  = item.Description;
                Classes.CVendor cv = new CVendor();
                m.Vendorld     = Convert.ToString(item.VendorId);
                m.VendorName   = cv.GetVendorNameById(m.Vendorld);
                m.FiscalYearld = Convert.ToString(item.FiscalYearId);
                m.eDate        = Convert.ToString(item.eDate);
                m.WareHouseId  = Convert.ToString(item.WareHouseId);

                model.Add(m);
            }

            return(model);
        }
示例#2
0
        public string ReturnVendorName(string ProductsId)
        {
            string VendorName = string.Empty;
            var    query      = (from o in obj.Products where o.id == Convert.ToInt32(ProductsId) select o.VendorId).FirstOrDefault();

            if (query != null)
            {
                Classes.CVendor cv = new CVendor();
                VendorName = cv.GetVendorNameById(query.ToString());
            }
            return(VendorName);
        }
示例#3
0
        public string ReturnSalePrice(int ProductId)
        {
            string CostPrice = string.Empty;
            var    query     = (from o in obj.Products where o.id == Convert.ToInt32(ProductId) select o.salePrice).FirstOrDefault();

            if (query != null)
            {
                Classes.CVendor cv = new CVendor();
                CostPrice = (query.ToString());
            }
            return(CostPrice);
        }
示例#4
0
        public List <Models.MOrderViewOfPayment> ShowVendorOrderViewForPayment(int VendorId)
        {
            COrders      co  = new COrders();
            COrderOnline col = new COrderOnline();
            CVendor      cv  = new CVendor();
            List <Models.MOrderViewOfPayment> VendorPayments = new List <Models.MOrderViewOfPayment>();
            List <Models.MPayments>           Payments       = this.GetAll();
            List <Models.MOrders>             Orders         = co.GetAll();

            List <Models.MOrdersLine> OrderLine = col.GetAll();

            var query = from o in Payments
                        where o.OrderId != 0 &&
                        o.ClientId == -1 &&
                        o.VendorId == VendorId &&
                        o.Paymentstate != Common.Constants.PaymentState.Paid.ToString()
                        select o;

            foreach (var item in query)
            {
                Models.MOrderViewOfPayment mop = new Models.MOrderViewOfPayment();
                mop.PaymentId = item.id.ToString();
                mop.VendorId  = item.VendorId.ToString();
                string vendorName = cv.GetVendorNameById(mop.VendorId);
                string OrderId    = item.OrderId.ToString();
                mop.OrderId = item.OrderId.ToString();
                string OrderDate = (from o in Orders
                                    where o.id == OrderId
                                    select o.Orderdate).FirstOrDefault();
                mop.OrderDate = OrderDate;
                mop.OrderName = (from o in Orders
                                 where o.id == OrderId
                                 select o.OrderName).FirstOrDefault();
                mop.OrderCode = (from o in Orders
                                 where o.id == OrderId
                                 select o.OrdersNo).FirstOrDefault();
                mop.PaidAmount = item.Paid;
                mop.TotalCost  = item.TotalCost;
                mop.VendorName = vendorName;
                VendorPayments.Add(mop);
            }

            return(VendorPayments);
        }
示例#5
0
            public List <Models.MViewModels.MViewOrders> GetAll(string OrderType)
            {
                List <Models.MViewModels.MViewOrders> OrderDetails = new List <Models.MViewModels.MViewOrders>();
                List <Models.MOrders> Orders = new List <Models.MOrders>();

                Classes.COrders  co  = new COrders();
                Classes.CClients ccl = new CClients();
                Classes.CVendor  cv  = new CVendor();
                Orders = co.GetAll();
                switch (OrderType)
                {
                case "Clients":
                {
                    Orders = Orders.Where(o => o.venorld == "-1").ToList();
                    for (int i = 0; i < Orders.Count; i++)
                    {
                        Models.MViewModels.MViewOrders mod = new Models.MViewModels.MViewOrders();
                        string ClientName = string.Empty;
                        if (Orders[i].ClientId != "-1")
                        {
                            ClientName = ccl.ReturnClientNameById(Orders[i].ClientId);
                        }

                        mod.ClientName          = ClientName;
                        mod.Installments        = Orders[i].Installments;
                        mod.InstallmentsDueDate = Orders[i].InstallmentDueDate;
                        mod.OrderCost           = Orders[i].TotalCost;
                        mod.OrderDescription    = Orders[i].OrderDescription;
                        mod.OrderId             = Orders[i].id;
                        mod.OrderName           = Orders[i].OrderName;
                        mod.OrderNo             = Orders[i].OrdersNo;
                        mod.VendorName          = string.Empty;
                        mod.WareHouseId         = Orders[i].WareHouseId;
                        mod.ModeOfPayment       = Orders[i].ModeOfPayment;
                        mod.GrantorName         = Orders[i].GrantorName;
                        OrderDetails.Add(mod);
                    }
                    break;
                }

                case "Vendors":
                {
                    Orders = Orders.Where(o => o.ClientId == "-1").ToList();
                    for (int i = 0; i < Orders.Count; i++)
                    {
                        Models.MViewModels.MViewOrders mod = new Models.MViewModels.MViewOrders();
                        string VendorName = string.Empty;

                        if (Orders[i].venorld != "-1")
                        {
                            VendorName = cv.GetVendorNameById(Orders[i].venorld);
                        }
                        mod.ClientName          = string.Empty;
                        mod.Installments        = Orders[i].Installments;
                        mod.InstallmentsDueDate = Orders[i].InstallmentDueDate;
                        mod.OrderCost           = Orders[i].TotalCost;
                        mod.OrderDescription    = Orders[i].OrderDescription;
                        mod.OrderId             = Orders[i].id;
                        mod.OrderName           = Orders[i].OrderName;
                        mod.OrderNo             = Orders[i].OrdersNo;
                        mod.VendorName          = VendorName;
                        mod.WareHouseId         = Orders[i].WareHouseId;
                        OrderDetails.Add(mod);
                    }
                    break;
                }

                default:
                    break;
                }


                return(OrderDetails);
            }