Sharepoint 中读取得不同类型SPField 时的处理方式之一
2009-04-14 17:30
295 查看
private string GetDataFromLookUpOrUser(string tempString)
{
string temp = "";
string temp2 = "";
string temp3 = "";
string temp4 = "";
int count = 0;
Boolean start = true;
for (int i = 0; i < tempString.Length; i++)
{
temp += tempString.Substring(i, 1);
if (i < tempString.Length - 1)
{
if (tempString.Substring(i, 2) == "#^")
{
if (start == true)
{
temp2 = temp.Substring(0, temp.Length - 1);
temp = "";
i++;
start = false;
}
}
else if (tempString.Substring(i, 2) == "^#")
{
temp3 += temp.Substring(1, temp.Length - 2);
temp = "";
i++;
start = true;
count = 0;
temp4 += temp2 + temp3;
temp3 = "";
}
else if (tempString.Substring(i, 2) == ";#" && start == false)
{
count++;
if (count % 2 == 0)
{
temp3 += temp.Substring(1, temp.Length - 2);
temp3 = temp3 + ",";
temp = "";
i++;
}
else
{
temp = "";
}
}
}
}
return temp4 + temp;
}
private string GetDataFromCalculatedField(string tempString)
{
string temp = "";
string temp2 = "";
string temp3 = "";
string temp4 = "";
int count = 0;
Boolean start = true;
for (int i = 0; i < tempString.Length; i++)
{
temp += tempString.Substring(i, 1);
if (i < tempString.Length - 1)
{
if (tempString.Substring(i, 2) == "#%")
{
if (start == true)
{
temp2 = temp.Substring(0, temp.Length - 1);
temp = "";
i++;
start = false;
}
}
else if (tempString.Substring(i, 2) == "%#")
{
temp3 += temp.Substring(1, temp.Length - 2);
temp = "";
i++;
start = true;
count = 0;
temp4 += temp2 + temp3;
temp3 = "";
}
else if (tempString.Substring(i, 2) == ";#" && start == false)
{
count++;
if (count % 2 == 0)
{
temp3 += temp.Substring(1, temp.Length - 2);
temp3 = temp3 + ",";
temp = "";
i++;
}
else
{
temp = "";
}
}
}
}
return temp4 + temp;
}
private string GetDataFromMultipleChoice(string tempString)
{
string temp = "";
string temp2 = "";
string temp3 = "";
string temp4 = "";
Boolean start = true;
for (int i = 0; i < tempString.Length; i++)
{
temp += tempString.Substring(i, 1);
if (i < tempString.Length - 3)
{
if (tempString.Substring(i, 4) == "#*MC")
{
if (start == true)
{
temp2 = temp.Substring(0, temp.Length - 1);
temp = "";
i += 3;
start = false;
}
}
else if (tempString.Substring(i, 4) == "MC*#")
{
temp = "";
i += 3;
start = true;
temp4 += temp2 + temp3.Substring(0, temp3.Length - 1);
}
else if (tempString.Substring(i, 2) == ";#")
{
temp3 += temp.Substring(0, temp.Length - 1);
temp3 = temp3 + ",";
temp = "";
i++;
}
}
}
return temp4 + temp;
}
/// <summary>
/// 取得 HyperLink 类型的值
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
private string GetDataFromHyperLink(string strValue)
{
if (strValue == "")
{
return "";
}
if (strValue.IndexOf(",") > 0)
{
return strValue.Substring(0, strValue.IndexOf(","));
}
else
{
return strValue;
}
}
{
string temp = "";
string temp2 = "";
string temp3 = "";
string temp4 = "";
int count = 0;
Boolean start = true;
for (int i = 0; i < tempString.Length; i++)
{
temp += tempString.Substring(i, 1);
if (i < tempString.Length - 1)
{
if (tempString.Substring(i, 2) == "#^")
{
if (start == true)
{
temp2 = temp.Substring(0, temp.Length - 1);
temp = "";
i++;
start = false;
}
}
else if (tempString.Substring(i, 2) == "^#")
{
temp3 += temp.Substring(1, temp.Length - 2);
temp = "";
i++;
start = true;
count = 0;
temp4 += temp2 + temp3;
temp3 = "";
}
else if (tempString.Substring(i, 2) == ";#" && start == false)
{
count++;
if (count % 2 == 0)
{
temp3 += temp.Substring(1, temp.Length - 2);
temp3 = temp3 + ",";
temp = "";
i++;
}
else
{
temp = "";
}
}
}
}
return temp4 + temp;
}
private string GetDataFromCalculatedField(string tempString)
{
string temp = "";
string temp2 = "";
string temp3 = "";
string temp4 = "";
int count = 0;
Boolean start = true;
for (int i = 0; i < tempString.Length; i++)
{
temp += tempString.Substring(i, 1);
if (i < tempString.Length - 1)
{
if (tempString.Substring(i, 2) == "#%")
{
if (start == true)
{
temp2 = temp.Substring(0, temp.Length - 1);
temp = "";
i++;
start = false;
}
}
else if (tempString.Substring(i, 2) == "%#")
{
temp3 += temp.Substring(1, temp.Length - 2);
temp = "";
i++;
start = true;
count = 0;
temp4 += temp2 + temp3;
temp3 = "";
}
else if (tempString.Substring(i, 2) == ";#" && start == false)
{
count++;
if (count % 2 == 0)
{
temp3 += temp.Substring(1, temp.Length - 2);
temp3 = temp3 + ",";
temp = "";
i++;
}
else
{
temp = "";
}
}
}
}
return temp4 + temp;
}
private string GetDataFromMultipleChoice(string tempString)
{
string temp = "";
string temp2 = "";
string temp3 = "";
string temp4 = "";
Boolean start = true;
for (int i = 0; i < tempString.Length; i++)
{
temp += tempString.Substring(i, 1);
if (i < tempString.Length - 3)
{
if (tempString.Substring(i, 4) == "#*MC")
{
if (start == true)
{
temp2 = temp.Substring(0, temp.Length - 1);
temp = "";
i += 3;
start = false;
}
}
else if (tempString.Substring(i, 4) == "MC*#")
{
temp = "";
i += 3;
start = true;
temp4 += temp2 + temp3.Substring(0, temp3.Length - 1);
}
else if (tempString.Substring(i, 2) == ";#")
{
temp3 += temp.Substring(0, temp.Length - 1);
temp3 = temp3 + ",";
temp = "";
i++;
}
}
}
return temp4 + temp;
}
/// <summary>
/// 取得 HyperLink 类型的值
/// </summary>
/// <param name="strValue"></param>
/// <returns></returns>
private string GetDataFromHyperLink(string strValue)
{
if (strValue == "")
{
return "";
}
if (strValue.IndexOf(",") > 0)
{
return strValue.Substring(0, strValue.IndexOf(","));
}
else
{
return strValue;
}
}
相关文章推荐
- Sharepoint 中读取得不同类型SPField 时的处理方式之二
- ExpandableListView的用法,不同类型数据源的处理方式
- ==和Equals的在值类型和引用类型的不同处理方式
- asp.net不同类型文件读取处理
- 使用OLEDB方式读取Excel文件到DataTable中数据类型的处理
- Java字节流和字符流的区别 (方法区别 操作基本单元区别 操作方式区别 处理数据类型区别) 之个人总结
- C/C++中四种不同的类型转换方式
- java不同数据类型在内存中的存储方式
- 关于不同类型的结构体的数组的读取和保存的测试程序
- 处理sharepoint 列表中的 person or group类型字段
- .net中在读取控件的class或ID不同方式的不同意义- jquery选择器
- 不同类型投资者的炒金方式
- android v7兼容包RecyclerView的使用(四)——点击事件的不同方式处理
- Tensorflow中对于不同类型数据的读取
- MySQL查询中使用Concat关键字来拼接中文字符乱码(不同的数据类型拼接)解决方式
- WCF处理不同方式提交的数据的方法
- java.lang.NoSuchMethodError问题处理(同一类型的jar包有不同版本存在)
- 各个浏览器对左右反斜杠的处理方式不同。
- Java处理excel两种不同的方式
- 各浏览器对常用或者错误的 Content-Type 类型处理方式不一致