Example #1
0
        //获取拼装信息
        public static string GetAssembleInfo(int[] id)
        {
            string              save = ConfigurationSettings.AppSettings["Savepath"];
            string              resp = ConfigurationSettings.AppSettings["Returnpath"];
            Assembles           assemble = new Assembles();
            List <AssembleInfo> info = new List <AssembleInfo>();
            List <Assembles>    semble = new List <Assembles>();
            int       buildingWallId = 0;
            int       adjustImg = 0;
            int       reslutImg = 0;
            string    Response = "";
            string    path, path2;
            WebClient download = new WebClient();

            for (int i = 0; i < id.Length; i++)
            {
                //Response = Sender.Get("http://dev.strosoft.com:6090/BSS/api/Service?service_name=GetBuildingWallImageList&data={adjustedImageFileId:"+id[i]+"}");
                //JObject jResult = JObject.Parse(Response);
                //JObject jData = (JObject)jResult["data"];
                //id[i]= (int)jResult["data"]["dataList"][0]["id"];
                int[] ids = { id[i] };
                Response = Sender.Get("http://dev.strosoft.com:6090/BSS/api/Service?service_name=GetBuildingWallImage&data={id:" + id[i] + "}");
                //Response = "{ \"success\":true,\"data\":{ \"adjustedImageFileId\":1879,\"areaBottomLeftX\":\"\",\"areaBottomLeftY\":\"\",\"areaBottomRightX\":\"\",\"areaBottomRightY\":\"\",\"areaTopLeftX\":\"\",\"areaTopLeftY\":\"\",\"areaTopRightX\":\"\",\"areaTopRightY\":\"\",\"buildingWallId\":69,\"createTime\":{ \"date\":30,\"day\":4,\"hours\":10,\"minutes\":11,\"month\":4,\"nanos\":0,\"seconds\":11,\"time\":1559182271000,\"timezoneOffset\":-480,\"year\":119},\"description\":\"234\",\"height\":96,\"id\":1,\"name\":\"信息楼\",\"originalImageFileId\":491,\"positionX\":99,\"positionY\":98,\"resultImageFileId\":69,\"selectedImageFileId\":\"\",\"sysUserId\":139,\"width\":97},\"adminRootUrl\":\"http://localhost:8080/BSS/\"}";
                JObject jResult = JObject.Parse(Response);
                JObject jData   = (JObject)jResult["data"];
                buildingWallId = (int)jResult["data"]["buildingWallId"];
                adjustImg      = (int)jResult["data"]["adjustedImageFileId"];
                reslutImg      = (int)jResult["data"]["resultImageFileId"];
                AssembleInfo result = jData.ToObject <AssembleInfo>();
                Response = Sender.Get("http://dev.strosoft.com:6090/BSS/api/Service?service_name=GetTable&data={TableName:\"sys_upload_file\",Condition:\"id =" + adjustImg + "\"}");
                jResult  = JObject.Parse(Response);
                path     = "http://dev.strosoft.com:6090/BSS/" + (string)jResult["data"][0]["path"];
                Response = Sender.Get("http://dev.strosoft.com:6090/BSS/api/Service?service_name=GetTable&data={TableName:\"sys_upload_file\",Condition:\"id =" + reslutImg + "\"}");
                jResult  = JObject.Parse(Response);
                path2    = "http://dev.strosoft.com:6090/BSS/" + (string)jResult["data"][0]["path"];
                string time = DateTime.Now.ToString("yyyyMMddhhmmssff") + ".jpg";
                download.DownloadFile(path, save + time);
                result.adjustImg = resp + time;
                time             = DateTime.Now.ToString("yyyyMMddhhmmssff") + ".jpg";
                download.DownloadFile(path2, save + time);
                result.resultImg = resp + time;
                string getblock = GetBuildingImgInfo(ids);
                JArray array    = JArray.Parse(getblock);
                JArray jarray   = (JArray)array[0]["ImgInfo"];
                result.ImgInfo    = jarray.ToObject <List <BuildingWallBlock> >();
                jarray            = (JArray)array[0]["blockvalue"];
                result.blockvalue = jarray.ToObject <List <GetBlockValue> >();
                info.Add(result);
            }
            assemble.AssembleInfos = info;
            Response = Sender.Get("http://dev.strosoft.com:6090/BSS/api/Service?service_name=GetBuildingWall&data={id:" + buildingWallId + "}");
            string code = (string)JObject.Parse(Response)["data"]["wallTogetherCode"];

            code = code.Replace(" ", "+");
            assemble.wall_together_code = Encoding.UTF8.GetString(Convert.FromBase64String(code));
            string js = JsonConvert.SerializeObject(assemble);

            Console.WriteLine(js);
            return(js);
        }
Example #2
0
 public SecurityOptions(AssembleInfo info)
 {
     Info              = info;
     UserIdVbName      = string.IsNullOrEmpty(AssembleInfo.Configuration("security_UID_varname_VB")) ? "Session(\"qp_UID\")" : AssembleInfo.Configuration("security_UID_varname_VB");
     GroupIdVbName     = string.IsNullOrEmpty(AssembleInfo.Configuration("security_GID_varname_VB")) ? "Session(\"qp_GID\")" : AssembleInfo.Configuration("security_GID_varname_VB");
     UserIdCSharpName  = string.IsNullOrEmpty(AssembleInfo.Configuration("security_UID_varname_CSharp")) ? "Session[\"qp_UID\"]" : AssembleInfo.Configuration("security_UID_varname_CSharp");
     GroupIdCSharpName = string.IsNullOrEmpty(AssembleInfo.Configuration("security_GID_varname_CSharp")) ? "Session[\"qp_GID\"]" : AssembleInfo.Configuration("security_GID_varname_CSharp");
 }
Example #3
0
        //立面拼装信息
        public static int UpdateBuidlingAssemble(AssembleInfo info)
        {
            string data     = JsonConvert.SerializeObject(info);
            string Response = Sender.Post("http://dev.strosoft.com:6090/BSS/api/Service?service_name=UpdateBuildingWallImage&data=" + data, "");

            Response = Sender.Get("http://dev.strosoft.com:6090/BSS/api/Service?service_name=GetBuildingWallImage&data={id:" + info.id + "}");
            JObject jResult        = JObject.Parse(Response);
            int     buildingWallId = (int)jResult["data"]["buildingWallId"];

            return(buildingWallId);
        }
Example #4
0
 public void FillController(int formatId, AssembleMode mode, string sqlQuery, DataTable data)
 {
     FormatId            = formatId;
     CurrentAssembleMode = mode;
     if (data != null)
     {
         Info = new AssembleInfo(this, data);
     }
     else if (!string.IsNullOrEmpty(sqlQuery))
     {
         Info = new AssembleInfo(this, sqlQuery);
     }
 }
Example #5
0
 public void FillController(int templateId, string sqlQuery, DataTable data)
 {
     CurrentAssembleMode = AssembleMode.AllTemplateObjects;
     TemplateId          = templateId;
     if (data != null)
     {
         Info = new AssembleInfo(this, data);
     }
     else if (!string.IsNullOrEmpty(sqlQuery))
     {
         Info = new AssembleInfo(this, sqlQuery);
     }
 }
 private void FillController(int pageId, DataTable data, bool firstInBatch)
 {
     FirstInBatch        = firstInBatch;
     CurrentAssembleMode = AssembleMode.Page;
     PageId = pageId;
     if (data != null)
     {
         Info = new AssembleInfo(this, data);
     }
     else
     {
         var sqlQuery = "select p.*, pt.*, s.* " + Renames + " from page p inner join page_template pt on p.page_template_id = pt.page_template_id inner join site s on pt.site_id = s.site_id where page_id=" + pageId;
         Info = new AssembleInfo(this, sqlQuery);
     }
 }
Example #7
0
        public AssembleSelectedObjectsController(string ids, string connectionParameter)
            : base(connectionParameter, DatabaseType.SqlServer)
        {
            Ids = ids;
            CurrentAssembleMode = AssembleMode.SelectedObjects;
            var sqlQuery =
                " SELECT pt.*, s.*, p.* " + Renames +
                " from object obj " +
                " INNER JOIN page_template AS pt ON pt.page_template_id=obj.page_template_id" +
                " LEFT JOIN page AS p ON p.page_id=obj.page_id" +
                " INNER JOIN site AS s ON pt.site_id = s.site_id" +
                " where obj.object_id in ( " + Ids + ")";

            Info = new AssembleInfo(this, sqlQuery);
        }
    // @For Bomb Item
    public void MakeItem(AssembleInfo info)
    {
        foreach (int index in info.index_list)
        {
            Block block = FindSpareBlock();
            if (block == null)
            {
                return;
            }

            mBlockMap[index]         = block;
            block.transform.position = Utils.IndexToPos(index);
            block.Revive();
            return;
        }
    }
        /// <summary>
        /// 构造转换动态方法(核心代码),根据assembly可处理datarow和datareader两种转换
        /// </summary>
        /// <typeparam name="T">返回的实体类型</typeparam>
        /// <param name="assembly">待转换数据的元数据信息</param>
        /// <returns>实体对象</returns>
        private static DynamicMethod BuildMethod <T>(AssembleInfo assembly, MapColumn[] mapColumns = null, string methodName = "")
        {
            if (methodName == null)
            {
                methodName = "";
            }
            DynamicMethod method = new DynamicMethod(methodName + assembly.MethodName + typeof(T).Name, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(T),
                                                     new Type[] { assembly.SourceType }, typeof(EntityContext).Module, true);
            ILGenerator  generator = method.GetILGenerator();
            LocalBuilder result    = generator.DeclareLocal(typeof(T));

            generator.Emit(OpCodes.Newobj, typeof(T).GetConstructor(Type.EmptyTypes));
            generator.Emit(OpCodes.Stloc, result);
            foreach (var column in  mapColumns)
            {
                PropertyInfo property   = column.Property;
                var          endIfLabel = generator.DefineLabel();
                generator.Emit(OpCodes.Ldarg_0);
                //第一组,调用AssembleInfo的CanSetted方法,判断是否可以转换
                generator.Emit(OpCodes.Ldstr, column.ColumnName);
                generator.Emit(OpCodes.Call, assembly.CanSettedMethod);
                generator.Emit(OpCodes.Brfalse, endIfLabel);
                generator.Emit(OpCodes.Ldloc, result);
                generator.Emit(OpCodes.Ldarg_0);

                //第二组,属性设置
                generator.Emit(OpCodes.Ldstr, column.ColumnName);
                generator.Emit(OpCodes.Call, assembly.GetValueMethod);//获取数据库值
                if (property.PropertyType.IsValueType || property.PropertyType == typeof(string))
                {
                    var cur = Nullable.GetUnderlyingType(property.PropertyType);
                    generator.Emit(OpCodes.Call, ConvertMethods[cur == null ? property.PropertyType : cur]);//调用强转方法赋值
                }
                //效果类似  Name=Convert.ToString(row["PName"]);
                else
                {
                    generator.Emit(OpCodes.Castclass, property.PropertyType);
                }
                generator.Emit(OpCodes.Call, property.GetSetMethod());//直接给属性赋值
                //效果类似  Name=row["PName"];
                generator.MarkLabel(endIfLabel);
            }
            generator.Emit(OpCodes.Ldloc, result);
            generator.Emit(OpCodes.Ret);
            return(method);
        }
Example #10
0
 public CodeTransformer(AssembleInfo info)
 {
     Info = info;
 }
Example #11
0
 public AssembleSelectedObjectsController(string ids, DataTable data)
 {
     Ids = ids;
     CurrentAssembleMode = AssembleMode.SelectedObjects;
     Info = new AssembleInfo(this, data);
 }