public List <VEPackage> fetchPersonalCare(string mobile, IOrganizationService orgService)
        {
            List <VEPackage> lPersonalCare = new List <VEPackage>();

            QueryExpression qeEPackage = new QueryExpression("pcl_ecommerceorderhistory");

            qeEPackage.ColumnSet = new ColumnSet("pcl_ordernumber", "pcl_orderdate", "pcl_finalorderamount", "pcl_orderamount");
            qeEPackage.AddOrder("pcl_orderdate", OrderType.Descending);
            qeEPackage.PageInfo            = new PagingInfo();
            qeEPackage.PageInfo.Count      = 5;//Top 5 records
            qeEPackage.PageInfo.PageNumber = 1;
            LinkEntity leClient = new LinkEntity
            {
                LinkFromEntityName    = "pcl_ecommerceorderhistory",
                LinkFromAttributeName = "pcl_customername",
                LinkToEntityName      = "new_client1",
                LinkToAttributeName   = "new_client1id"
            };

            leClient.LinkCriteria.AddCondition("new_phone", ConditionOperator.Equal, mobile);
            qeEPackage.LinkEntities.Add(leClient);

            EntityCollection ecEPackage = orgService.RetrieveMultiple(qeEPackage);

            foreach (Entity itemPCare in ecEPackage.Entities)
            {
                VEPackage _package = new VEPackage();
                if (itemPCare.Contains("pcl_ordernumber"))
                {
                    _package.PackageId = itemPCare["pcl_ordernumber"].ToString();
                }
                if (itemPCare.Contains("pcl_orderdate"))
                {
                    _package.PackageJoiningDate = Convert.ToDateTime(itemPCare["pcl_orderdate"]).AddMinutes(330);//.ToString();
                }
                if (itemPCare.Contains("pcl_orderamount"))
                {
                    _package.baseAmount = ((Money)itemPCare["pcl_orderamount"]).Value.ToString();
                }
                if (itemPCare.Contains("pcl_finalorderamount"))
                {
                    _package.finalAmount = ((Money)itemPCare["pcl_finalorderamount"]).Value.ToString();
                }
                List <Service> lService = fetchServices(Guid.Empty, Guid.Empty, Guid.Empty, Guid.Empty, itemPCare.Id, orgService);
                if (lService.Count != 0)
                {
                    _package.Service = lService.ToArray();
                }

                lPersonalCare.Add(_package);
            }
            if (lPersonalCare.Count > 0)
            {
                lPersonalCare = lPersonalCare.OrderBy(o => o.PackageJoiningDate).Take(5).ToList();
            }

            return(lPersonalCare);
        }
        public List <VEPackage> fetchVanityCubeData(string mobile, IOrganizationService orgService)
        {
            List <VEPackage> lVanityPackage = new List <VEPackage>();

            QueryExpression qeVCPackage = new QueryExpression("pcl_vanitycubebooking");

            qeVCPackage.ColumnSet = new ColumnSet("pcl_name", "pcl_servicedate", "pcl_totalamount", "pcl_serviceamount");
            qeVCPackage.AddOrder("pcl_servicedate", OrderType.Descending);
            qeVCPackage.PageInfo            = new PagingInfo();
            qeVCPackage.PageInfo.Count      = 5;//Top 5 records
            qeVCPackage.PageInfo.PageNumber = 1;
            LinkEntity leClient = new LinkEntity
            {
                LinkFromEntityName    = "pcl_vanitycubebooking",
                LinkFromAttributeName = "pcl_clientid",
                LinkToEntityName      = "new_client1",
                LinkToAttributeName   = "new_client1id"
            };

            leClient.LinkCriteria.AddCondition("new_phone", ConditionOperator.Equal, mobile);
            qeVCPackage.LinkEntities.Add(leClient);

            EntityCollection ecVCPackage = orgService.RetrieveMultiple(qeVCPackage);

            foreach (Entity itemVC in ecVCPackage.Entities)
            {
                VEPackage _package = new VEPackage();
                if (itemVC.Contains("pcl_name"))
                {
                    _package.PackageId = itemVC["pcl_name"].ToString();
                }
                if (itemVC.Contains("pcl_servicedate"))
                {
                    _package.PackageJoiningDate = Convert.ToDateTime(itemVC["pcl_servicedate"]).AddMinutes(330);//.ToString();
                }
                if (itemVC.Contains("pcl_serviceamount"))
                {
                    _package.baseAmount = ((Money)itemVC["pcl_serviceamount"]).Value.ToString();
                }
                if (itemVC.Contains("pcl_totalamount"))
                {
                    _package.finalAmount = ((Money)itemVC["pcl_totalamount"]).Value.ToString();
                }
                List <Service> lService = fetchServices(Guid.Empty, Guid.Empty, Guid.Empty, itemVC.Id, Guid.Empty, orgService);
                if (lService.Count != 0)
                {
                    _package.Service = lService.ToArray();
                }

                lVanityPackage.Add(_package);
            }
            if (lVanityPackage.Count > 0)
            {
                lVanityPackage = lVanityPackage.OrderByDescending(o => o.PackageJoiningDate).Take(5).ToList();
            }
            return(lVanityPackage);
        }