Exemplo n.º 1
0
        // GET: /Client/
        public ActionResult Index(string source, string reachstatus, string orderstatus, string dp1, string dp2, string criteria, string term)
        {
            ViewBag.Source = OptionsProvider.PopulateClientSourceOption(true);

            if (String.IsNullOrEmpty(source))
            {
                return(View(db.ct_client.Where(ct => ct.ct_status == WebConstants.cStatusYes).ToList()));
            }
            else
            {
                var predicate = PredicateBuilder.True <ct_client>();

                if (source != WebConstants.cSearchAll)
                {
                    predicate = predicate.And(p => p.ct_client_source.Contains(source));
                }
                if (reachstatus != WebConstants.cSearchAll)
                {
                    predicate = predicate.And(p => p.ct_reach_status.Contains(reachstatus));
                }
                if (orderstatus != WebConstants.cSearchAll)
                {
                    predicate = predicate.And(p => p.ct_order_status.Contains(orderstatus));
                }
                if (dp1 != String.Empty)
                {
                    predicate = predicate.And(p => p.ct_wedding_day >= DateTime.Parse(dp1));
                }
                if (dp2 != String.Empty)
                {
                    predicate = predicate.And(p => p.ct_wedding_day <= DateTime.Parse(dp2));
                }
                if (criteria == "name" && term != String.Empty)
                {
                    predicate = predicate.And(p => p.ct_client_name.Contains(term));
                }
                if (criteria == "tel" && term != String.Empty)
                {
                    predicate = predicate.And(p => p.ct_client_tel.Contains(term));
                }
                if (criteria == "qq" && term != String.Empty)
                {
                    predicate = predicate.And(p => p.ct_client_qq.Contains(term));
                }
                return(View(db.ct_client.AsExpandable().Where(predicate).ToList()));
            }
        }
        // GET: /Order/Create
        public ActionResult Create()
        {
            ViewBag.Source = OptionsProvider.PopulateClientSourceOption(false);

            ct_client client = new ct_client();

            client.ct_client_id    = 0;
            client.ct_status       = WebConstants.cStatusYes;
            client.us_user_name    = "admin";
            client.ct_create_time  = DateTime.Now;
            client.ct_reach_status = WebConstants.cClientReachStatusR;
            client.ct_order_status = WebConstants.cClientOrderStatusO;

            or_order order = new or_order();

            order.or_status = WebConstants.cStatusYes;
            order.or_from   = "城西";
            order.ct_client = client;

            return(View(order));
        }