当前位置: 首页 > news >正文

利用WSS做后台存储--设计一个统一的信息发布平台

方案设计:
功能包括:信息发布,保存,浏览,修改,查询
问题提出:信息发布内容和格式不能确定,应该允许客户定制信息(名称、类型、显示方式和布局)
每条目信息可以包含一个或多个附件。可以全文检索信息。
采用WSS做后台信息存储,针对于用户定义的信息内容包含数据字典为用户建立一个WSS中的“列表”和一个“文档库”,每条发布的信息存储在“列表”的一个item中,根据列表中每个Item的ID在文档库中建立一个以ID为名称的folder,在folder下存储该item的附件。
利用SPS的search webseivce进行检索

附部分类库源代码:
IPList类

None.gif namespace  SPSInformationPublish
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
///操作信息发布"列表"的类
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class IPList
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ContractedSubBlock.gifExpandedSubBlockStart.gif        
#region 域
InBlock.gif        
private string m_Guid;
InBlock.gif        
private string m_SiteUrl;
InBlock.gif        
private SPWeb m_CurrentWeb;
InBlock.gif        
private SPList m_SPList;
InBlock.gif        
private SPSite m_CurrentSite;
InBlock.gif        
private string defaultViewName = "DocManageDefaultView";
ExpandedSubBlockEnd.gif        
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif        
属性#region 属性
InBlock.gif        
private SPList GetSPListByGUID(string guid,SPListCollection spLists)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return spLists.GetList(new Guid(guid),true);
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return null;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
InBlock.gif        
public string Guid
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return m_Guid;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public SPWeb CurrentWeb
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (this.m_CurrentWeb == null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return CurrentSite.OpenWeb();
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return m_CurrentWeb;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public SPSite CurrentSite
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (this.m_CurrentSite == null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return GetSPSite();
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return m_CurrentSite;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                m_CurrentSite 
= value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public SPList ObjSPList
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return GetSPListByGUID(Guid);
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                ObjSPList 
= value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif    
ExpandedSubBlockEnd.gif        
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif        
构造器#region 构造器
InBlock.gif        
public IPList()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// TODO: 在此处添加构造函数逻辑
InBlock.gif            
//
ExpandedSubBlockEnd.gif
        }

InBlock.gif        
public IPList(string guid,string siteUrl)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            m_Guid 
= guid;
InBlock.gif            m_SiteUrl 
= siteUrl;
InBlock.gif            m_CurrentSite 
= GetSPSite();
InBlock.gif            m_CurrentWeb 
= m_CurrentSite.OpenWeb();
InBlock.gif            
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public IPList(SPList objSPList)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            ObjSPList 
= objSPList;
InBlock.gif            m_Guid 
= objSPList.ID.ToString();
InBlock.gif            CurrentSite 
= objSPList.ParentWeb.Site;
InBlock.gif            m_CurrentWeb 
= objSPList.ParentWeb;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif        
私有方法#region 私有方法
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 为文档库新建一个字段
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="FieldName">字段名</param>
InBlock.gif        
/// <param name="Type">字段类型,为SPFieldType枚举</param>
ExpandedSubBlockEnd.gif        
/// <returns>bool</returns>

InBlock.gif        private void CreateExtendField(string fieldName,string fieldTitle, SPFieldType type,string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            CurrentSite.AllowUnsafeUpdates 
= true;
InBlock.gif            CurrentWeb.AllowUnsafeUpdates 
= true;
InBlock.gif            SPFieldCollection fields 
= CurrentWeb.Lists[new Guid(guid)].Fields;
InBlock.gif            fields.Add(fieldName,type,
false);
InBlock.gif            SPField fld
=fields.GetField(fieldName);
InBlock.gif            fld.Title
=fieldTitle;
InBlock.gif            fld.Update();            
InBlock.gif            
//将字段加入到视图中
InBlock.gif
            SPList list = CurrentWeb.Lists[new Guid(guid)];
InBlock.gif            SPView view 
= list.DefaultView;
InBlock.gif            SPViewFieldCollection viewFields 
= view.ViewFields;
InBlock.gif            viewFields.Add(fieldName);
InBlock.gif            view.Update();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion
 
ContractedSubBlock.gifExpandedSubBlockStart.gif        
公共方法#region 公共方法
ContractedSubBlock.gifExpandedSubBlockStart.gif        
文档库基本操作#region 文档库基本操作
InBlock.gif        
public SPSite GetSPSite()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return new SPSite(this.m_SiteUrl);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public SPList GetSPListByGUID(string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return CurrentWeb.Lists.GetList(new Guid(guid),true);
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return null;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void Create(string title,string description ,ArrayList objExtendFields)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string id = this.Create(title,description);
InBlock.gif            CreateView(id);
InBlock.gif            CreateExtendFields(objExtendFields,id);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string Create(string title,
InBlock.gif            
string description
InBlock.gif            )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                CurrentSite.AllowUnsafeUpdates 
= true;
InBlock.gif                CurrentWeb.AllowUnsafeUpdates 
= true;
InBlock.gif                SPListCollection lists 
= CurrentWeb.Lists;
InBlock.gif                Guid id 
= lists.Add(title, description, SPListTemplateType.GenericList);
InBlock.gif                
return id.ToString();
InBlock.gif                
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new Exception("创建文档库出错!" + e.ToString());
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string Create(string title,
InBlock.gif            
string description ,
InBlock.gif            
bool enableVersion )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                CurrentSite.AllowUnsafeUpdates 
= true;
InBlock.gif                CurrentWeb.AllowUnsafeUpdates 
= true;
InBlock.gif                SPListCollection lists 
= CurrentWeb.Lists;
InBlock.gif                Guid id 
= lists.Add(title, description, SPListTemplateType.GenericList);
InBlock.gif                SPList list 
= CurrentWeb.Lists[id];
InBlock.gif                list.EnableVersioning 
= enableVersion;
InBlock.gif                list.Update();
InBlock.gif                
return id.ToString();
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new Exception("创建文档库出错!" + e.ToString());
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void Delete(string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                CurrentSite.AllowUnsafeUpdates 
= true;
InBlock.gif                CurrentWeb.AllowUnsafeUpdates 
= true;
InBlock.gif                CurrentWeb.Lists.Delete(
new Guid(guid));
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new Exception("删除文档库(GUID:" + guid + ")出错!" + e.ToString());
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif        
扩展字段操作#region 扩展字段操作
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="objExtendFields"></param>

InBlock.gif        public void CreateExtendFields(ArrayList objExtendFields,string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            IEnumerator objenum 
= objExtendFields.GetEnumerator();
InBlock.gif            
while (objenum.MoveNext())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                ExtendFieldsInfo fieldInfo 
= objenum.Current as ExtendFieldsInfo;
InBlock.gif                
if (fieldInfo != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    CreateExtendField(fieldInfo.ExtendFieldCode,
InBlock.gif                        fieldInfo.ExtendFieldName,
InBlock.gif                        IPExtendFieldDataType.GetType(fieldInfo.ExtendFieldDataType),
InBlock.gif                        guid );
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void CreateView(string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            CurrentSite.AllowUnsafeUpdates 
= true;
InBlock.gif            CurrentWeb.AllowUnsafeUpdates 
= true;
InBlock.gif            SPListCollection lists 
= CurrentWeb.Lists;
InBlock.gif            SPList list 
= lists[new Guid(guid)];
InBlock.gif            SPViewCollection views 
= list.Views;
InBlock.gif            StringCollection viewFields 
= new StringCollection();
InBlock.gif            
string viewName = defaultViewName;
InBlock.gif            viewFields.Add(
"ID");
InBlock.gif            viewFields.Add(
"Author");
InBlock.gif            viewFields.Add(
"Created");
InBlock.gif            viewFields.Add(
"Modified");
InBlock.gif            viewFields.Add(
"Title");
InBlock.gif            
string query = "";
InBlock.gif            views.Add(viewName, viewFields, query, 
300truetrue);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif        
获取数据列表操作#region 获取数据列表操作
InBlock.gif
InBlock.gif        
public DataView GetListItem()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
InBlock.gif            DataView dv 
= ObjSPList.GetItems(ObjSPList.DefaultView).GetDataTable().DefaultView;
InBlock.gif            dv.Sort 
= "Created Desc";
InBlock.gif            
return dv;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public DataView GetListItem(IFilter filter)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            DataView dv 
= ObjSPList.GetItems(filter.ToQuery()).GetDataTable().DefaultView;
InBlock.gif            dv.Sort 
= "Created Desc";
InBlock.gif            
return dv;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 按条件直接从SPS数据库UserData表中查找数据
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="filter"></param>
InBlock.gif        
/// <param name="dbSPS"></param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        public DataSet GetListItem(IFilterDB dbFilter,DataBase dbSPS)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return dbSPS.RunProc(dbFilter.ToQuerySqlString(),new DataSet());
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new Exception("构造SQL语句出错:" + dbFilter.ToQuerySqlString() + "错误源:" + e.ToString());
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif        
统计信息#region 统计信息
InBlock.gif        
public int GetTotal(IFilterDB dbFilter,DataBase dbSPS)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                 
return int.Parse(dbSPS.ReturnValue(dbFilter.ToCountSqlString()));
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new Exception("构造SQL语句出错:" + dbFilter.ToQuerySqlString() + "错误源:" + e.ToString());
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion
 
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

类IPListAttach
None.gif namespace  SPSInformationPublish
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 操作信息发布附件的类
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class IPListAttach
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private SPSite m_CurrentSite;
InBlock.gif        
private SPWeb m_CurrentWeb;
InBlock.gif        
private string m_Guid;
InBlock.gif        
private string m_SiteUrl;
InBlock.gif        
private SPDocumentLibrary m_DL;
InBlock.gif        
private string defaultViewName = "DocManageDefaultView";
InBlock.gif        
private DocumentLibrary m_ProxyDL;
InBlock.gif        
public DocumentLibrary ProxyDL
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (m_ProxyDL != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return m_ProxyDL;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return new DocumentLibrary(this.m_SiteUrl,this.m_Guid,true);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public IPListAttach(string guid,string siteUrl)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            m_Guid 
= guid;
InBlock.gif            m_SiteUrl 
= siteUrl;
InBlock.gif            m_CurrentSite 
= GetSPSite();
InBlock.gif            m_CurrentWeb 
= m_CurrentSite.OpenWeb();
InBlock.gif            m_DL 
= (SPDocumentLibrary)GetSPListByGUID(guid);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public SPList GetSPListByGUID(string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return m_CurrentWeb.Lists.GetList(new Guid(guid),true);
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return null;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public SPSite GetSPSite()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return new SPSite(m_SiteUrl);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void Create(string title,string description ,ArrayList objExtendFields)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string id = Create(title,description);
InBlock.gif            CreateView(id);
InBlock.gif            CreateExtendFields(objExtendFields,id);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void CreateExtendFields(ArrayList objExtendFields,string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            IEnumerator objenum 
= objExtendFields.GetEnumerator();
InBlock.gif            
while (objenum.MoveNext())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                ExtendFieldsInfo fieldInfo 
= objenum.Current as ExtendFieldsInfo;
InBlock.gif                
if (fieldInfo != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    CreateExtendField(fieldInfo.ExtendFieldCode,
InBlock.gif                        fieldInfo.ExtendFieldName,
InBlock.gif                        IPExtendFieldDataType.GetType(fieldInfo.ExtendFieldDataType),
InBlock.gif                        guid );
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
private void CreateExtendField(string fieldName,string fieldTitle, SPFieldType type,string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.m_CurrentSite.AllowUnsafeUpdates = true;
InBlock.gif            
this.m_CurrentWeb.AllowUnsafeUpdates = true;
InBlock.gif            SPFieldCollection fields 
= m_CurrentWeb.Lists[new Guid(guid)].Fields;
InBlock.gif            fields.Add(fieldName,type,
false);
InBlock.gif            SPField fld
=fields.GetField(fieldName);
InBlock.gif            fld.Title
=fieldTitle;
InBlock.gif            fld.Update();            
InBlock.gif            
//将字段加入到视图中
InBlock.gif
            SPList list = m_CurrentWeb.Lists[new Guid(guid)];
InBlock.gif            SPView view 
= list.DefaultView;
InBlock.gif            SPViewFieldCollection viewFields 
= view.ViewFields;
InBlock.gif            viewFields.Add(fieldName);
InBlock.gif            view.Update();
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void CreateView(string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.m_CurrentSite.AllowUnsafeUpdates = true;
InBlock.gif            
this.m_CurrentWeb.AllowUnsafeUpdates = true;
InBlock.gif            SPListCollection lists 
= m_CurrentWeb.Lists;
InBlock.gif            SPList list 
= lists[new Guid(guid)];
InBlock.gif            SPViewCollection views 
= list.Views;
InBlock.gif            StringCollection viewFields 
= new StringCollection();
InBlock.gif
InBlock.gif            
string viewName = defaultViewName;
InBlock.gif            viewFields.Add(
"DocIcon");
InBlock.gif            viewFields.Add(
"LinkFilename");
InBlock.gif            viewFields.Add(
"Last_x0020_Modified");
InBlock.gif            viewFields.Add(
"Editor");
InBlock.gif            viewFields.Add(
"ID");
InBlock.gif            viewFields.Add(
"Author");
InBlock.gif            viewFields.Add(
"Created_x0020_Date");
InBlock.gif            viewFields.Add(
"FileLeafRef");
InBlock.gif            viewFields.Add(
"LinkFilenameNoMenu");
InBlock.gif            viewFields.Add(
"FileSizeDisplay");
InBlock.gif            viewFields.Add(
"Title");
InBlock.gif            
string query = "";
InBlock.gif            views.Add(viewName, viewFields, query, 
300truetrue);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string Create(string title,
InBlock.gif            
string description
InBlock.gif            )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                m_CurrentSite.AllowUnsafeUpdates 
= true;
InBlock.gif                m_CurrentWeb.AllowUnsafeUpdates 
= true;
InBlock.gif                SPListCollection lists 
= m_CurrentWeb.Lists;
InBlock.gif                Guid id 
= lists.Add(title, description, SPListTemplateType.DocumentLibrary);
InBlock.gif                
return id.ToString();
InBlock.gif                
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new Exception("创建文档库出错!" + e.ToString());
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string CreateDocumentLibrary(string SiteURL,
InBlock.gif            
string docTitle,
InBlock.gif            
string docDescription,
InBlock.gif            
bool VersionControl)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return null;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void Delete(int id)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.ProxyDL.DeleteFolder(id.ToString());
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void CreateFolder(int id)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public bool HasAttach(int id)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if(ProxyDL.GetFolder(id.ToString()).Files.Count > 0)
InBlock.gif                    
return true;
InBlock.gif                
else
InBlock.gif                    
return false;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return false;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void AddAttach(int id)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void Delete(string guid)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
this.m_CurrentSite.AllowUnsafeUpdates = true;
InBlock.gif                
this.m_CurrentWeb.AllowUnsafeUpdates = true;
InBlock.gif                
this.m_CurrentWeb.Lists.Delete(new Guid(guid));
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new Exception("删除文档库(GUID:" + guid + ")出错!" + e.ToString());
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 把附件添加到SPS文档库中
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public int  AddToDocLib(int id,byte[] fileConent,string fileName,Hashtable inputFields)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
//CreateFolder(dl,dl.docLibrary.Title,taskID.ToString());
InBlock.gif
                ProxyDL.web.AllowUnsafeUpdates = true;
InBlock.gif                SPFileCollection files 
= ProxyDL.GetFolder(ProxyDL.docLibrary.Title + "/" + id.ToString()).Files;
InBlock.gif                SPFile myFile  
= files.Add(ProxyDL.SiteURL + "/" + ProxyDL.docLibrary.Title +
InBlock.gif                    
"/" + id.ToString() + "/" + fileName ,fileConent,true);
InBlock.gif                UpdateItem(myFile.Item.ID,inputFields);
InBlock.gif                
return myFile.Item.ID;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw e;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void DeleteFromDocLibByItemID(int itemID)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            ProxyDL.web.AllowUnsafeUpdates 
= true;
InBlock.gif            ProxyDL.DocLibrary.Items.DeleteItemById(itemID);
InBlock.gif            
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 更新扩展字段
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="itemID"></param>
ExpandedSubBlockEnd.gif        
/// <param name="inputFields"></param>

InBlock.gif        private void UpdateItem(int itemID,Hashtable inputFields)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            SPListItem item 
= ProxyDL.DocLibrary.Items.GetItemById(itemID);
InBlock.gif
InBlock.gif            IDictionaryEnumerator myEnumerator 
= inputFields.GetEnumerator();
InBlock.gif            
while (myEnumerator.MoveNext())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                item[myEnumerator.Key.ToString()] 
= myEnumerator.Value.ToString();
ExpandedSubBlockEnd.gif            }

InBlock.gif            item.Update();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 得到一个列表条目下的附件列表
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="id">列表ID</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        public DataView GetDataViewFromFolder(int id)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
//创建记录集对象
InBlock.gif
                DataSet Ds = ProxyDL.GetItem(ProxyDL.DocLibrary.Title + "/" + id.ToString());
InBlock.gif                DataView DV 
= new DataView() ;
InBlock.gif                
if(Ds.Tables.Count > 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
//过滤掉目录
InBlock.gif
                    DV = new DataView(Ds.Tables[0],"DocIcon <> ''","",DataViewRowState.CurrentRows);
InBlock.gif                    DV.Sort 
= "Last_x0020_Modified Desc";
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return DV;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception Err)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw Err;
InBlock.gif                
return null;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

IListItem

None.gif namespace  SPSInformationPublish
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 操作信息发布item类
ExpandedSubBlockEnd.gif    
/// </summary>
InBlock.gif    public class IPListItem
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private IPList m_IPList;
InBlock.gif        
private IPListAttach m_IPListAttach;
InBlock.gif        
public IPList List
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.m_IPList;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public IPListAttach ListAttach
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.m_IPListAttach;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
public IPListItem(IPList objList,IPListAttach objAttach)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            m_IPList 
= objList;
InBlock.gif            m_IPListAttach 
= objAttach;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public void TransferHasAttachStatus(int id ,string hasAttachFieldName )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (ListAttach.HasAttach(id))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                SetHasAttach(id,hasAttachFieldName);
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                SetNoneAttach(id,hasAttachFieldName);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 添加一条记录
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="inputFields"></param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        public int Add(Hashtable inputFields)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            SPListItem item 
= List.ObjSPList.Items.Add();
InBlock.gif            IDictionaryEnumerator myEnumerator 
= inputFields.GetEnumerator();
InBlock.gif            
while (myEnumerator.MoveNext())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                item[myEnumerator.Key.ToString()] 
= myEnumerator.Value.ToString();
ExpandedSubBlockEnd.gif            }

InBlock.gif            item.Update();
InBlock.gif            ProxyCreateFolder(item.ID);
InBlock.gif            ProxyAddAttach(item.ID);
InBlock.gif            
return item.ID;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 修改一条记录
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="id"></param>
ExpandedSubBlockEnd.gif        
/// <param name="inputFields"></param>

InBlock.gif        public void Update(int id,Hashtable inputFields)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            SPListItem item 
= List.ObjSPList.Items.GetItemById(id);
InBlock.gif            IDictionaryEnumerator myEnumerator 
= inputFields.GetEnumerator();
InBlock.gif            
while (myEnumerator.MoveNext())
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                item[myEnumerator.Key.ToString()] 
= myEnumerator.Value.ToString();
ExpandedSubBlockEnd.gif            }

InBlock.gif            item.Update();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 删除一个记录
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="id"></param>

InBlock.gif        public void Delete(int id)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            List.ObjSPList.Items.DeleteItemById(id);
InBlock.gif            
//删除附件
InBlock.gif
            ListAttach.Delete(id);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private void ProxyCreateFolder(int id)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            ListAttach.CreateFolder(id);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private void ProxyAddAttach(int id)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            ListAttach.AddAttach(id);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private void SetHasAttach(int id,string hasAttachFieldName)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            Hashtable ht 
= new Hashtable();
InBlock.gif            ht.Add(hasAttachFieldName,
true);
InBlock.gif            Update(id,ht);
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private void SetNoneAttach(int id,string hasAttachFieldName)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            Hashtable ht 
= new Hashtable();
InBlock.gif            ht.Add(hasAttachFieldName,
false);
InBlock.gif            Update(id,ht);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

IPFacadeFactory
None.gif namespace  SPSInformationPublish
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 外部调用程序通过本类统一访问此类库功能
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class IPFacadeFactory
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private IPFacadeFactory()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
//
InBlock.gif            
// TODO: 在此处添加构造函数逻辑
InBlock.gif            
//
ExpandedSubBlockEnd.gif
        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 返回listitem对象
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="listGuid">列表对象的GUID</param>
InBlock.gif        
/// <param name="attachGuid">附件文档库的GUID</param>
InBlock.gif        
/// <param name="siteUrl">站点的Url</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        public static IPListItem Create(string listGuid,
InBlock.gif            
string attachGuid,
InBlock.gif            
string siteUrl
InBlock.gif            )
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return new IPListItem(CreateIPList(listGuid,siteUrl),
InBlock.gif                CreateAttachList(attachGuid,siteUrl));
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 返回IPList对象
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="guid"></param>
InBlock.gif        
/// <param name="siteUrl"></param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        public static IPList CreateIPList(string guid,string siteUrl)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return new IPList(guid,siteUrl);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 返回IPList对象(没有实力化列表对象,Add时候使用)
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="siteUrl"></param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        public static IPList CreateIPList(string siteUrl)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return CreateIPList("",siteUrl);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 返回AttachList对象
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="guid"></param>
InBlock.gif        
/// <param name="siteUrl"></param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        public static IPListAttach CreateAttachList(string guid,string siteUrl)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return new IPListAttach(guid,siteUrl);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

直接从sps数据库中检索数据
None.gif using  System;
None.gif
using  System.Data;
None.gif
using  System.Collections;
None.gif
using  System.Text;
None.gif
using  UltraPower.SPS.DB;
None.gif
None.gif
namespace  SPSInformationPublish
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// FilterDB 的摘要说明。
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class FilterDB : IFilterDB
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
private string m_ListGuid;
InBlock.gif        
private string m_ConnStr;
InBlock.gif        
private SpsExpendFields m_SpsExpendFields;
InBlock.gif        
private ArrayList m_SelectFields;
InBlock.gif        
private ArrayList m_WhereFields;
InBlock.gif        
private string m_Where;
InBlock.gif        
private ArrayList m_OrderByFields;
InBlock.gif        
public SpsExpendFields ExpendFields
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (m_SpsExpendFields != null)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return m_SpsExpendFields;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return new SpsExpendFields(m_ConnStr,m_ListGuid);
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

ContractedSubBlock.gifExpandedSubBlockStart.gif        
构造器#region 构造器
InBlock.gif        
public FilterDB(string guid,
InBlock.gif            ArrayList select,
InBlock.gif            ArrayList whereFields,
InBlock.gif            
string where,
InBlock.gif            ArrayList orderBy,
InBlock.gif            
string connStr)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            m_ListGuid 
= guid;
InBlock.gif            m_ConnStr 
= connStr;
InBlock.gif            m_SelectFields 
= select;
InBlock.gif            m_WhereFields 
= whereFields;
InBlock.gif            
this.m_Where = where;
InBlock.gif            m_OrderByFields 
= orderBy;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public FilterDB(string guid,
InBlock.gif            ArrayList select,
InBlock.gif            ArrayList whereFields,
InBlock.gif            
string where,
InBlock.gif            
string connStr)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            m_ListGuid 
= guid;
InBlock.gif            m_ConnStr 
= connStr;
InBlock.gif            m_SelectFields 
= select;
InBlock.gif            m_WhereFields 
= whereFields;
InBlock.gif            
this.m_Where = where;
InBlock.gif            
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public FilterDB(string guid,
InBlock.gif            ArrayList whereFields,
InBlock.gif            
string where,
InBlock.gif            
string connStr)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            m_ListGuid 
= guid;
InBlock.gif            m_ConnStr 
= connStr;
InBlock.gif            m_WhereFields 
= whereFields;
InBlock.gif            
this.m_Where = where;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public FilterDB(string guid,string connStr)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            m_ListGuid 
= guid;
InBlock.gif            m_ConnStr 
= connStr;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif        
私有方法#region 私有方法
InBlock.gif
InBlock.gif        
private string GetOrderBy()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            StringBuilder sb 
= new StringBuilder();
InBlock.gif            
if (this.m_OrderByFields == null)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return "";
ExpandedSubBlockEnd.gif            }

InBlock.gif            
if (this.m_OrderByFields.Count == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return "";
ExpandedSubBlockEnd.gif            }

InBlock.gif            
if (this.m_OrderByFields.Count == 1)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.GetDBField(this.m_OrderByFields[0].ToString());
ExpandedSubBlockEnd.gif            }

InBlock.gif            
else
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
for(int i=0;i<this.m_OrderByFields.Count;i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (i == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        sb.Append(
" " + GetDBField(this.m_OrderByFields[i].ToString()));
ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        sb.Append(
"," +  GetDBField(this.m_OrderByFields[i].ToString()));
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

InBlock.gif                
return " Order By " + sb.ToString();
ExpandedSubBlockEnd.gif            }

InBlock.gif            
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private string GetSelect()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            StringBuilder sb 
= new StringBuilder();
InBlock.gif            sb.Append(
" Select '0',");
InBlock.gif            
for(int i = 0;i< m_SelectFields.Count;i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                sb.Append(
" " + this.GetDBField(m_SelectFields[i].ToString()) + 
InBlock.gif                    
" As " + m_SelectFields[i].ToString() + ",");
ExpandedSubBlockEnd.gif            }

InBlock.gif            sb.Append(
" '1' ");
InBlock.gif            sb.Append(
" From UserData ");
InBlock.gif
InBlock.gif            
return sb.ToString();
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private string GetWhere()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
if (this.m_Where.Trim()=="")
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return "Where tp_ListID = '" + m_ListGuid + "'" ;
ExpandedSubBlockEnd.gif            }

InBlock.gif            StringBuilder sb 
= new StringBuilder();
InBlock.gif            
for(int i=0;i<this.m_WhereFields.Count;i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                m_Where 
= m_Where.Replace(this.m_WhereFields[i].ToString(),this.GetDBField(m_WhereFields[i].ToString()));
ExpandedSubBlockEnd.gif            }

InBlock.gif            sb.Append(
" Where (" + this.m_Where + ""); 
InBlock.gif            sb.Append(
" And tp_ListID = '" + m_ListGuid + "'");
InBlock.gif            
return sb.ToString();
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private bool IsDBField(string field)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private bool IsSPSExpendField(string field)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
private string GetDBField(string spsExpendField)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return ExpendFields.GetDBFieldName(spsExpendField);
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif        
#endregion

ContractedSubBlock.gifExpandedSubBlockStart.gif        
IFilterDB 成员#region IFilterDB 成员
InBlock.gif
InBlock.gif        
public string ToQuerySqlString()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
// TODO:  添加 FilterDB.ToQuerySqlString 实现
InBlock.gif
            return GetSelect() + " " + GetWhere() + " " + GetOrderBy();
ExpandedSubBlockEnd.gif        }

InBlock.gif        
public string ToCountSqlString()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return "Select Count(*) as total From UserData " + " " + GetWhere() + " " ;
InBlock.gif
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

类图:
IPClass.JPG

转载于:https://www.cnblogs.com/coolcat/archive/2005/10/28/263622.html

相关文章:

  • Java foreach操作(遍历)数组
  • lduan server 2012 远程桌面网络高可用(二十三)
  • ASP.NET Theme/aspnet_regiis -ga/aspnet_regsql
  • easyUI中onLoadSuccess方法获取多个对象
  • signalr推送消息
  • 老鼠Atlas之旅(八):Hands-On Lab 4第四个实验,Atlas服务器控件自动完成
  • 使用hashids库混淆在url中与数据库相关的数字
  • 2005年互联网最具潜力奖
  • 腾讯财报不佳股价下挫 马化腾称SP业竞争激烈
  • Lua学习---Lua的控制结构
  • 被PQ点名了....
  • 分布式链路追踪系统预研第二篇
  • 001_SPL工作中总结
  • 精彩Blog
  • 软工期中测试简答题
  • [分享]iOS开发 - 实现UITableView Plain SectionView和table不停留一起滑动
  • CSS相对定位
  • Docker 1.12实践:Docker Service、Stack与分布式应用捆绑包
  • JAVA 学习IO流
  • java取消线程实例
  • java小心机(3)| 浅析finalize()
  • JS学习笔记——闭包
  • js正则,这点儿就够用了
  • leetcode46 Permutation 排列组合
  • SpiderData 2019年2月16日 DApp数据排行榜
  • Storybook 5.0正式发布:有史以来变化最大的版本\n
  • thinkphp5.1 easywechat4 微信第三方开放平台
  • 爬虫进阶 -- 神级程序员:让你的爬虫就像人类的用户行为!
  • 前端面试之CSS3新特性
  • 让你成为前端,后端或全栈开发程序员的进阶指南,一门学到老的技术
  • 算法---两个栈实现一个队列
  • 微信小程序上拉加载:onReachBottom详解+设置触发距离
  • 为什么要用IPython/Jupyter?
  • No resource identifier found for attribute,RxJava之zip操作符
  • 哈罗单车融资几十亿元,蚂蚁金服与春华资本加持 ...
  • 湖北分布式智能数据采集方法有哪些?
  • 如何正确理解,内页权重高于首页?
  • ​猴子吃桃问题:每天都吃了前一天剩下的一半多一个。
  • ​软考-高级-信息系统项目管理师教程 第四版【第14章-项目沟通管理-思维导图】​
  • #define与typedef区别
  • #设计模式#4.6 Flyweight(享元) 对象结构型模式
  • ( )的作用是将计算机中的信息传送给用户,计算机应用基础 吉大15春学期《计算机应用基础》在线作业二及答案...
  • (C#)if (this == null)?你在逗我,this 怎么可能为 null!用 IL 编译和反编译看穿一切
  • (HAL库版)freeRTOS移植STMF103
  • (JSP)EL——优化登录界面,获取对象,获取数据
  • (大众金融)SQL server面试题(1)-总销售量最少的3个型号的车及其总销售量
  • (二)springcloud实战之config配置中心
  • (分享)一个图片添加水印的小demo的页面,可自定义样式
  • (附源码)计算机毕业设计SSM疫情居家隔离服务系统
  • (六)c52学习之旅-独立按键
  • (六)Hibernate的二级缓存
  • (算法)Game
  • (已更新)关于Visual Studio 2019安装时VS installer无法下载文件,进度条为0,显示网络有问题的解决办法
  • (转)C语言家族扩展收藏 (转)C语言家族扩展
  • (转)Java socket中关闭IO流后,发生什么事?(以关闭输出流为例) .