Ejemplo n.º 1
0
        public ActionResult SaveForm(string ID, string DistrictId, string PostList, string ModelIds)
        {
            DistrictBLL        disbll = new DistrictBLL();
            var                dis    = disbll.GetEntity(DistrictId);
            ArealocationEntity Area   = new ArealocationEntity();

            Area.AreaCode     = dis.DistrictCode;
            Area.AreaId       = DistrictId;
            Area.AreaName     = dis.DistrictName;
            Area.AreaParentId = dis.ParentID;
            if (ID == "")
            {
                Area.Create();
            }
            else
            {
                Area.Modify(ID);
            }
            Area.AreaParentId = dis.ParentID;
            Area.PointList    = PostList;
            Area.ModelIds     = ModelIds;
            arealocationbll.SaveForm(ID, Area);

            KbsAreaLocation ka = new KbsAreaLocation();

            ka.DistrictCode = Area.AreaCode;
            ka.DistrictID   = Area.AreaId;
            ka.DistrictName = Area.AreaName;
            ka.ID           = Area.ID;
            ka.ModelIds     = Area.ModelIds;
            ka.OrganizeId   = dis.OrganizeId;
            ka.ParentID     = Area.AreaParentId;
            ka.PointList    = Area.PointList;
            ka.SortCode     = dis.SortCode;
            SendData sd = new SendData();

            if (ID == "")
            {
                sd.DataName = "AddArea";
            }
            else
            {
                sd.DataName = "UpdateArea";
            }
            sd.EntityString = JsonConvert.SerializeObject(ka);

            //将新绑定的标签信息同步到后台计算服务中
            RabbitMQHelper rh = RabbitMQHelper.CreateInstance();

            rh.SendMessage(JsonConvert.SerializeObject(sd));
            return(Success("操作成功。"));
        }
Ejemplo n.º 2
0
        public ActionResult GetDistric(string id)
        {
            var data = bis_districtbll.GetEntity(id);

            return(Content(data.ToJson()));
        }
Ejemplo n.º 3
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() });
            }
        }
Ejemplo n.º 4
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 });
            }
        }