コード例 #1
0
    public static WebServices.FieldInfo[] GetFieldList(string resid, string dataJson, ref string RecID)
    {
        WebServices.Services    Resource      = new WebServices.Services();
        WebServices.FieldInfo[] FieldListInfo = { };
        Field[]   fl = Resource.GetFieldListAll(resid);
        DataTable dt = CommonMethod.JsonToDataTable(dataJson);

        if (dt.Columns.Contains("ID") && dt.Rows.Count > 0)
        {
            RecID = dt.Rows[0]["ID"].ToString();
        }
        List <FieldInfo> fieldList = CommonMethod.GetFieldList(dt.Rows[0]);
        int i = 0;

        foreach (WebServices.Field f in fl)
        {
            for (int index = 0; index <= fieldList.Count - 1; index++)
            {
                FieldInfo fieldItem = fieldList[index];
                if (fieldItem.FieldDescription == f.Description)
                {
                    FieldInfo fi = new FieldInfo();
                    fi.FieldDescription = f.Description;
                    fi.FieldName        = f.Name;
                    fi.FieldValue       = fieldItem.FieldValue;
                    Array.Resize(ref FieldListInfo, i + 1);
                    FieldListInfo[i] = fi;
                    i += 1; break; // TODO: might not be correct. Was :   Exit For;
                }
            }
        }
        return(FieldListInfo);
    }