예제 #1
0
        override protected IQueryable <T> EntitiesAll <T>()
        {
            FarmDataContext dc = new FarmDataContext(connection);

            dc.ObjectTrackingEnabled = false;

            var reslut = from a in dc.GetTable <T>()
                         join b in dc.GetTable <tbStructure>() on a.areaID equals b.ID
                         join c in dc.GetTable <Purview>() on b.ID equals c.areaID
                         where c.userID == Account.currentUser.ID
                         select a;

            return(reslut);
        }
예제 #2
0
        public ActionResult Production(DateTime orgDate, DateTime endDate)
        {
            IEnumerable <ProductionReportResult> dataSource;

            using (var dc = new FarmDataContext(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
            {
                int userID = Account.userID;
                dataSource = dc.ProductionReport(userID, orgDate, endDate).ToList();
            }

            ReportModel report = new ReportModel();

            report.dataSource  = dataSource.AsQueryable();
            report.reportName  = "Production.rdlc";
            report.displayName = "生产报表";

            report.Parameters.Add(new Microsoft.Reporting.WebForms.ReportParameter("orgDate", orgDate.ToShortDateString()));
            report.Parameters.Add(new Microsoft.Reporting.WebForms.ReportParameter("endDate", endDate.ToShortDateString()));
            Session["report"] = report;


            return(JavaScript(JSHelper.ShowSuccess("正在生成报表…")));
        }
예제 #3
0
        //
        // GET: /View/

        public JsonResult AutoComplete(string id)
        {
            FarmDataContext dc = new FarmDataContext();

            if (string.IsNullOrEmpty(id))
            {
                Response.End();
            }

            IEnumerable <string> xx = null;

            switch (id)
            {
            case "fwd":
                //xx = (from x in Field.GetFieldIE() select x).Distinct();
                break;

            case "source":
                xx = (from x in dc.tbPig select x.source).Distinct();
                break;

            case "yhname":
                xx = (from x in dc.tbRaiser select x.name).Distinct();
                break;

            case "yhaddress":
                xx = (from x in dc.tbRaiser select x.address).Distinct();
                break;

            case "transportMan":
                xx = dc.tbPig.Select(p => p.transportMan).Distinct();
                break;

            case "purchaseMan":
                xx = dc.tbPig.Select(p => p.purchaseMan).Distinct();
                break;

            case "technician":
                xx = dc.tbPig.Select(p => p.technician).Distinct();
                break;

            case "xsy":
                xx = dc.tbSales.Select(p => p.salesperson).Distinct();
                break;

            default:
                xx = null;
                break;
            }

            var output = new System.Text.StringBuilder();

            if (xx != null)
            {
                foreach (var m in xx)
                {
                    var s = m;
                    output.AppendFormat("{0},", s);
                }
            }

            return(Json(output.ToString().Split(','), JsonRequestBehavior.AllowGet));
        }