ArrayState

We found 10 examples in language CSharp for this search. You will see 50 fragments of code.

Other methods

        public static void arrayMove(GlobalInterpreterState globalState, LocalInterpreterState localState, int delta) {
            globalState.arrayState.index += delta;
            localState.instructionPointer++;
        }

        public static void arrayRemove(GlobalInterpreterState globalState, LocalInterpreterState localState, out bool success) {
            if (globalState.arrayState == null || !globalState.arrayState.isIndexValid) {
                success = false;
                return;
            }

            globalState.arrayState.array.removeAt(globalState.arrayState.index);

            localState.instructionPointer++;

            success = true;
        }

        // /param array is the index of the array (currently ignored)
        public static void valid(GlobalInterpreterState globalState, LocalInterpreterState localState, int array, out bool success) {
            if (globalState.arrayState == null) {
                success = false;
                return;
            }

            localState.comparisionFlag = globalState.arrayState.isIndexValid;

            localState.instructionPointer++;
            success = true;
        }

        public static void read(GlobalInterpreterState globalState, LocalInterpreterState localState, int array, int register, out bool success) {
            if (globalState.arrayState == null || !globalState.arrayState.isIndexValid) {
                success = false;
                return;
            }

            localState.registers[register] = globalState.arrayState.array[globalState.arrayState.index];

            localState.instructionPointer++;
            success = true;
        }

        public static void idx2Reg(GlobalInterpreterState globalState, LocalInterpreterState localState, int array, int register, out bool success) {
            if (globalState.arrayState == null) {
                success = false;
                return;
            }

            localState.registers[register] = globalState.arrayState.index;

            localState.instructionPointer++;
            success = true;
        }

        public static void reg2idx(GlobalInterpreterState globalState, LocalInterpreterState localState, int register, int array, out bool success) {
            if (globalState.arrayState == null) {
                success = false;
                return;
            }

            globalState.arrayState.index = localState.registers[register];

            localState.instructionPointer++;
            success = true;
        }


        private static bool hasState(int currState,ArrayState state)
        {
            return (currState & (int)state) > 0;
        }


        #endregion

        #region Default implementations of overridden

        public override bool SuggestAnalysisSpecificPostconditions(
          ContractInferenceManager inferenceManager, 
          IFixpointInfo<APC, ArrayState> fixpointInfo, 
          List<BoxedExpression> postconditions)
        {
          return false;
        }

        public override bool TrySuggestPostconditionForOutParameters(
          IFixpointInfo<APC, ArrayState> fixpointInfo, List<BoxedExpression> postconditions, Variable p, FList<PathElement> path)
        {
          return false;
        }
  
        #endregion

        #region Visitors
        public override sealed ArrayState GetTopValue()
        {
          throw new NotSupportedException();
        }

        public override ArrayState Arglist(APC pc, Variable dest, ArrayState data)
        {
          return data;
        }

        public override ArrayState Assert(APC pc, string tag, Variable condition, object provenance, ArrayState data)
        {
          return Assume(pc, "assert", condition, provenance, data);
        }

        public override ArrayState Assume(APC pc, string tag, Variable source, object provenance, ArrayState data)
        {
          return data;
        }


        /// <returns>
        /// It should return the renamed *substate* not the whole one
        /// </returns>
        abstract public IAbstractDomainForEnvironments<BoxedVariable<Variable>, BoxedExpression> AssignInParallel
          (Dictionary<BoxedVariable<Variable>, FList<BoxedVariable<Variable>>> refinedMap,
          Converter<BoxedVariable<Variable>, BoxedExpression> convert,
          List<Pair<NormalizedExpression<BoxedVariable<Variable>>, NormalizedExpression<BoxedVariable<Variable>>>> equalities,
          ArrayState state);

        #endregion

        #region Default implementations of overridden

        public override bool SuggestAnalysisSpecificPostconditions(
          ContractInferenceManager inferenceManager, 
          IFixpointInfo<APC, ArrayState> fixpointInfo, 
          List<BoxedExpression> postconditions)
        {
          return false;
        }

        public override bool TrySuggestPostconditionForOutParameters(
          IFixpointInfo<APC, ArrayState> fixpointInfo, List<BoxedExpression> postconditions, Variable p, FList<PathElement> path)
        {
          return false;
        }
        
        #endregion

        #region Materialize Enumerble

        protected ArraySegmentation<Elements, BoxedVariable<Variable>, BoxedExpression> MaterializeEnumerable<Elements>(
          APC postPC, ArraySegmentationEnvironment<Elements, BoxedVariable<Variable>, BoxedExpression> preState,
          Variable enumerable, Elements initialValue)
                 where Elements : class, IAbstractDomainForArraySegmentationAbstraction<Elements, BoxedVariable<Variable>>
        {
          Variable modelArray;
          if (this.Context.ValueContext.TryGetModelArray(postPC, enumerable, out modelArray))
          {
            MaterializeArray(postPC, preState, (BoxedExpression be) => CheckOutcome.True, modelArray, initialValue, initialValue);
          }

          return null;
        }
   
        #endregion

        #region Materialize Array
        protected  ArraySegmentation<Elements, BoxedVariable<Variable>, BoxedExpression> MaterializeArray<Elements>(
          APC postPC, ArraySegmentationEnvironment<Elements, BoxedVariable<Variable>, BoxedExpression> preState, 
          Func<BoxedExpression, FlatAbstractDomain<bool>> CheckIfNonZero, Variable arrayValue, Elements initialValue, Elements bottom)
                 where Elements : class, IAbstractDomainForArraySegmentationAbstraction<Elements, BoxedVariable<Variable>>
        {
          Contract.Requires(preState != null);
          Contract.Requires(initialValue != null);

          var boxSym = new BoxedVariable<Variable>(arrayValue);

          ArraySegmentation<Elements, BoxedVariable<Variable>, BoxedExpression> arraySegment;
          if (preState.TryGetValue(boxSym, out arraySegment))
          {
            return arraySegment; // already materialized
          }

          Variable array_Length;
          if (this.Context.ValueContext.TryGetArrayLength(postPC, arrayValue, out array_Length))
          {
            var isNonEmpty = CheckIfNonZero(this.ToBoxedExpression(postPC, array_Length)).IsTrue();

            var limits = new NonNullList<SegmentLimit<BoxedVariable<Variable>>>() 
                { 
                  new SegmentLimit<BoxedVariable<Variable>>(NormalizedExpression<BoxedVariable<Variable>>.For(0), false),                     // { 0 }
                  new SegmentLimit<BoxedVariable<Variable>>(NormalizedExpression<BoxedVariable<Variable>>.For(new BoxedVariable<Variable>(array_Length)), !isNonEmpty) // { symb.Length }
                };

            var elements = new NonNullList<Elements>() { initialValue };

            var newSegment = new ArraySegmentation<Elements, BoxedVariable<Variable>, BoxedExpression>(
              limits, elements,
              bottom,
              this.ExpressionManager);

            preState.AddElement(new BoxedVariable<Variable>(arrayValue), newSegment);

            return newSegment;
          }

          return null;
        }
 
        #endregion

        #region Array loop counter initialization

        protected ArraySegmentationEnvironment<AbstractDomain, BoxedVariable<Variable>, BoxedExpression> 
          ArrayCounterInitialization<AbstractDomain>(APC pc, Local local, 
          Variable source, ArrayState resultState,  ArraySegmentationEnvironment<AbstractDomain, BoxedVariable<Variable>, BoxedExpression> mySubState)
          where AbstractDomain : class, IAbstractDomainForArraySegmentationAbstraction<AbstractDomain, BoxedVariable<Variable>>
        {
          Contract.Ensures(Contract.Result<ArraySegmentationEnvironment<AbstractDomain, BoxedVariable<Variable>, BoxedExpression>>() != null);

          var sourceExp = ToBoxedExpression(pc, source);

          // we look for loop initializations i == var
          Variable localValue;
          if (sourceExp.IsVariable
            &&
            this.Context.ValueContext.TryLocalValue(this.Context.MethodContext.CFG.Post(pc), local, out localValue))
          {
            // If source >= 0, we check if source <= arr.Length, for some array 'arr'
            // If this is the case, then we can try to refine the segmentation including source and locValue
            if (resultState.Numerical.CheckIfGreaterEqualThanZero(sourceExp).IsTrue())
            {
              var sourceNorm = ToNormalizedExpression(source);

              var toUpdate = new Dictionary<BoxedVariable<Variable>, ArraySegmentation<AbstractDomain, BoxedVariable<Variable>, BoxedExpression>>();

              foreach (var pair in mySubState.Elements)
              {
                if (!pair.Value.IsEmptyArray && pair.Value.IsNormal
                  &&
                  // We do the trick only for arrays {0} val {Len} as otherwise we should be more careful where we refine the segmentation, as for instance the update below may be too rough. However, I haven't find any interesting non-artificial example for it
                   pair.Value.Elements.Count() == 1)
                {
                  foreach (var limit in pair.Value.LastLimit)
                  {
                    if (resultState.Numerical.CheckIfLessEqualThan(sourceExp, limit.Convert(this.Encoder)).IsTrue())
                    {
                      IAbstractDomain abstractValue;
                      if (pair.Value.TryGetAbstractValue(
                        NormalizedExpression<BoxedVariable<Variable>>.For(0), sourceNorm,
                        resultState.Numerical,
                        out abstractValue)
                        &&
                        abstractValue is AbstractDomain)
                      {
                        ArraySegmentation<AbstractDomain, BoxedVariable<Variable>, BoxedExpression> newSegment;
                        if (pair.Value.TrySetAbstractValue(sourceNorm, (AbstractDomain) abstractValue, resultState.Numerical,
                          out newSegment))
                        {
                          toUpdate.Add(pair.Key, newSegment);
                          break; // We've already updated this segmentation
                        }
                      }
                    }
                  }
                }
              }
              foreach (var pair in toUpdate)
              {
                mySubState[pair.Key] = pair.Value;
              }
            }
          }
          return mySubState;
        }


        public async Task<long> AddAsync(T value)
        {
            long newLength = this.arrayState.State.Length++;
            await GetItemReference(newLength).Set((T)value);

            return newLength;
        }

        public async Task<T> GetAsync(long index)
        {
            return await GetItemReference(index).Get();
        }

        public async Task<long> CountAsync()
        {
            return await Task.FromResult(this.arrayState.State.Length);
        }

        private IArrayItemGrain<T> GetItemReference(long index)
        {
            return GrainFactory.GetGrain<IArrayItemGrain<T>>(index, this.GetPrimaryKeyString());
        }

        #endregion

        #region Select and MakeState
        [Pure]
        public EnumDefined<BoxedVariable<Variable>, Type, BoxedExpression>  Select(ArrayState state)
        {
          Contract.Requires(state != null);
          Contract.Requires(this.Id < state.PluginsCount);

          Contract.Ensures(Contract.Result<EnumDefined<BoxedVariable<Variable>, Type, BoxedExpression>>() != null);

          var untyped = state.PluginAbstractStateAt(this.Id);
          var selected = untyped as EnumDefined<BoxedVariable<Variable>, Type, BoxedExpression>;

          Contract.Assume(selected != null);

          return selected;
        }

        public ArrayState MakeState(EnumDefined<BoxedVariable<Variable>, Type, BoxedExpression> newSubState, ArrayState oldState)
        {
          return oldState.UpdatePluginAt(this.Id, newSubState);
        }

        #endregion

        #region Transfer functions --- just wrappers for the standalone enum analysis

        public override ArrayState Entry(APC pc, Method method, ArrayState data)
        {
          return MakeState(this.enumAnalysis.Entry(pc, method, Select(data)), data);
        }

        public override ArrayState Assume(APC pc, string tag, Variable source, object provenance, ArrayState data)
        {
          var newData = data;
          var newSubState = this.enumAnalysis.Assume(pc, tag, source, provenance, Select(data));

          // At this point, we may know more on enums, so let's push them to the numerical domain

          if (newSubState.IsNormal())
          {
            var mdDecoder = this.DecoderForMetaData;
            var numericalDomain = data.Numerical;
            foreach (var pair in newSubState.DefinedVariables)
            {
              List<int> typeValues;
              // TODO: We may be smarted, and avoid recomputing the enum values if we already saw the type
              var type = pair.One;
              if (mdDecoder.IsEnumWithoutFlagAttribute(type) && mdDecoder.TryGetEnumValues(type, out typeValues))
              {
                // Assume the variable is in the enum
                numericalDomain.AssumeInDisInterval(pair.Two, DisInterval.For(typeValues)); 
              }
            }

            newData = newData.UpdateNumerical(numericalDomain);
          }

          return MakeState(newSubState, newData);
        }

        public override ArrayState Assert(APC pc, string tag, Variable condition, object provenance, ArrayState data)
        {
          return MakeState(this.enumAnalysis.Assert(pc, tag, condition, provenance, Select(data)), data);
        }

        public override ArrayState Call<TypeList, ArgList>(APC pc, Method method, bool tail, bool virt, TypeList extraVarargs, Variable dest, ArgList args, ArrayState data)
        {
          return MakeState(this.enumAnalysis.Call<TypeList, ArgList>(pc, method, tail, virt, extraVarargs, dest, args, Select(data)), data);
        }


    /// <summary>
    /// Entry point to run the Arrays analysis
    /// </summary>
    public static IMethodResult<Variable> RunArraysAnalysis<Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, NumericalOptions>
    (
      string methodName,
      IMethodDriver<Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver,
      Analyzers.Arrays.ArrayOptions options,
      List<NumericalOptions> numericaloptions,
      Analyzers.NonNull nonnull,
      bool isEnumAnalysisSelected,
      Predicate<APC> cachePCs, DFAController controller
    )
      where Variable : IEquatable<Variable>
      where Expression : IEquatable<Expression>
      where Type : IEquatable<Type>
      where NumericalOptions : Analyzers.ValueAnalysisOptions<NumericalOptions>
    {
      var numericalAnalysis =
        new TypeBindings<Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>.
          NumericalAnalysis<NumericalOptions>(methodName, driver, numericaloptions, cachePCs, controller);

      var nonnullAnalysis =
        nonnull != null ?
          new Analyzers.NonNull.TypeBindings<Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>.
            AnalysisForArrays(driver, nonnull, cachePCs)
        : null;

      var arrayAnalysis = 
        new TypeBindings<Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>.
          ArrayAnalysisPlugIn(methodName, driver, options.LogOptions, cachePCs);

      var analysis =
       new TypeBindings<Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>.
         ArrayAnalysis<Analyzers.Arrays.ArrayOptions, NumericalOptions>(methodName, arrayAnalysis, numericalAnalysis, nonnullAnalysis, isEnumAnalysisSelected, driver, options, cachePCs);

      return TypeBindings<Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>.RunTheAnalysis(methodName, driver, analysis, controller);
    }
        #region Object Invariant
        [ContractInvariantMethod]
        void ObjectInvariant()
        {
          Contract.Invariant(AnalysisDependencies != null);
          Contract.Invariant(this.numericalAnalysis != null);
          Contract.Invariant(this.arrayAnalysis != null);
          Contract.Invariant(this.analysisMapping != null);
          Contract.Invariant(this.additionalAnalyses != null);
          Contract.Invariant(this.pluginCount >= 0);
        }

        // Made pluginCount an out parameter so that we can be sure that we assign it only in the constructor
        private List<GenericPlugInAnalysisForComposedAnalysis> SetUpAdditionalAnalyses(out int pluginCount, bool isEnumAnalysisSelected, Predicate<APC> cachePCs)
        {
          Contract.Ensures(Contract.Result<List<GenericPlugInAnalysisForComposedAnalysis>>() != null);

          pluginCount = 0;
          var result = new List<GenericPlugInAnalysisForComposedAnalysis>();

          // Here we add all the selected plugin analyses

          this.AddAnalysisAndDependencies(
            new RuntimeTypesPlugIn(pluginCount, this.MethodName, this.MethodDriver, this.Options.LogOptions, cachePCs),
            result, cachePCs, ref pluginCount);

          if (isEnumAnalysisSelected)
          {
            var enumAnalysis = new EnumAnalysis(this.MethodName, this.MethodDriver, new Analyzers.Enum.Options(this.Options.LogOptions), cachePCs);

            this.AddAnalysisAndDependencies(
              new EnumAnalysisWrapperPlugIn(enumAnalysis, pluginCount, this.MethodName, this.MethodDriver, this.Options.LogOptions, cachePCs),
              result, cachePCs, ref pluginCount);
          }

          if (this.Options.RefineArrays)
          {
            this.AddAnalysisAndDependencies(
              new ArrayExpressionRefinementPlugIn(pluginCount, this.MethodName, this.MethodDriver, this.Options.LogOptions, cachePCs),
              result, cachePCs, ref pluginCount);
          }

          if (this.Options.InferArrayPurity)
          {
            this.AddAnalysisAndDependencies(
              new ArrayPurityAnalysisPlugIn(pluginCount, this.MethodName, this.MethodDriver, this.Options.LogOptions, cachePCs),
              result, cachePCs, ref pluginCount);
          }

          if (this.Options.LogOptions.CheckExistentials)
          {
            this.AddAnalysisAndDependencies(
              new ExistentialAnalysisPlugIn(pluginCount, this.MethodName, this.MethodDriver, this.Options.LogOptions, cachePCs),
              result, cachePCs, ref pluginCount);
          }

          if (this.Options.LogOptions.SuggestRequiresForArrays)
          {
            this.AddAnalysisAndDependencies(
              new ArrayElementsCheckedAnalysisPlugin(pluginCount, this.MethodName, MethodDriver, this.Options.LogOptions, cachePCs),
              result, cachePCs, ref pluginCount);
          }

          return result;
        }

        private void AddAnalysisAndDependencies
        (
          GenericPlugInAnalysisForComposedAnalysis analysis,
          List<GenericPlugInAnalysisForComposedAnalysis> analyses,
          Predicate<APC> cachePCs,
          ref int id
        )
        {
          Contract.Requires(analysis != null);
          Contract.Requires(analyses != null);
          Contract.Requires(id >= 0);

          Contract.Ensures(id >= Contract.OldValue(id));


          // Add the analysis - we do the explicit check for robustness 
          if (!analyses.Exists(prev => prev.GetType().Equals(analysis.GetType())))
          {
            analyses.Add(analysis);
            this.analysisMapping[(int)analysis.Kind] = id++;
          }
          else
          {
            return;
          }
          // Now add the dependencies if not present
          // This uses reflection and can be very slow. 
          // So the best thing is to specify the dependencies directly on the command line
          foreach (var dependencies in AnalysisDependencies[analysis.GetType()])
          {
            if (!analyses.Exists(prev => prev.GetType().Equals(dependencies)))
            {
              try
              {
                Contract.Assume(dependencies != null, "Assumption from the environment");
                var newInstance = (GenericPlugInAnalysisForComposedAnalysis)
                  Activator.CreateInstance(dependencies, id, this.MethodName, this.MethodDriver, this.Options.LogOptions, cachePCs);
                AddAnalysisAndDependencies(newInstance, analyses, cachePCs, ref id);
              }
              catch (System.MissingMethodException e)
              {
                Console.WriteLine("A problem occurred with the initialization of the plugin analysis: {0}", e.Message);
                return;
              }
            }
          }
        }
        #endregion

        #region Transfer functions

        public override ArrayState
          Arglist(APC pc, Variable dest, ArrayState data)
        {
          var numerical = this.numericalAnalysis.Arglist(pc, dest, data.Numerical); Contract.Assume(numerical != null);
          var resultState = this.arrayAnalysis.Arglist(pc, dest, data.UpdateNumerical(numerical));

          Contract.Assume(numerical != null);

          if (this.nonnullAnalysis != null)
          {
            var nonnull = this.nonnullAnalysis.Arglist(pc, dest, resultState.NonNull);

            resultState = resultState.UpdateNonNull(nonnull);
          }

          foreach (var additionalAnalysis in this.additionalAnalyses)
          {
            resultState = additionalAnalysis.Arglist(pc, dest, resultState);
          }

          return resultState;
        }

        public override ArrayState
          Assert(APC pc, string tag, Variable condition, object provenance, ArrayState data)
        {
          var numerical = this.numericalAnalysis.Assert(pc, tag, condition, provenance, data.Numerical);
          Contract.Assume(numerical != null);

          var resultState = data.UpdateNumerical(numerical);

#if DEBUG
          data = null; // F: just for debugging - data should not be used from here
#endif

          if (this.nonnullAnalysis != null)
          {
            var nonnull = this.nonnullAnalysis.Assert(pc, tag, condition, provenance, resultState.NonNull);

            if (this.nonnullAnalysis.IsBottom(pc, nonnull))
            {
              return this.GetBottomValue();
            }

            resultState = resultState.UpdateNonNull(nonnull);
          }

          resultState = this.arrayAnalysis.Assert(pc, tag, condition, provenance, resultState);

          foreach (var additionalAnalysis in this.additionalAnalyses)
          {
            resultState = additionalAnalysis.Assert(pc, tag, condition, provenance, resultState);
          }

          return resultState;
        }

    protected void Page_Load(object sender, EventArgs e)
    {
        CheckSession();
        if (!IsPostBack)
        {
            string buildid = Request.QueryString["BuildID"];

            string strSql_Floor = "select distinct RHC=convert(int,RHC) from dbo.WY_XM_FWXX where Buildid='" + buildid + "' order by RHC desc";

            DataTable dt_Floor = rc.GetTable(strSql_Floor);

            string strsql_Unit = "select t.dy as name,count(a.houseid) as PrefloorRoomCount  from( select distinct DY,buildid  from dbo.WY_XM_FWXX ) as t inner join dbo.WY_XM_FWXX as a on t.dy=a.dy ";
            strsql_Unit += "where t.buildid='" + buildid + "' and a.buildid='" + buildid + "' GROUP BY t.dy ";

            DataTable dt_Unit = rc.GetTable(strsql_Unit);


            string strSql_House = "select *  from dbo.WY_XM_FWXX where Buildid='" + buildid + "' order by FH desc";

            DataTable dt_House = rc.GetTable(strSql_House);
            strBuild = CreateLPB3(dt_Floor, dt_Unit, dt_House);

            //string 

        }
    }
    #region 生成楼盘表
    /// <summary>
    /// 生成楼盘表3
    /// </summary>
    /// <param name="dt_Floor">所有楼层的数据集</param>
    /// <param name="Unit">所有单元的数据集</param>
    /// <param name="dt_House">所有房屋的数据集</param>
    private string CreateLPB3(DataTable dt_Floor, DataTable dt_Unit, DataTable dt_House)
    {
        StringBuilder sb = new StringBuilder();
        try
        {
            sb.Append("<div id='div_LPB' class='div_LPB' style='height: 478px; width: 745px; overflow: auto;'>");
            sb.Append("<table id='tableLPB' width='auto' cellpadding='0' cellspacing='2'>");



            int MaxRoomCount = 0;

            for (int i = 0; i < dt_Floor.Rows.Count; i++)
            {
                sb.Append("<tr>");

                int floorno = Convert.ToInt32(dt_Floor.Rows[i]["RHC"]);

                string strFloorName = Convert.ToString(dt_Floor.Rows[i]["RHC"]);
                sb.Append(" <td class='lb-lc'>" + strFloorName + "层</td>");

                //通过楼层筛选房屋
                DataRow[] dr1 = dt_House.Select(string.Format("RHC='{0}'", floorno));
                if (dr1.Length != 0)
                {
                    int roomCount = 0; //计算房屋具体室数,计算宽度
                    //循环单元,排列有单元的房屋
                    for (int m = 0; m < dt_Unit.Rows.Count; m++)
                    {
                        roomCount++;
                        //通过楼层、单元筛选房屋
                        DataRow[] dr2 = dt_House.Select(string.Format("RHC='{0}' and DY='{1}'", floorno, dt_Unit.Rows[m]["Name"].ToString().Trim()));
                        if (dr2.Length != 0)
                        {
                            for (int n = 0; n < Convert.ToInt32(dt_Unit.Rows[m]["PrefloorRoomCount"]); n++)
                            {
                                //通过楼层、单元和户室号同时筛选房屋
                                DataRow[] dr3 = dt_House.Select(string.Format("RHC='{0}' and DY='{1}' and SH='{2}'", floorno, dt_Unit.Rows[m]["Name"].ToString().Trim(), n + 1));
                                if (dr3.Length != 0)
                                {
                                    //生成并填充房屋信息的单元格
                                    string bgColor = "#06FB0A"; //颜色
                                    //string bgColor = GetColor(dr3[0]["StateCode"].ToString().Trim(), "");
                                    string constructionArea = dr3[0]["JZMJ"].ToString().Trim(); //建筑面积

                                    sb.Append("<td class='lb-fw' id='lmt" + dr3[0]["HouseId"].ToString().Trim() + "' name='" + dr3[0]["HouseId"].ToString().Trim() + "'  bgcolor='" + bgColor + "'; ");
                                    sb.Append("title='面积:" + constructionArea + "平方米 '>");
                                    //sb.Append(dr3[0]["Number"]);
                                    sb.Append("<a href='#' name='" + dr3[0]["HouseId"].ToString().Trim() + "' id='" + dr3[0]["BuildId"].ToString().Trim() + "'  >" + dr3[0]["FH"] + "</a>");

                                    sb.Append("</td>");
                                }
                                else
                                {
                                    //sb.Append("<td class='lb-fw'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>");
                                }
                            }
                        }
                        else
                        {
                            for (int n = 0; n < Convert.ToInt32(dt_Unit.Rows[m]["PrefloorRoomCount"]); n++)
                            {
                                //sb.Append("<td class='lb-fw'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>");
                            }
                        }
                    }

                    //在把有单元的房屋排列完之后排列没有单元的
                    for (int p = 0; p < dr1.Length; p++)
                    {
                        roomCount++;
                        //循环单元,排列没有有单元的房屋
                        bool hasUnit = false;
                        for (int m = 0; m < dt_Unit.Rows.Count; m++)
                        {
                            if (dt_Unit.Rows[m]["Name"].ToString().Trim() == dr1[p]["DY"].ToString().Trim())
                            {
                                hasUnit = true;
                                break;
                            }
                        }
                        if (hasUnit == false)
                        {
                            //生成并填充房屋信息的单元格
                            string bgColor = "#06FB0A"; //颜色
                            string constructionArea = dr1[p]["JZMJ"].ToString().Trim(); //建筑面积

                            sb.Append("<td class='lb-fw' id='lmt" + dr1[p]["HouseId"].ToString().Trim() + "' name='" + dr1[p]["HouseId"].ToString().Trim() + "'  bgcolor='" + bgColor + "'; ");
                            sb.Append("title='面积:" + constructionArea + "平方米 '>");
                            //sb.Append(dr1[p]["Number"]);
                            sb.Append("<a href='#' name='" + dr1[p]["HouseId"].ToString().Trim() + "' id='" + dr1[p]["BuildId"].ToString().Trim() + "'  >" + dr1[p]["FH"] + "</a>");

                            sb.Append("</td>");
                        }
                    }
                    if (MaxRoomCount < roomCount)
                    {
                        MaxRoomCount = roomCount;
                    }
                }



            }

            sb.Append("</table>");
            sb.Append("</div>");

            double d = MaxRoomCount * 70;

            if (d > 745)
            {
                sb.Replace("width='auto'", "width='" + d.ToString() + "px");
            }
        }
        catch
        {

        }
        return sb.ToString().Trim();
    }

    #endregion

    #region 返回房屋应该显示的颜色
    /// <summary>
    /// 返回房屋应该显示的颜色
    /// </summary>
    /// <param name="State">房屋的状态码</param>
    /// <param name="TypeCode">房屋分类编码</param>
    /// <param name="type">传入该页面的操作类型代码</param>
    /// <param name="Owner">房屋买受人名称</param>
    private string GetColor(string State, string TypeCode)
    {
        string strColor = "";
        string[] arrayState = new string[12];
        for (int i = 0; i < State.Length; i++)
        {
            arrayState[i] = State.Substring(i, 1);
        }

        //查封
        if (arrayState[5] == "1")
        {
            strColor = "#7F0102";
        }
        //抵押
        else if (arrayState[4] == "1")
        {
            strColor = "#FC7E7F";
        }
        //发证
        else if (arrayState[3] == "1")
        {
            strColor = "#FC0301";
        }
        //抵预
        else if (arrayState[11] == "1")
        {
            strColor = "#FDDFAB";
        }
        //预告
        else if (arrayState[2] == "1")
        {
            strColor = "#FF8354";
        }
        //公用
        else if (arrayState[10] == "1")
        {
            strColor = "#FEA600";
        }
        //自有
        else if (arrayState[9] == "1")
        {
            strColor = "#0601FB";
        }
        //备案(已签合同)
        else if (arrayState[1] == "1")
        {
            strColor = "#FFFC06";
        }
        //签约(拟定合同)
        else if (arrayState[7] == "1")
        {
            strColor = "#02FFFD";
        }
        //认购(订购)
        else if (arrayState[0] == "1")
        {
            strColor = "#2E8B57";
        }
        ////非售
        //else if (arrayState[8] == "1")
        //{
        //    strColor = "#D7D3D3";
        //}
        else
        {
            //异议
            if (arrayState[6] == "1")
            {
                strColor = "#C0C0C0";
            }
            else
            {
                //可售
                if (TypeCode.StartsWith("2002"))
                {
                    strColor = "#06FB0A";
                }
                //不可售
                else
                {
                    strColor = "#D7D3D3";
                }
            }
        }
        return strColor;
    }
    #endregion

    #region 返回房屋已经存在的业务的图片
    /// <summary>
    /// 返回房屋已经存在的业务的图片
    /// </summary>
    /// <param name="State">房屋的状态码</param>
    /// <param name="TypeCode">房屋分类编码</param>
    /// <param name="type">传入该页面的操作类型代码</param>
    /// <param name="Owner">房屋买受人名称</param>
    private string GetImage(string State, string TypeCode)
    {
        string strImage = "";
        string[] arrayState = new string[12];
        for (int i = 0; i < State.Length; i++)
        {
            arrayState[i] = State.Substring(i, 1);
        }

        //认购(订购)
        if (arrayState[0] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src=''/>";
        }
        //备案(已签合同)
        if (arrayState[1] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/1.jpg'/>";
        }
        //预告
        if (arrayState[2] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/2.jpg'/>";
        }
        //发证
        if (arrayState[3] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/3.jpg'/>";
        }
        //抵押
        if (arrayState[4] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/4.jpg'/>";
        }
        //查封
        if (arrayState[5] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/5.jpg'/>";
        }
        //异议
        if (arrayState[6] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/6.jpg'/>";
        }
        //签约(拟定合同)
        if (arrayState[7] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/0.jpg'/>";
        }
        strImage += "<br/>";

        return strImage;
    }
    #endregion

    #region 返回建筑面积
    /// <summary>
    /// 返回建筑面积
    /// </summary>
    /// <param name="ActualConstructionArea">实测建筑面积</param>
    /// <param name="PreConstructionArea">预测建筑面积</param>
    private string GetConstructionArea(string ActualConstructionArea, string PreConstructionArea)
    {
        if (ActualConstructionArea != "0" && ActualConstructionArea != "0.00" && ActualConstructionArea != "0.0000")
        {
            return ActualConstructionArea;
        }
        else
        {
            return PreConstructionArea;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string buildid = Request.QueryString["BuildID"];

            string strSql_Floor = "select distinct RHC=convert(int,RHC) from dbo.YW_WY_XM_FWXX where Buildid='" + buildid + "' order by RHC desc";

            DataTable dt_Floor = rc.GetTable(strSql_Floor);

            string strsql_Unit = "select t.dy as name,count(a.houseid) as PrefloorRoomCount  from( select distinct DY,buildid  from dbo.YW_WY_XM_FWXX ) as t inner join dbo.YW_WY_XM_FWXX as a on t.dy=a.dy ";
            strsql_Unit += "where t.buildid='" + buildid + "' and a.buildid='" + buildid + "' GROUP BY t.dy ";

            DataTable dt_Unit = rc.GetTable(strsql_Unit);


            string strSql_House = "select *  from dbo.YW_WY_XM_FWXX where Buildid='" + buildid + "' order by FH desc";

            DataTable dt_House = rc.GetTable(strSql_House);
            strBuild = CreateLPB3(dt_Floor, dt_Unit, dt_House);

            //string 

        }
    }
    #region 生成楼盘表
    /// <summary>
    /// 生成楼盘表3
    /// </summary>
    /// <param name="dt_Floor">所有楼层的数据集</param>
    /// <param name="Unit">所有单元的数据集</param>
    /// <param name="dt_House">所有房屋的数据集</param>
    private string CreateLPB3(DataTable dt_Floor, DataTable dt_Unit, DataTable dt_House)
    {
        StringBuilder sb = new StringBuilder();
        try
        {
            sb.Append("<div id='div_LPB' class='div_LPB' style='height: 478px; width: 745px; overflow: auto;'>");
            sb.Append("<table id='tableLPB' width='auto' cellpadding='0' cellspacing='2'>");



            int MaxRoomCount = 0;

            for (int i = 0; i < dt_Floor.Rows.Count; i++)
            {
                sb.Append("<tr>");

                int floorno = Convert.ToInt32(dt_Floor.Rows[i]["RHC"]);

                string strFloorName = Convert.ToString(dt_Floor.Rows[i]["RHC"]);
                sb.Append(" <td class='lb-lc'>" + strFloorName + "层</td>");

                //通过楼层筛选房屋
                DataRow[] dr1 = dt_House.Select(string.Format("RHC='{0}'", floorno));
                if (dr1.Length != 0)
                {
                    int roomCount = 0; //计算房屋具体室数,计算宽度
                    //循环单元,排列有单元的房屋
                    for (int m = 0; m < dt_Unit.Rows.Count; m++)
                    {
                        roomCount++;
                        //通过楼层、单元筛选房屋
                        DataRow[] dr2 = dt_House.Select(string.Format("RHC='{0}' and DY='{1}'", floorno, dt_Unit.Rows[m]["Name"].ToString().Trim()));
                        if (dr2.Length != 0)
                        {
                            for (int n = 0; n < Convert.ToInt32(dt_Unit.Rows[m]["PrefloorRoomCount"]); n++)
                            {
                                //通过楼层、单元和户室号同时筛选房屋
                                DataRow[] dr3 = dt_House.Select(string.Format("RHC='{0}' and DY='{1}' and SH='{2}'", floorno, dt_Unit.Rows[m]["Name"].ToString().Trim(), n + 1));
                                if (dr3.Length != 0)
                                {
                                    //生成并填充房屋信息的单元格
                                    string bgColor = "#06FB0A"; //颜色
                                    //string bgColor = GetColor(dr3[0]["StateCode"].ToString().Trim(), "");
                                    string constructionArea = dr3[0]["JZMJ"].ToString().Trim(); //建筑面积

                                    sb.Append("<td class='lb-fw' id='lmt" + dr3[0]["HouseId"].ToString().Trim() + "' name='" + dr3[0]["HouseId"].ToString().Trim() + "'  bgcolor='" + bgColor + "'; ");
                                    sb.Append("title='面积:" + constructionArea + "平方米 '>");
                                    //sb.Append(dr3[0]["Number"]);
                                    sb.Append("<a href='#' name='" + dr3[0]["HouseId"].ToString().Trim() + "' id='" + dr3[0]["BuildId"].ToString().Trim() + "'  >" + dr3[0]["FH"] + "</a>");

                                    sb.Append("</td>");
                                }
                                else
                                {
                                    //sb.Append("<td class='lb-fw'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>");
                                }
                            }
                        }
                        else
                        {
                            for (int n = 0; n < Convert.ToInt32(dt_Unit.Rows[m]["PrefloorRoomCount"]); n++)
                            {
                                //sb.Append("<td class='lb-fw'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>");
                            }
                        }
                    }

                    //在把有单元的房屋排列完之后排列没有单元的
                    for (int p = 0; p < dr1.Length; p++)
                    {
                        roomCount++;
                        //循环单元,排列没有有单元的房屋
                        bool hasUnit = false;
                        for (int m = 0; m < dt_Unit.Rows.Count; m++)
                        {
                            if (dt_Unit.Rows[m]["Name"].ToString().Trim() == dr1[p]["DY"].ToString().Trim())
                            {
                                hasUnit = true;
                                break;
                            }
                        }
                        if (hasUnit == false)
                        {
                            //生成并填充房屋信息的单元格
                            string bgColor = "#06FB0A"; //颜色
                            string constructionArea = dr1[p]["JZMJ"].ToString().Trim(); //建筑面积

                            sb.Append("<td class='lb-fw' id='lmt" + dr1[p]["HouseId"].ToString().Trim() + "' name='" + dr1[p]["HouseId"].ToString().Trim() + "'  bgcolor='" + bgColor + "'; ");
                            sb.Append("title='面积:" + constructionArea + "平方米 '>");
                            //sb.Append(dr1[p]["Number"]);
                            sb.Append("<a href='#' name='" + dr1[p]["HouseId"].ToString().Trim() + "' id='" + dr1[p]["BuildId"].ToString().Trim() + "'  >" + dr1[p]["FH"] + "</a>");

                            sb.Append("</td>");
                        }
                    }
                    if (MaxRoomCount < roomCount)
                    {
                        MaxRoomCount = roomCount;
                    }
                }



            }

            sb.Append("</table>");
            sb.Append("</div>");

            double d = MaxRoomCount * 70;

            if (d > 745)
            {
                sb.Replace("width='auto'", "width='" + d.ToString() + "px");
            }
        }
        catch
        {

        }
        return sb.ToString().Trim();
    }

    #endregion

    #region 返回房屋应该显示的颜色
    /// <summary>
    /// 返回房屋应该显示的颜色
    /// </summary>
    /// <param name="State">房屋的状态码</param>
    /// <param name="TypeCode">房屋分类编码</param>
    /// <param name="type">传入该页面的操作类型代码</param>
    /// <param name="Owner">房屋买受人名称</param>
    private string GetColor(string State, string TypeCode)
    {
        string strColor = "";
        string[] arrayState = new string[12];
        for (int i = 0; i < State.Length; i++)
        {
            arrayState[i] = State.Substring(i, 1);
        }

        //查封
        if (arrayState[5] == "1")
        {
            strColor = "#7F0102";
        }
        //抵押
        else if (arrayState[4] == "1")
        {
            strColor = "#FC7E7F";
        }
        //发证
        else if (arrayState[3] == "1")
        {
            strColor = "#FC0301";
        }
        //抵预
        else if (arrayState[11] == "1")
        {
            strColor = "#FDDFAB";
        }
        //预告
        else if (arrayState[2] == "1")
        {
            strColor = "#FF8354";
        }
        //公用
        else if (arrayState[10] == "1")
        {
            strColor = "#FEA600";
        }
        //自有
        else if (arrayState[9] == "1")
        {
            strColor = "#0601FB";
        }
        //备案(已签合同)
        else if (arrayState[1] == "1")
        {
            strColor = "#FFFC06";
        }
        //签约(拟定合同)
        else if (arrayState[7] == "1")
        {
            strColor = "#02FFFD";
        }
        //认购(订购)
        else if (arrayState[0] == "1")
        {
            strColor = "#2E8B57";
        }
        ////非售
        //else if (arrayState[8] == "1")
        //{
        //    strColor = "#D7D3D3";
        //}
        else
        {
            //异议
            if (arrayState[6] == "1")
            {
                strColor = "#C0C0C0";
            }
            else
            {
                //可售
                if (TypeCode.StartsWith("2002"))
                {
                    strColor = "#06FB0A";
                }
                //不可售
                else
                {
                    strColor = "#D7D3D3";
                }
            }
        }
        return strColor;
    }
    #endregion

    #region 返回房屋已经存在的业务的图片
    /// <summary>
    /// 返回房屋已经存在的业务的图片
    /// </summary>
    /// <param name="State">房屋的状态码</param>
    /// <param name="TypeCode">房屋分类编码</param>
    /// <param name="type">传入该页面的操作类型代码</param>
    /// <param name="Owner">房屋买受人名称</param>
    private string GetImage(string State, string TypeCode)
    {
        string strImage = "";
        string[] arrayState = new string[12];
        for (int i = 0; i < State.Length; i++)
        {
            arrayState[i] = State.Substring(i, 1);
        }

        //认购(订购)
        if (arrayState[0] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src=''/>";
        }
        //备案(已签合同)
        if (arrayState[1] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/1.jpg'/>";
        }
        //预告
        if (arrayState[2] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/2.jpg'/>";
        }
        //发证
        if (arrayState[3] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/3.jpg'/>";
        }
        //抵押
        if (arrayState[4] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/4.jpg'/>";
        }
        //查封
        if (arrayState[5] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/5.jpg'/>";
        }
        //异议
        if (arrayState[6] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/6.jpg'/>";
        }
        //签约(拟定合同)
        if (arrayState[7] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/0.jpg'/>";
        }
        strImage += "<br/>";

        return strImage;
    }
    #endregion

    #region 返回建筑面积
    /// <summary>
    /// 返回建筑面积
    /// </summary>
    /// <param name="ActualConstructionArea">实测建筑面积</param>
    /// <param name="PreConstructionArea">预测建筑面积</param>
    private string GetConstructionArea(string ActualConstructionArea, string PreConstructionArea)
    {
        if (ActualConstructionArea != "0" && ActualConstructionArea != "0.00" && ActualConstructionArea != "0.0000")
        {
            return ActualConstructionArea;
        }
        else
        {
            return PreConstructionArea;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string buildid = Convert.ToString(Session["WY_LPB_Buildid"]);

            string strSql_Floor = "select distinct RHC=convert(int,RHC) from dbo.YW_WY_XM_FWXX where Buildid='" + buildid + "' order by RHC desc";

            DataTable dt_Floor = rc.GetTable(strSql_Floor);

            string strsql_Unit = "select t.dy as name,count(a.houseid) as PrefloorRoomCount  from( select distinct DY,buildid  from dbo.YW_WY_XM_FWXX ) as t inner join dbo.YW_WY_XM_FWXX as a on t.dy=a.dy ";
            strsql_Unit += "where t.buildid='" + buildid + "' and a.buildid='" + buildid + "' GROUP BY t.dy ";

            DataTable dt_Unit = rc.GetTable(strsql_Unit);


            string strSql_House = "select *  from dbo.YW_WY_XM_FWXX where Buildid='" + buildid + "' order by FH desc";

            DataTable dt_House = rc.GetTable(strSql_House);
            strBuild = CreateLPB3(dt_Floor, dt_Unit, dt_House);

            //string 

        }
    }
    #region 生成楼盘表
    /// <summary>
    /// 生成楼盘表3
    /// </summary>
    /// <param name="dt_Floor">所有楼层的数据集</param>
    /// <param name="Unit">所有单元的数据集</param>
    /// <param name="dt_House">所有房屋的数据集</param>
    private string CreateLPB3(DataTable dt_Floor, DataTable dt_Unit, DataTable dt_House)
    {
        StringBuilder sb = new StringBuilder();
        try
        {
            sb.Append("<div id='div_LPB' class='div_LPB' style='height: 478px; width: 745px; overflow: auto;'>");
            sb.Append("<table id='tableLPB' width='auto' cellpadding='0' cellspacing='2'>");



            int MaxRoomCount = 0;

            for (int i = 0; i < dt_Floor.Rows.Count; i++)
            {
                sb.Append("<tr>");

                int floorno = Convert.ToInt32(dt_Floor.Rows[i]["RHC"]);

                string strFloorName = Convert.ToString(dt_Floor.Rows[i]["RHC"]);
                sb.Append(" <td class='lb-lc'>" + strFloorName + "层</td>");

                //通过楼层筛选房屋
                DataRow[] dr1 = dt_House.Select(string.Format("RHC='{0}'", floorno));
                if (dr1.Length != 0)
                {
                    int roomCount = 0; //计算房屋具体室数,计算宽度
                    //循环单元,排列有单元的房屋
                    for (int m = 0; m < dt_Unit.Rows.Count; m++)
                    {
                        roomCount++;
                        //通过楼层、单元筛选房屋
                        DataRow[] dr2 = dt_House.Select(string.Format("RHC='{0}' and DY='{1}'", floorno, dt_Unit.Rows[m]["Name"].ToString().Trim()));
                        if (dr2.Length != 0)
                        {
                            for (int n = 0; n < Convert.ToInt32(dt_Unit.Rows[m]["PrefloorRoomCount"]); n++)
                            {
                                //通过楼层、单元和户室号同时筛选房屋
                                DataRow[] dr3 = dt_House.Select(string.Format("RHC='{0}' and DY='{1}' and SH='{2}'", floorno, dt_Unit.Rows[m]["Name"].ToString().Trim(), n + 1));
                                if (dr3.Length != 0)
                                {
                                    //生成并填充房屋信息的单元格
                                    string bgColor = "#06FB0A"; //颜色
                                    //string bgColor = GetColor(dr3[0]["StateCode"].ToString().Trim(), "");
                                    string constructionArea = dr3[0]["JZMJ"].ToString().Trim(); //建筑面积

                                    sb.Append("<td class='lb-fw' id='lmt" + dr3[0]["HouseId"].ToString().Trim() + "' name='" + dr3[0]["HouseId"].ToString().Trim() + "'  bgcolor='" + bgColor + "'; ");
                                    sb.Append("title='面积:" + constructionArea + "平方米 '>");
                                    //sb.Append(dr3[0]["Number"]);
                                    sb.Append("<a href='#' name='" + dr3[0]["HouseId"].ToString().Trim() + "' id='" + dr3[0]["BuildId"].ToString().Trim() + "'  >" + dr3[0]["FH"] + "</a>");

                                    sb.Append("</td>");
                                }
                                else
                                {
                                    //sb.Append("<td class='lb-fw'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>");
                                }
                            }
                        }
                        else
                        {
                            for (int n = 0; n < Convert.ToInt32(dt_Unit.Rows[m]["PrefloorRoomCount"]); n++)
                            {
                                //sb.Append("<td class='lb-fw'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>");
                            }
                        }
                    }

                    //在把有单元的房屋排列完之后排列没有单元的
                    for (int p = 0; p < dr1.Length; p++)
                    {
                        roomCount++;
                        //循环单元,排列没有有单元的房屋
                        bool hasUnit = false;
                        for (int m = 0; m < dt_Unit.Rows.Count; m++)
                        {
                            if (dt_Unit.Rows[m]["Name"].ToString().Trim() == dr1[p]["DY"].ToString().Trim())
                            {
                                hasUnit = true;
                                break;
                            }
                        }
                        if (hasUnit == false)
                        {
                            //生成并填充房屋信息的单元格
                            string bgColor = "#06FB0A"; //颜色
                            string constructionArea = dr1[p]["JZMJ"].ToString().Trim(); //建筑面积

                            sb.Append("<td class='lb-fw' id='lmt" + dr1[p]["HouseId"].ToString().Trim() + "' name='" + dr1[p]["HouseId"].ToString().Trim() + "'  bgcolor='" + bgColor + "'; ");
                            sb.Append("title='面积:" + constructionArea + "平方米 '>");
                            //sb.Append(dr1[p]["Number"]);
                            sb.Append("<a href='#' name='" + dr1[p]["HouseId"].ToString().Trim() + "' id='" + dr1[p]["BuildId"].ToString().Trim() + "'  >" + dr1[p]["FH"] + "</a>");

                            sb.Append("</td>");
                        }
                    }
                    if (MaxRoomCount < roomCount)
                    {
                        MaxRoomCount = roomCount;
                    }
                }



            }

            sb.Append("</table>");
            sb.Append("</div>");

            double d = MaxRoomCount * 70;

            if (d > 745)
            {
                sb.Replace("width='auto'", "width='" + d.ToString() + "px");
            }
        }
        catch
        {

        }
        return sb.ToString().Trim();
    }

    #endregion

    #region 返回房屋应该显示的颜色
    /// <summary>
    /// 返回房屋应该显示的颜色
    /// </summary>
    /// <param name="State">房屋的状态码</param>
    /// <param name="TypeCode">房屋分类编码</param>
    /// <param name="type">传入该页面的操作类型代码</param>
    /// <param name="Owner">房屋买受人名称</param>
    private string GetColor(string State, string TypeCode)
    {
        string strColor = "";
        string[] arrayState = new string[12];
        for (int i = 0; i < State.Length; i++)
        {
            arrayState[i] = State.Substring(i, 1);
        }

        //查封
        if (arrayState[5] == "1")
        {
            strColor = "#7F0102";
        }
        //抵押
        else if (arrayState[4] == "1")
        {
            strColor = "#FC7E7F";
        }
        //发证
        else if (arrayState[3] == "1")
        {
            strColor = "#FC0301";
        }
        //抵预
        else if (arrayState[11] == "1")
        {
            strColor = "#FDDFAB";
        }
        //预告
        else if (arrayState[2] == "1")
        {
            strColor = "#FF8354";
        }
        //公用
        else if (arrayState[10] == "1")
        {
            strColor = "#FEA600";
        }
        //自有
        else if (arrayState[9] == "1")
        {
            strColor = "#0601FB";
        }
        //备案(已签合同)
        else if (arrayState[1] == "1")
        {
            strColor = "#FFFC06";
        }
        //签约(拟定合同)
        else if (arrayState[7] == "1")
        {
            strColor = "#02FFFD";
        }
        //认购(订购)
        else if (arrayState[0] == "1")
        {
            strColor = "#2E8B57";
        }
        ////非售
        //else if (arrayState[8] == "1")
        //{
        //    strColor = "#D7D3D3";
        //}
        else
        {
            //异议
            if (arrayState[6] == "1")
            {
                strColor = "#C0C0C0";
            }
            else
            {
                //可售
                if (TypeCode.StartsWith("2002"))
                {
                    strColor = "#06FB0A";
                }
                //不可售
                else
                {
                    strColor = "#D7D3D3";
                }
            }
        }
        return strColor;
    }
    #endregion

    #region 返回房屋已经存在的业务的图片
    /// <summary>
    /// 返回房屋已经存在的业务的图片
    /// </summary>
    /// <param name="State">房屋的状态码</param>
    /// <param name="TypeCode">房屋分类编码</param>
    /// <param name="type">传入该页面的操作类型代码</param>
    /// <param name="Owner">房屋买受人名称</param>
    private string GetImage(string State, string TypeCode)
    {
        string strImage = "";
        string[] arrayState = new string[12];
        for (int i = 0; i < State.Length; i++)
        {
            arrayState[i] = State.Substring(i, 1);
        }

        //认购(订购)
        if (arrayState[0] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src=''/>";
        }
        //备案(已签合同)
        if (arrayState[1] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/1.jpg'/>";
        }
        //预告
        if (arrayState[2] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/2.jpg'/>";
        }
        //发证
        if (arrayState[3] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/3.jpg'/>";
        }
        //抵押
        if (arrayState[4] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/4.jpg'/>";
        }
        //查封
        if (arrayState[5] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/5.jpg'/>";
        }
        //异议
        if (arrayState[6] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/6.jpg'/>";
        }
        //签约(拟定合同)
        if (arrayState[7] == "1")
        {
            strImage += "<img alt='' width='16px' height='16px' src='../Images/State/0.jpg'/>";
        }
        strImage += "<br/>";

        return strImage;
    }
    #endregion

    #region 返回建筑面积
    /// <summary>
    /// 返回建筑面积
    /// </summary>
    /// <param name="ActualConstructionArea">实测建筑面积</param>
    /// <param name="PreConstructionArea">预测建筑面积</param>
    private string GetConstructionArea(string ActualConstructionArea, string PreConstructionArea)
    {
        if (ActualConstructionArea != "0" && ActualConstructionArea != "0.00" && ActualConstructionArea != "0.0000")
        {
            return ActualConstructionArea;
        }
        else
        {
            return PreConstructionArea;
        }
    }

Microsoft.Quantum.Experimental.ArrayState : State

Methods :

public NDArray get_Data()
public Int32 get_NQubits()
public Void set_NQubits(Int32 value = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods