Esempio n. 1
0
        public object GetInfo([FromBody] JObject json)
        {
            try
            {
                string  res     = json.Value <string>("json");
                dynamic dy      = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  userId  = dy.userid;
                string  disid   = dy.data.disid;
                var     disBll  = new DistrictBLL();
                var     didBll  = new DataItemDetailBLL();
                var     deptBll = new DepartmentBLL();
                //获取用户基本信息
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator user    = OperatorProvider.Provider.Current();
                var      entity  = techdisclosurebll.GetEntity(disid);
                var      project = new OutsouringengineerBLL().GetEntity(entity.PROJECTID);
                if (project != null)
                {
                    if (!string.IsNullOrWhiteSpace(project.OUTPROJECTID))
                    {
                        var dept = new DepartmentBLL().GetEntity(project.OUTPROJECTID);
                        project.OUTPROJECTCODE = dept.EnCode;
                        project.OUTPROJECTNAME = dept.FullName;
                    }
                    //if (!string.IsNullOrWhiteSpace(project.ENGINEERAREA))
                    //{
                    //    var area = disBll.GetEntity(project.ENGINEERAREA);
                    //    if (area != null)
                    project.ENGINEERAREANAME = project.EngAreaName;
                    //}
                    if (!string.IsNullOrWhiteSpace(project.ENGINEERTYPE))
                    {
                        var listType = didBll.GetDataItem("ProjectType", project.ENGINEERTYPE).ToList();
                        if (listType != null && listType.Count > 0)
                        {
                            entity.ENGINEERTYPENAME = listType[0].ItemName;
                        }
                    }
                    if (!string.IsNullOrWhiteSpace(project.ENGINEERLEVEL))
                    {
                        var listLevel = didBll.GetDataItem("ProjectLevel", project.ENGINEERLEVEL).ToList();
                        if (listLevel != null && listLevel.Count > 0)
                        {
                            entity.ENGINEERLEVELNAME = listLevel[0].ItemName;
                        }
                    }
                }
                else
                {
                    var listLevel = didBll.GetDataItem("ProjectLevel", entity.ENGINEERLEVEL).ToList();
                    if (listLevel != null && listLevel.Count > 0)
                    {
                        entity.ENGINEERLEVELNAME = listLevel[0].ItemName;
                    }

                    var listType = didBll.GetDataItem("ProjectType", entity.ENGINEERTYPE).ToList();
                    if (listType != null && listType.Count > 0)
                    {
                        entity.ENGINEERTYPENAME = listType[0].ItemName;
                    }
                }
                var listmaj = didBll.GetDataItem("BelongMajor", entity.DISCLOSUREMAJOR).ToList();
                if (listmaj != null && listmaj.Count > 0)
                {
                    entity.DISCLOSUREMAJORNAME = listmaj[0].ItemName;
                }
                var    files  = new FileInfoBLL().GetFiles(disid);        //获取相关附件
                var    pics   = new FileInfoBLL().GetFiles(disid + "01"); //获取相关附件
                string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl");
                foreach (DataRow dr in files.Rows)
                {
                    dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/");
                }
                foreach (DataRow dr in pics.Rows)
                {
                    dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/");
                }
                List <AptitudeinvestigateauditEntity> AptitudeList = aptitudeinvestigateauditbll.GetAuditList(entity.ID);
                for (int i = 0; i < AptitudeList.Count; i++)
                {
                    if (string.IsNullOrWhiteSpace(AptitudeList[i].AUDITSIGNIMG))
                    {
                        AptitudeList[i].AUDITSIGNIMG = string.Empty;
                    }
                    else
                    {
                        AptitudeList[i].AUDITSIGNIMG = webUrl + AptitudeList[i].AUDITSIGNIMG.ToString().Replace("../../", "/").ToString();
                    }
                }
                //查询审核流程图
                List <CheckFlowData> nodeList = new AptitudeinvestigateinfoBLL().GetAppFlowList(entity.ID, "13", curUser);
                var data = new
                {
                    AuditInfo = AptitudeList,
                    nodeList  = nodeList,
                    project   = project,
                    entity    = entity,
                    piclist   = pics,
                    filelist  = files
                };
                Dictionary <string, string> dict_props = new Dictionary <string, string>();
                //Id 转换前的列名  keyvalue 转换后的列名
                //dict_props.Add("Id", "keyvalue");

                JsonSerializerSettings settings = new JsonSerializerSettings
                {
                    ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换
                    DateFormatString = "yyyy-MM-dd HH:mm",                        //格式化日期
                    //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现
                };
                return(new { code = 0, info = "获取数据成功", count = 1, data = JObject.Parse(JsonConvert.SerializeObject(data, Formatting.None, settings)) });
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = ex.Message });
            }
        }
Esempio n. 2
0
        public object GetEngineerDetails([FromBody] JObject json)
        {
            string  res    = json.Value <string>("json");
            dynamic dy     = JsonConvert.DeserializeObject <ExpandoObject>(res);
            string  userid = dy.userid;

            //获取用户基本信息
            OperatorProvider.AppUserId = userid;  //设置当前用户
            Operator curUser = OperatorProvider.Provider.Current();

            if (null == curUser)
            {
                return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() });
            }
            try
            {
                string id      = dy.data ?? "";
                var    disBll  = new DistrictBLL();
                var    didBll  = new DataItemDetailBLL();
                var    deptBll = new DepartmentBLL();
                var    data    = outsouringengineerbll.GetEntity(id);
                if (!string.IsNullOrWhiteSpace(data.ENGINEERAREA))
                {
                    var area = disBll.GetEntity(data.ENGINEERAREA);
                    if (area != null)
                    {
                        data.ENGINEERAREANAME = area.DistrictName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.ENGINEERTYPE))
                {
                    var listType = didBll.GetDataItem("ProjectType", data.ENGINEERTYPE).ToList();
                    if (listType != null && listType.Count > 0)
                    {
                        data.ENGINEERTYPENAME = listType[0].ItemName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.ENGINEERLEVEL))
                {
                    var listLevel = didBll.GetDataItem("ProjectLevel", data.ENGINEERLEVEL).ToList();
                    if (listLevel != null && listLevel.Count > 0)
                    {
                        data.ENGINEERLEVELNAME = listLevel[0].ItemName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(data.OUTPROJECTID))
                {
                    var dept = deptbll.GetEntity(data.OUTPROJECTID);
                    data.OUTPROJECTCODE = dept.EnCode;
                    data.OUTPROJECTNAME = dept.FullName;
                }
                //return Json(new
                //{
                //    code = 0,
                //    info = "获取数据成功",
                //    count = 0,
                //    data = data
                //}, new JsonSerializerSettings() { DateFormatString = "yyyy-MM-dd HH:mm:ss" });

                JsonSerializerSettings settings = new JsonSerializerSettings
                {
                    //ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换
                    DateFormatString = "yyyy-MM-dd HH:mm:ss", //格式化日期
                    //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现
                };
                return(new { code = 0, info = "获取数据成功", count = 1, data = JObject.Parse(JsonConvert.SerializeObject(data, Formatting.None, settings)) });
                //return new
                //{
                //    code = 0,
                //    info = "获取数据成功",
                //    count = 0,
                //    data = data
                //};
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = "获取失败,错误:" + ex.Message, data = new object() });
            }
        }
Esempio n. 3
0
        public object GetInfo([FromBody] JObject json)
        {
            try
            {
                string  res     = json.Value <string>("json");
                dynamic dy      = JsonConvert.DeserializeObject <ExpandoObject>(res);
                string  userId  = dy.userid;
                string  disid   = dy.data.disid;
                var     disBll  = new DistrictBLL();
                var     didBll  = new DataItemDetailBLL();
                var     deptBll = new DepartmentBLL();
                //获取用户基本信息
                OperatorProvider.AppUserId = userId;  //设置当前用户
                Operator user    = OperatorProvider.Provider.Current();
                var      entity  = techdisclosurebll.GetEntity(disid);
                var      project = new OutsouringengineerBLL().GetEntity(entity.PROJECTID);
                if (!string.IsNullOrWhiteSpace(project.OUTPROJECTID))
                {
                    var dept = new DepartmentBLL().GetEntity(project.OUTPROJECTID);
                    project.OUTPROJECTCODE = dept.EnCode;
                    project.OUTPROJECTNAME = dept.FullName;
                }
                if (!string.IsNullOrWhiteSpace(project.ENGINEERAREA))
                {
                    var area = disBll.GetEntity(project.ENGINEERAREA);
                    if (area != null)
                    {
                        project.ENGINEERAREANAME = area.DistrictName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(project.ENGINEERTYPE))
                {
                    var listType = didBll.GetDataItem("ProjectType", project.ENGINEERTYPE).ToList();
                    if (listType != null && listType.Count > 0)
                    {
                        project.ENGINEERTYPENAME = listType[0].ItemName;
                    }
                }
                if (!string.IsNullOrWhiteSpace(project.ENGINEERLEVEL))
                {
                    var listLevel = didBll.GetDataItem("ProjectLevel", project.ENGINEERLEVEL).ToList();
                    if (listLevel != null && listLevel.Count > 0)
                    {
                        project.ENGINEERLEVELNAME = listLevel[0].ItemName;
                    }
                }
                var    files  = new FileInfoBLL().GetFiles(disid);        //获取相关附件
                var    pics   = new FileInfoBLL().GetFiles(disid + "01"); //获取相关附件
                string webUrl = new DataItemDetailBLL().GetItemValue("imgUrl");
                foreach (DataRow dr in files.Rows)
                {
                    dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/");
                }
                foreach (DataRow dr in pics.Rows)
                {
                    dr["filepath"] = dr["filepath"].ToString().Replace("~/", webUrl + "/");
                }

                var data = new
                {
                    project  = project,
                    entity   = entity,
                    piclist  = pics,
                    filelist = files
                };
                Dictionary <string, string> dict_props = new Dictionary <string, string>();
                //Id 转换前的列名  keyvalue 转换后的列名
                //dict_props.Add("Id", "keyvalue");

                JsonSerializerSettings settings = new JsonSerializerSettings
                {
                    ContractResolver = new LowercaseContractResolver(dict_props), //转小写,并对指定的列进行自定义名进行更换
                    DateFormatString = "yyyy-MM-dd HH:mm",                        //格式化日期
                    //NullValueHandling = NullValueHandling.Ignore 值为空则在JSON中体现
                };
                return(new { code = 0, info = "获取数据成功", count = 1, data = JObject.Parse(JsonConvert.SerializeObject(data, Formatting.None, settings)) });
            }
            catch (Exception ex)
            {
                return(new { code = -1, count = 0, info = ex.Message });
            }
        }