Exemplo n.º 1
0
        public ActionResult GetList(E_PageParameter ePageParameter)
        {
            int pageIndex = Utils.GetInt(Request["page"]);

            ePageParameter.pageindex = pageIndex > 0 ? pageIndex - 1 : pageIndex;
            ePageParameter.pagesize  = 20;

            List <tb_Sample> list = new List <tb_Sample>();
            int count             = 0;

            switch (CurrentUserInfo.DataRange)
            {
            case 3:     //个人
                ePageParameter.areaid     = -1;
                ePageParameter.createuser = CurrentUserInfo.PersonnelID;
                break;

            case 2:    //区域
                ePageParameter.areaid = (int)CurrentUserInfo.AreaID;
                break;
            }

            list = _dSample.GetSampleList(ePageParameter, ref count);
            ViewBag.SampleList     = list;
            ViewBag.arealist       = _tArea.GetModelList((CurrentUserInfo.DataRange > 1 ? $"AreaID={CurrentUserInfo.AreaID}" : ""));
            ViewBag.ePageParameter = ePageParameter;
            ViewBag.page           = Utils.ShowPage(count, ePageParameter.pagesize, pageIndex, 5);
            return(View("/views/Sample/SampleList.cshtml"));
        }
Exemplo n.º 2
0
        D_tb_InPersonnel dInPersonnel = new D_tb_InPersonnel();//人员管理
        //
        // GET: /DetectProject/

        public ActionResult ExpePlanList(E_PageParameter ePageParameter)
        {
            int pageIndex = Utils.GetInt(Request["page"]);

            ePageParameter.pageindex = pageIndex > 0 ? pageIndex - 1 : pageIndex;
            ePageParameter.pagesize  = 20;

            ViewBag.ExpePlanList  = this.GetList(ePageParameter);
            ViewBag.PersonnelList = dInPersonnel.GetList(new E_tb_InPersonnel()
            {
            });

            ViewBag.ePageParameter = ePageParameter;
            ViewBag.page           = Utils.ShowPage(ePageParameter.count, ePageParameter.pagesize, pageIndex, 5);

            ViewData["PlanTypeList"] = this.GetPlanTypeList(true);
            ViewData["ProjectList"]  = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", true);
            ViewData["AreaList"]     = PageTools.GetSelectList(tArea.GetList("").Tables[0], "AreaID", "AreaName", true);

            return(View("/views/ExpePlan/ExpePlanList.cshtml"));

            //if (Request["ApprovalPersonnelName"] != null)
            //    ViewData["ApprovalPersonnelName"] = Request["ApprovalPersonnelName"].ToString();
            //else
            //    ViewData["ApprovalPersonnelName"] = "";
            //ViewBag._userName = CurrentUserInfo.UserName;
            //eExpePlan.AreaID = CurrentUserInfo.AreaID;
            //ViewBag.IsDisabled = (CurrentUserInfo.RoleID != 1) ? "true" : "false"; //权限判断
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取查询条件
        /// </summary>
        /// <param name="ePageParameter">查询参数实体</param>
        /// <returns>查询条件</returns>
        private string GetStrWhere(E_PageParameter ePageParameter)
        {
            //拼接查询条件
            StringBuilder strwhere = new StringBuilder();

            if (ePageParameter.areaid > 0) //单位
            {
                strwhere.AddWhere($"A.AreaID={ePageParameter.areaid}");
            }
            if (!string.IsNullOrEmpty(ePageParameter.samplename)) //样品名称
            {
                strwhere.AddWhere($"A.name like '%{ePageParameter.samplename}%'");
            }
            if (!string.IsNullOrEmpty(ePageParameter.detectionuser)) //抽样人
            {
                strwhere.AddWhere($"A.detectionUser like '%{ePageParameter.detectionuser}%'");
            }
            if (ePageParameter.createuser > 0) //创建人
            {
                strwhere.AddWhere($"A.createUser={ePageParameter.createuser}");
            }
            if (ePageParameter.starttime != null) //抽样时间
            {
                strwhere.AddWhere($"A.detectionDate>=cast('{Convert.ToDateTime(ePageParameter.starttime).ToString("yyyy-MM-dd")}' as datetime)");
            }
            if (ePageParameter.endtime != null)
            {
                strwhere.AddWhere($"A.detectionDate<=cast('{Convert.ToDateTime(ePageParameter.endtime).ToString("yyyy-MM-dd")}' as datetime)");
            }
            return(strwhere.ToString());
        }
        public JsonResult GetTreeNodeList(E_PageParameter ePageParameter)
        {
            DbObject db = new DbObject(ePageParameter.connstring);

            List <E_TreeNode> NodeList = new List <E_TreeNode>();
            var tables = db.GetTableViews(ePageParameter.dbname);

            foreach (var item in tables)
            {
                E_TreeNode nodetable = new E_TreeNode();
                nodetable.id       = 0;
                nodetable.name     = item;
                nodetable.nodetype = 1;
                List <ColumnInfo> ColumnList     = db.GetColumnInfoList(ePageParameter.dbname, item);
                List <E_TreeNode> columnnodelist = new List <E_TreeNode>();
                foreach (var columnitem in ColumnList)
                {
                    E_TreeNode nodecolumn = new E_TreeNode();
                    nodecolumn.id       = 0;
                    nodecolumn.name     = columnitem.ColumnName + "(" + columnitem.TypeName + ")" + columnitem.Description;
                    nodecolumn.children = null;
                    nodecolumn.nodetype = 2;
                    columnnodelist.Add(nodecolumn);
                }
                nodetable.children = columnnodelist;
                NodeList.Add(nodetable);
            }
            return(Json(NodeList, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 生成对象操作
        /// </summary>
        public ActionResult BuilderDAL(E_PageParameter ePageParameter)
        {
            BuilderDALCode    builderDAL = new BuilderDALCode();
            DbObject          db         = new DbObject(ePageParameter.connstring);
            E_DALCode         eDalCode   = new E_DALCode();
            string            tname      = ePageParameter.tablename.Replace(ePageParameter.prefix, "");
            List <ColumnInfo> list       = db.GetColumnInfoList(ePageParameter.dbname, ePageParameter.tablename);

            eDalCode.Fieldlist = list;
            eDalCode.TableName = ePageParameter.tablename;
            eDalCode.ModelName = "E_" + tname.Substring(0, 1).ToUpper() + tname.Substring(1, tname.Length - 1);
            eDalCode.Modelpath = "Model";
            eDalCode.DbObject  = db;
            eDalCode.Keys      = list.Where(a => a.IsPrimaryKey).ToList();
            eDalCode.DALpath   = "DAL";
            eDalCode.DALName   = "D_" + tname.Substring(0, 1).ToUpper() + tname.Substring(1, tname.Length - 1);
            DataRow tableDescRow = db.GetTablesExProperty(ePageParameter.dbname).Select("objname='" + ePageParameter.tablename + "'").FirstOrDefault();

            if (tableDescRow != null)
            {
                eDalCode.TableDescription = tableDescRow["value"]?.ToString();
            }
            builderDAL.eDALCode = eDalCode;
            string modelStr = builderDAL.CreatDAL();

            ViewBag.CodeHtml = modelStr;
            return(PartialView("~/Views/Code/BuilderDAL.cshtml"));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取所有数据列表
        /// 作者:小朱
        /// </summary>
        /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns>
        public DataTable GetList(E_PageParameter ePageParameter)
        {
            DataTable dt       = new DataTable();
            int       total    = 0;
            string    strWhere = GetWhere(ePageParameter);

            //dt = tTestReport.GetListByPage(strWhere, "UpdateTime DESC,T.SampleName ASC", pageNumber * pageSize - (pageSize - 1), pageNumber * pageSize, ref total).Tables[0];
            int startindex = ePageParameter.pageindex * ePageParameter.pagesize + 1;
            int endindex   = (ePageParameter.pageindex + 1) * ePageParameter.pagesize;

            dt = tTestReport.GetListByPage(strWhere, "TestTime DESC", startindex, endindex, ref total).Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string        ApprovalPersonnelName = dt.Rows[i]["ApprovalPersonnelName"].ToString();
                    string        RecordIDS             = dt.Rows[i]["RecordIDS"].ToString();
                    StringBuilder strRecordIDS          = new StringBuilder();
                    if (!string.IsNullOrEmpty(RecordIDS))
                    {
                        string[] ArrRecordIDS = RecordIDS.Split(',');
                        foreach (string item in ArrRecordIDS)
                        {
                            if (!string.IsNullOrEmpty(item))
                            {
                                strRecordIDS.Append(string.Format("<a href='/OriginalRecord/OriginalRecordList?RecordID={0}&ApprovalPersonnelName={1}' style='color:Blue; font-weight:bold;'>{0}</a>,", item, ApprovalPersonnelName));
                            }
                        }
                    }
                    dt.Rows[i]["RecordIDS"] = strRecordIDS.ToString().TrimEnd(',');

                    string        TaskNoS    = dt.Rows[i]["TaskNoS"].ToString();
                    StringBuilder strTaskNoS = new StringBuilder();
                    if (!string.IsNullOrEmpty(TaskNoS))
                    {
                        string[] ArrTaskNoS = TaskNoS.Split(',');
                        foreach (string item in ArrTaskNoS)
                        {
                            if (!string.IsNullOrEmpty(item))
                            {
                                strTaskNoS.Append(string.Format("<a href='/ExpePlan/ExpePlanList?PlanID={0}&ApprovalPersonnelName={1}' style='color:Blue; font-weight:bold;'>{0}</a>,", item, ApprovalPersonnelName));
                            }
                        }
                    }
                    dt.Rows[i]["TaskNoS"] = strTaskNoS.ToString().TrimEnd(',');
                }
            }

            ePageParameter.count = total;
            return(dt);

            //string strJson = PublicClass.ToJson(dt, total);
            //if (strJson.Trim() == "")
            //{
            //    strJson = "{\"total\":0,\"rows\":[]}";
            //}
            //return strJson;
        }
Exemplo n.º 7
0
        public FileResult ExportSample(E_PageParameter ePageParameter)
        {
            List <tb_Sample> list     = _dSample.GetSampleList(ePageParameter);
            string           filename = "样品列表" + DateTime.Now.ToFileTime() + ".xls";
            string           path     = Server.MapPath("/upfile/sample/" + filename);

            NPOITools.RenderToExcel <tb_Sample>(list, path);
            return(File(path, "application/vnd.ms-excel", filename));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取实验考核数据列表
        /// </summary>
        /// <param name="ePageParameter">页面参数实体</param>
        /// <returns></returns>
        public List <E_ExperimentCheck> GetExperimentCheckList(E_PageParameter ePageParameter, ref int count)
        {
            List <E_ExperimentCheck> list = new List <E_ExperimentCheck>();

            //拼接查询条件
            StringBuilder strwhere = new StringBuilder();

            strwhere.AddWhere("PlanID is not null"); //排除无实验计划的记录
            if (ePageParameter.starttime != null)
            {
                strwhere.AddWhere($"detectionDate>=cast('{Convert.ToDateTime(ePageParameter.starttime).ToString("yyyy-MM-dd")}' as datetime)");
            }
            if (ePageParameter.endtime != null)
            {
                strwhere.AddWhere($"detectionDate<=cast('{Convert.ToDateTime(ePageParameter.endtime).ToString("yyyy-MM-dd")}' as datetime)");
            }

            //主查询Sql
            StringBuilder search = new StringBuilder();

            search.AppendFormat(@"select 
                                    row_number()over(order by detectionDate desc) as rowid,
                                    A.id as sampleid,A.name as samplename,A.detectionDate,A.urgentlevel,C.ProjectID,C.ProjectName
                                    ,D.DetectTime,D.DetectPersonnelID,E.PersonnelName as detectpersonnelname 
	                                from tb_Sample as A
	                                left join tb_ExpePlan as B on A.id=B.SampleID
	                                left join tb_Project as C on B.ProjectID=C.ProjectID
	                                left join tb_OriginalRecord as D on B.TaskNo=D.TaskNo
	                                left join tb_InPersonnel as E on D.DetectPersonnelID=E.PersonnelID
	                                {0}"    , strwhere.ToString());

            //当前页数据Sql
            StringBuilder currdata = new StringBuilder();

            currdata.AppendFormat(@"select * from 
                                (
	                                {0}
                                ) as t where t.rowid between @pageindex*@pagesize+1 and (@pageindex+1)*@pagesize ", search.ToString());

            //当前条件下的数据总量
            StringBuilder totalcount = new StringBuilder();

            totalcount.AppendFormat(@"select count(1) from 
                                (
	                                {0}
                                ) as t ", search.ToString());

            //执行查询语句
            using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString()))
            {
                list  = conn.Query <E_ExperimentCheck>(currdata.ToString(), ePageParameter)?.ToList();
                count = (int)conn.ExecuteScalar(totalcount.ToString(), ePageParameter);
            }
            return(list);
        }
Exemplo n.º 9
0
        public ActionResult SamplingSheet(E_PageParameter ePageParameter)
        {
            List <E_SamplingSheet> list = new List <E_SamplingSheet>();

            list = _dSample.GetSamplingSheetList(ePageParameter);

            ViewBag.SamplingSheetList = list;
            ViewBag.sampleids         = ePageParameter.sampleids;

            return(View("/views/sample/SamplingSheet.cshtml"));
        }
Exemplo n.º 10
0
        public FileResult ExportSamplingSheet(E_PageParameter ePageParameter)
        {
            List <E_SamplingSheet> list = _dSample.GetSamplingSheetList(ePageParameter);
            string filename             = "分样单" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".doc";
            string filetemplatepath     = Server.MapPath("/upfile/template/分样单模板.docx");
            string path = Server.MapPath("/upfile/samplingsheet/" + filename);

            NPOITools.RenderToWord <E_SamplingSheet>(list, filetemplatepath, path);

            return(File(path, "application/vnd.ms-word", filename));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取所有数据列表
        /// </summary>
        /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns>
        public DataTable GetList(E_PageParameter ePageParameter)
        {
            int           total    = 0;
            StringBuilder strWhere = new StringBuilder();

            if (ePageParameter.recordid > 0)
            {
                strWhere.AddWhere("T.RecordID=" + ePageParameter.recordid);
            }
            if (ePageParameter.areaid > 0)
            {
                strWhere.AddWhere("T.AreaID=" + ePageParameter.areaid);
            }
            if (ePageParameter.projectid > 0)
            {
                strWhere.AddWhere("T.ProjectID=" + ePageParameter.projectid);
            }
            if (ePageParameter.starttime != null)
            {
                strWhere.AddWhere("T.DetectTime>=cast('" + ePageParameter.starttime + "' as datetime)");
            }
            if (ePageParameter.endtime != null)
            {
                strWhere.AddWhere("T.DetectTime<=cast('" + ePageParameter.endtime + "' as datetime)");
            }
            if (!string.IsNullOrEmpty(ePageParameter.taskno))
            {
                strWhere.AddWhere("T.TaskNo like  '%" + ePageParameter.taskno + "%'");
            }

            //添加数据权限判断
            switch (CurrentUserInfo.DataRange)
            {
            case 2:    //区域
                strWhere.AddWhere("T.AreaID=" + CurrentUserInfo.AreaID + " ");
                break;

            case 3:    //个人
                strWhere.AddWhere("T.EditPersonnelID=" + CurrentUserInfo.PersonnelID + " ");
                break;
            }


            DataTable dt         = new DataTable();
            int       startindex = ePageParameter.pageindex * ePageParameter.pagesize + 1;
            int       endindex   = (ePageParameter.pageindex + 1) * ePageParameter.pagesize;

            dt = _dOriginalRecord.GetListByPage(strWhere.ToString(), "", startindex, endindex, ref total).Tables[0];
            ePageParameter.count = total;
            return(dt);
        }
Exemplo n.º 12
0
        T_tb_TestReportData tTestReportData = new T_tb_TestReportData();  //检验报告数据

        //
        // GET: /Laboratory/
        public ActionResult OriginalRecordList(E_PageParameter ePageParameter)
        {
            int pageIndex = Utils.GetInt(Request["page"]);

            ePageParameter.pageindex = pageIndex > 0 ? pageIndex - 1 : pageIndex;
            ePageParameter.pagesize  = 20;

            ViewData["AreaList"]    = PageTools.GetSelectList(tArea.GetList("").Tables[0], "AreaID", "AreaName", true);
            ViewData["ProjectList"] = PageTools.GetSelectList(tProject.GetList("").Tables[0], "ProjectID", "ProjectName", true);

            ViewBag.OriginalRecordList = this.GetList(ePageParameter);
            ViewBag.ePageParameter     = ePageParameter;
            ViewBag.page = Utils.ShowPage(ePageParameter.count, ePageParameter.pagesize, pageIndex, 5);
            return(View("/views/OriginalRecord/OriginalRecordList.cshtml"));
        }
Exemplo n.º 13
0
        D_Statistics dStatistics            = new D_Statistics();        //数据统计
        //
        // GET: /Laboratory/

        public ActionResult TestReportList(E_PageParameter ePageParameter)
        {
            int pageIndex = Utils.GetInt(Request["page"]);

            ePageParameter.pageindex = pageIndex > 0 ? pageIndex - 1 : pageIndex;
            ePageParameter.pagesize  = 20;

            ViewBag.arealist       = tArea.GetModelList((CurrentUserInfo.DataRange > 1 ? $"AreaID={CurrentUserInfo.AreaID}" : ""));
            ViewBag.TestReportList = this.GetList(ePageParameter);
            ViewBag.ePageParameter = ePageParameter;
            ViewBag.page           = Utils.ShowPage(ePageParameter.count, ePageParameter.pagesize, pageIndex, 5);

            ViewBag.NoFinishExpePlanCount     = dStatistics.GetNoFinishExpePlanCount(CurrentUserInfo.PersonnelID);
            ViewBag.NoExamineTestReportCount  = dStatistics.GetNoExamineTestReportCount();
            ViewBag.NoApprovalTestReportCount = dStatistics.GetNoApprovalTestReportCount();

            return(View("/views/TestReport/TestReportList.cshtml"));
        }
Exemplo n.º 14
0
        public ActionResult ExperimentCheck(E_PageParameter ePageParameter)
        {
            int pageIndex = Utils.GetInt(Request["page"]);

            ePageParameter.pageindex = pageIndex > 0 ? pageIndex - 1 : pageIndex;
            ePageParameter.pagesize  = 20;
            D_ExperimentCheck        dExperimentCheck = new D_ExperimentCheck();
            List <E_ExperimentCheck> list             = new List <E_ExperimentCheck>();
            int count = 0;

            if (ePageParameter.issearch > 0)
            {
                list = dExperimentCheck.GetExperimentCheckList(ePageParameter, ref count);
            }
            ViewBag.ExperimentCheckList = list;
            ViewBag.ePageParameter      = ePageParameter;
            ViewBag.page = Utils.ShowPage(count, ePageParameter.pagesize, pageIndex, 5);
            return(View("/views/labmanage/experimentcheck.cshtml"));
        }
        /// <summary>
        /// 生成对象实体
        /// </summary>
        public ActionResult BuilderModel(E_PageParameter ePageParameter)
        {
            DbObject         db           = new DbObject(ePageParameter.connstring);
            BuilderModelCode builderModel = new BuilderModelCode();
            E_ModelCode      eModelCode   = new E_ModelCode();

            eModelCode.Fieldlist = db.GetColumnInfoList(ePageParameter.dbname, ePageParameter.tablename);
            eModelCode.ModelName = ePageParameter.tablename.Replace(ePageParameter.prefix, "");
            eModelCode.BaseClass = "E_BaseModel";
            DataRow tableDescRow = db.GetTablesExProperty(ePageParameter.dbname).Select("objname='" + ePageParameter.tablename + "'").FirstOrDefault();

            if (tableDescRow != null)
            {
                eModelCode.TableDescription = tableDescRow["value"]?.ToString();
            }
            builderModel.eModelCode = eModelCode;
            string modelStr = builderModel.CreatModel();

            ViewBag.CodeHtml = modelStr;
            return(PartialView("~/Views/Code/BuilderModel.cshtml"));
        }
Exemplo n.º 16
0
        /// <summary>
        /// 获取实验考核数据列表
        /// </summary>
        /// <param name="ePageParameter">页面参数实体</param>
        /// <returns></returns>
        public List <tb_Sample> GetSampleList(E_PageParameter ePageParameter, ref int count)
        {
            List <Model.tb_Sample> list = new List <Model.tb_Sample>();

            //主查询Sql
            StringBuilder search = new StringBuilder();

            search.AppendFormat(@"select  row_number()over(order by A.createDate desc) as rowid,
	                                       A.*,
	                                       B.PersonnelName as handleusername,
	                                       C.ClientName as inspectcompanyname  
                                    from tb_Sample as A 
                                    left join tb_InPersonnel as B on A.handleUser=B.PersonnelID
                                    left join tb_ClientManage as C on A.InspectCompany=C.ClientID {0} ", GetStrWhere(ePageParameter));

            //当前页数据Sql
            StringBuilder currdata = new StringBuilder();

            currdata.AppendFormat(@"select * from 
                                (
	                                {0}
                                ) as t where t.rowid between @pageindex*@pagesize+1 and (@pageindex+1)*@pagesize ", search.ToString());

            //当前条件下的数据总量
            StringBuilder totalcount = new StringBuilder();

            totalcount.AppendFormat(@"select count(1) from 
                                (
	                                {0}
                                ) as t ", search.ToString());

            //执行查询语句
            using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString()))
            {
                list  = conn.Query <Model.tb_Sample>(currdata.ToString(), ePageParameter)?.ToList();
                count = (int)conn.ExecuteScalar(totalcount.ToString(), ePageParameter);
            }
            return(list);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 获取样品列表,不带分页
        /// </summary>
        /// <param name="ePageParameter">查询参数实体</param>
        /// <returns>返回对应数据集合</returns>
        public List <tb_Sample> GetSampleList(E_PageParameter ePageParameter)
        {
            List <tb_Sample> list = new List <tb_Sample>();

            //主查询Sql
            StringBuilder search = new StringBuilder();

            search.AppendFormat(@"select  row_number()over(order by A.createDate desc) as rowid,
	                                       A.*,
	                                       B.PersonnelName as handleusername,
	                                       C.ClientName as inspectcompanyname  
                                    from tb_Sample as A 
                                    left join tb_InPersonnel as B on A.handleUser=B.PersonnelID
                                    left join tb_ClientManage as C on A.InspectCompany=C.ClientID {0} ", GetStrWhere(ePageParameter));

            //执行查询语句
            using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString()))
            {
                list = conn.Query <Model.tb_Sample>(search.ToString(), ePageParameter)?.ToList();
            }
            return(list);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 获取分样单数据
        /// </summary>
        /// <param name="ePageParameter">查询参数实体</param>
        /// <returns>返回分样单数据</returns>
        public List <E_SamplingSheet> GetSamplingSheetList(E_PageParameter ePageParameter)
        {
            List <E_SamplingSheet> list = new List <E_SamplingSheet>();

            //主查询Sql
            StringBuilder search = new StringBuilder();

            search.AppendFormat(@"select A.samplenum,A.name as samplename,
                                        (C.ProjectName+'--'+B.InspectMethod) as checkprojectandstandard,
                                        A.storcondition,A.checkdepar,
                                        case when A.urgentlevel=1 then '普通' else '紧急' end asurgentlevel
                                        from dbo.tb_Sample as A 
                                        left join dbo.tb_ExpePlan AS B on A.id=B.SampleID
                                        left join dbo.tb_Project as C on B.ProjectID=C.ProjectID
                                    where A.id in ({0})", ePageParameter.sampleids);

            //执行查询语句
            using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString()))
            {
                list = conn.Query <E_SamplingSheet>(search.ToString(), ePageParameter)?.ToList();
            }
            return(list);
        }
        /// <summary>
        /// 生成对象控制器
        /// </summary>
        public ActionResult BuilderControllers(E_PageParameter ePageParameter)
        {
            BuilderControllersCode builderControllers = new BuilderControllersCode();
            DbObject          db = new DbObject(ePageParameter.connstring);
            E_ControllersCode eControllersCode = new E_ControllersCode();
            string            tname            = ePageParameter.tablename.Replace(ePageParameter.prefix, "");
            List <ColumnInfo> list             = db.GetColumnInfoList(ePageParameter.dbname, ePageParameter.tablename);

            eControllersCode.primarykeyname = list.Where(a => a.IsPrimaryKey).ToList().First().ColumnName;
            eControllersCode.modelname      = "E_" + tname.Substring(0, 1).ToUpper() + tname.Substring(1, tname.Length - 1);
            eControllersCode.tablename      = tname.Substring(0, 1).ToUpper() + tname.Substring(1, tname.Length - 1);
            DataRow tableDescRow = db.GetTablesExProperty(ePageParameter.dbname).Select("objname='" + ePageParameter.tablename + "'").FirstOrDefault();

            if (tableDescRow != null)
            {
                eControllersCode.tabledescription = tableDescRow["value"]?.ToString();
            }
            builderControllers.eControllersCode = eControllersCode;

            string modelStr = builderControllers.CreatControllers();

            ViewBag.CodeHtml = modelStr;
            return(PartialView("~/Views/Code/BuilderControllers.cshtml"));
        }
 /// <summary>
 /// 生成对象编辑页
 /// </summary>
 public ActionResult BuilderPageEdit(E_PageParameter ePageParameter)
 {
     return(PartialView("~/Views/Code/BuilderPageEdit.cshtml"));
 }
Exemplo n.º 21
0
        /// <summary>
        /// 获取所有数据列表
        /// 作者:小朱
        /// </summary>
        /// <returns>将DataTable转换为Json数据格式通过string类型返回</returns>
        public DataTable GetList(E_PageParameter ePageParameter)
        {
            StringBuilder strWhere = new StringBuilder();

            if (ePageParameter.planid > 0)
            {
                strWhere.AddWhere("T.PlanID=" + ePageParameter.planid + " ");
            }
            if (ePageParameter.areaid > 0)//区域
            {
                strWhere.AddWhere("T.AreaID=" + ePageParameter.areaid + " ");
            }
            if (ePageParameter.plantype > -1)//计划类别
            {
                strWhere.AddWhere("T.PlanTypeID=" + ePageParameter.plantype + " ");
            }
            if (ePageParameter.starttime != null)//检验开始时间
            {
                strWhere.AddWhere("InspectTime>=cast('" + ePageParameter.starttime.ToString() + "' as datetime) ");
            }
            if (ePageParameter.endtime != null)//送检结束时间
            {
                strWhere.AddWhere("InspectTime<=cast('" + ePageParameter.endtime.ToString() + "' as datetime) ");
            }
            if (!string.IsNullOrEmpty(ePageParameter.taskno))//任务单号
            {
                strWhere.AddWhere("T.TaskNo like '%" + ePageParameter.taskno.Trim() + "%' ");
            }
            if (ePageParameter.projectid > 0)//检验项目
            {
                strWhere.AddWhere("T.ProjectID=" + ePageParameter.projectid + " ");
            }
            if (!string.IsNullOrEmpty(ePageParameter.samplename))//样品名称
            {
                strWhere.AddWhere("C.name like '%" + ePageParameter.samplename + "%' ");
            }
            if (ePageParameter.status > 0)//样品名称
            {
                strWhere.AddWhere("T.Status =" + ePageParameter.status);
            }
            if (ePageParameter.headpersonnelid > 0) //实验计划主要负责人
            {
                strWhere.AddWhere("T.headpersonnelid=" + ePageParameter.headpersonnelid);
            }
            //添加数据权限判断
            switch (CurrentUserInfo.DataRange)
            {
            case 2:    //区域
                strWhere.AddWhere("T.AreaID=" + CurrentUserInfo.AreaID + " ");
                break;

            case 3:    //个人
                strWhere.AddWhere("T.EditPersonnelID=" + CurrentUserInfo.PersonnelID + " ");
                break;
            }

            DataTable dt         = new DataTable();
            int       total      = 0;
            int       startindex = ePageParameter.pageindex * ePageParameter.pagesize + 1;
            int       endindex   = (ePageParameter.pageindex + 1) * ePageParameter.pagesize;

            dt = tExpePlan.GetListByPage(strWhere.ToString(), "InspectTime desc", startindex, endindex, ref total).Tables[0];
            ePageParameter.count = total;
            return(dt);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 获取列表查询条件
        /// </summary>
        public string GetWhere(E_PageParameter ePageParameter)
        {
            string strWhere = "";

            if (ePageParameter.reportid > 0)
            {
                strWhere = PageTools.AddWhere(strWhere, "T.ReportID=" + ePageParameter.reportid);
            }
            if (ePageParameter.areaid > 0)
            {
                strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + ePageParameter.areaid);
            }
            if (ePageParameter.issuedtimestart != null)
            {
                strWhere = PageTools.AddWhere(strWhere, "T.IssuedTime>=cast('" + ePageParameter.issuedtimestart.ToString() + "' as datetime)");
            }
            if (ePageParameter.issuedtimeend != null)
            {
                strWhere = PageTools.AddWhere(strWhere, "T.IssuedTime<=cast('" + ePageParameter.issuedtimeend.ToString() + "' as datetime)");
            }
            if (!string.IsNullOrEmpty(ePageParameter.samplenum))
            {
                strWhere = PageTools.AddWhere(strWhere, "T.SampleNum like  '%" + ePageParameter.samplenum + "%'");
            }
            if (!string.IsNullOrEmpty(ePageParameter.samplename))
            {
                strWhere = PageTools.AddWhere(strWhere, "T.SampleName like  '%" + ePageParameter.samplename + "%'");
            }
            if (!string.IsNullOrEmpty(ePageParameter.department))
            {
                strWhere = PageTools.AddWhere(strWhere, "T.Department like  '%" + ePageParameter.department + "%'");
            }
            if (!string.IsNullOrEmpty(ePageParameter.maintestpersonne))
            {
                strWhere = PageTools.AddWhere(strWhere, "D.PersonnelName like '%" + ePageParameter.maintestpersonne + "%'");
            }
            if (ePageParameter.samplingtimestart != null)
            {
                strWhere = PageTools.AddWhere(strWhere, "SamplingTime>=cast('" + ePageParameter.samplingtimestart.ToString() + "' as datetime)");
            }
            if (ePageParameter.samplingtimeend != null)
            {
                strWhere = PageTools.AddWhere(strWhere, "SamplingTime<=cast('" + ePageParameter.samplingtimeend.ToString() + "' as datetime)");
            }
            if (ePageParameter.isexamine == 1) //已审核
            {
                strWhere = PageTools.AddWhere(strWhere, "T.examinePersonnelID>0");
            }
            else if (ePageParameter.isexamine == 2) //未审核
            {
                strWhere = PageTools.AddWhere(strWhere, "(T.examinePersonnelID is null or T.examinePersonnelID=0)");
            }
            if (ePageParameter.isapproval == 1) //已批准
            {
                strWhere = PageTools.AddWhere(strWhere, "T.ApprovalPersonnelID>0");
            }
            else if (ePageParameter.isapproval == 2) //未批准
            {
                strWhere = PageTools.AddWhere(strWhere, "(T.ApprovalPersonnelID is null or T.ApprovalPersonnelID=0)");
            }

            if (ePageParameter.expeplannopass > 0) //是否查询未完成的实验计划
            {
                strWhere = PageTools.AddWhere(strWhere, "(T.ApprovalPersonnelID is null or T.ApprovalPersonnelID=0 or T.examinePersonnelID is null or T.examinePersonnelID=0 or T.MainTestPersonnelID is null or T.MainTestPersonnelID=0)");
            }

            //添加数据权限判断
            switch (CurrentUserInfo.DataRange)
            {
            case 2:    //区域
                strWhere = PageTools.AddWhere(strWhere, "T.AreaID=" + CurrentUserInfo.AreaID + " ");
                break;

            case 3:    //个人
                strWhere = PageTools.AddWhere(strWhere, "T.EditPersonnelID=" + CurrentUserInfo.PersonnelID + " ");
                break;
            }

            //保密数据获取,只有设置保密的自己或者指定的审核人能看到对应的保密数据
            strWhere = PageTools.AddWhere(strWhere, $"(issecrecy=0 or secrecyexaminepid={CurrentUserInfo.PersonnelID} or setsecrecypid={CurrentUserInfo.PersonnelID})");

            return(strWhere);
        }