FileA.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:22k
- using System;
- using System.Data;
- using System.Collections;
- using System.Data.SqlClient;
- using qminoa.Common;
- using qminoa.DA;
- namespace qminoa.DA
- {
- public class FileA:IDisposable
- {
- private SqlDataAdapter dsCommand;
- private SqlConnection mySqlConnection;
- private const string DOCID_PARM = "@DocID";
- private const string FOLDERID_PARM = "@FolderID";
- private const string HIFOLDERID_PARM = "@HiFolderID";
- private const string FOLDERNAME_PARM = "@FolderName";
- private const string FNAME_PARM ="@FName";
- private const string NOTE_PARM = "@Note";
- private const string IHERCTR_PARM = "@IherCtr";
- private const string CDATE_PARM = "@CDate";
- private const string UDATE_PARM = "@UDate";
- private const string EMPID_PARM = "@EmpID";
- private const string DDATE_PARM = "@DDate";
- private const string STATUS_PARM = "@Status";
- private const string DEMPID_PARM = "@dempid";
- private const string KEYWORD_PARM ="@keyword";
- private const string TYPEID_PARM ="@typeid";
- private const string LAYER_PARM = "@layer";//处理文档时用
- private const string FSIZE_PARM="@fsize";
- private const string FTYPE_PARM="@ftype";
- private const string FPATH_PARM="@fpath";
- private const string CONT_PARM="@Cont";
- private const string OPT_PARM="@opt";
- private const string FIlECONTID_PARM ="@filecontid";
- private const string SEARCHTEXT_PARM="@searchtext";
- private const string DOCTYPE_PARM="@doctype";
- public ArrayList arrlist;
- public ArrayList arrlistDoc;
- public Stack pathstack;
- public string CONN=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
-
- public FileA()
- {
- mySqlConnection = new SqlConnection(CONN.ToString());
- }
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (! disposing)
- return;
- if (dsCommand != null)
- {
- if(dsCommand.SelectCommand != null)
- {
- if( dsCommand.SelectCommand.Connection != null )
- dsCommand.SelectCommand.Connection.Dispose();
- dsCommand.SelectCommand.Dispose();
- }
- dsCommand.Dispose();
- dsCommand = null;
- }
- }
- public FileData GetFolderTree()
- {
- dsCommand = new SqlDataAdapter("fmLoadFolderTree",CONN);
- if ( dsCommand == null )
- {
- throw new System.ObjectDisposedException( GetType().FullName );
- }
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMDOCFOLDER_TABLE);
- return data;
- }
- public FileData LoadFile()
- {
- dsCommand = new SqlDataAdapter("fmLoadFileInfo",CONN);
- if ( dsCommand == null )
- {
- throw new System.ObjectDisposedException( GetType().FullName );
- }
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMDOCFOLDER_TABLE);
- return data;
- }
- public FileData LoadSubFolder(int folderid)
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- dsCommand.SelectCommand = mySqlConnection.CreateCommand();
- dsCommand.SelectCommand.CommandText="fmloadsubfolder";
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = dsCommand.SelectCommand.Parameters;
- sqlParams.Add(new SqlParameter(FOLDERID_PARM, SqlDbType.Int));
- sqlParams[FOLDERID_PARM].Value=folderid;
- dsCommand.SelectCommand.ExecuteNonQuery();
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMDOCFOLDER_TABLE);
- mySqlConnection.Close();
- return data;
- }
- public FileData LoadhiFolder(int folderid)
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- dsCommand.SelectCommand = mySqlConnection.CreateCommand();
- dsCommand.SelectCommand.CommandText="fmloadhifolderid";
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = dsCommand.SelectCommand.Parameters;
- sqlParams.Add(new SqlParameter(FOLDERID_PARM, SqlDbType.Int));
- sqlParams[FOLDERID_PARM].Value=folderid;
- dsCommand.SelectCommand.ExecuteNonQuery();
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMDOCFOLDER_TABLE);
- mySqlConnection.Close();
- return data;
- }
- public void ChangFolderInfo(int folderid,int hifolderid,string name,string note,DateTime Cdate,bool iherctr,int empid,int TypeId)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmSaveFolder";
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(FOLDERNAME_PARM, SqlDbType.NVarChar,64 ));
- sqlParams.Add(new SqlParameter(NOTE_PARM, SqlDbType.NVarChar,128 ));
- sqlParams.Add(new SqlParameter(FOLDERID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(HIFOLDERID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(CDATE_PARM, SqlDbType.DateTime));
- sqlParams.Add(new SqlParameter(EMPID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(IHERCTR_PARM, SqlDbType.Bit));
- sqlParams.Add(new SqlParameter(STATUS_PARM,SqlDbType.Bit));
- sqlParams.Add(new SqlParameter(TYPEID_PARM,SqlDbType.Int));
- sqlParams[FOLDERNAME_PARM].Value = name;
- sqlParams[NOTE_PARM].Value =note;
- sqlParams[FOLDERID_PARM].Value =folderid;
- sqlParams[HIFOLDERID_PARM].Value =hifolderid;
- sqlParams[CDATE_PARM].Value=Cdate;
- sqlParams[IHERCTR_PARM].Value =iherctr;
- sqlParams[EMPID_PARM].Value =empid;
- sqlParams[STATUS_PARM].Value =0;
- sqlParams[TYPEID_PARM].Value =TypeId;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
-
- public void ChangDocInfo(int folderid,string name,string note,DateTime Cdate,string keyword,int empid,int TypeId,int layer)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmSaveDoc";
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(FOLDERID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(FNAME_PARM, SqlDbType.NVarChar,64 ));
- sqlParams.Add(new SqlParameter(NOTE_PARM, SqlDbType.NVarChar,128 ));
- sqlParams.Add(new SqlParameter(CDATE_PARM, SqlDbType.DateTime));
- sqlParams.Add(new SqlParameter(EMPID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(LAYER_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(TYPEID_PARM,SqlDbType.Int));
- sqlParams.Add(new SqlParameter(KEYWORD_PARM,SqlDbType.NVarChar,128));
- sqlParams.Add(new SqlParameter(STATUS_PARM,SqlDbType.Bit));
- sqlParams[FNAME_PARM].Value = name;
- sqlParams[NOTE_PARM].Value =note;
- sqlParams[FOLDERID_PARM].Value =folderid;
- sqlParams[CDATE_PARM].Value=Cdate;
- sqlParams[EMPID_PARM].Value =empid;
- sqlParams[TYPEID_PARM].Value =TypeId;
- sqlParams[KEYWORD_PARM].Value =keyword;
- sqlParams[LAYER_PARM].Value =layer;
- sqlParams[STATUS_PARM].Value =0;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
-
- public FileData LoadDocFolder(int FolderID)
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- if ( dsCommand == null )
- {
- throw new System.ObjectDisposedException( GetType().FullName );
- }
- dsCommand.SelectCommand = mySqlConnection.CreateCommand();
- dsCommand.SelectCommand.Parameters.Add(FOLDERID_PARM,SqlDbType.Int);
- dsCommand.SelectCommand.Parameters[FOLDERID_PARM].Value=FolderID;
- dsCommand.SelectCommand.CommandText="fmLoadDoc";
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- dsCommand.SelectCommand.ExecuteNonQuery();
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMDOCFOLDER_TABLE);
- mySqlConnection.Close();
- return data;
- }
-
- public FileData GetAllTypes()
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- if ( dsCommand == null )
- {
- throw new System.ObjectDisposedException( GetType().FullName );
- }
- dsCommand.SelectCommand = mySqlConnection.CreateCommand();
- dsCommand.SelectCommand.CommandText="fmGetAllTypes";
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- dsCommand.SelectCommand.ExecuteNonQuery();
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMFILEATT_TABLE);
- mySqlConnection.Close();
- return data;
- }
- public FileData SeachAllDocs(int flag)
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- if ( dsCommand == null )
- {
- throw new System.ObjectDisposedException(GetType().FullName );
- }
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmSeachAllDocs";
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter("@flag", SqlDbType.Int));
- sqlParams["@flag"].Value = flag;
- dsCommand.SelectCommand= command;
- dsCommand.SelectCommand.ExecuteNonQuery();
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMDOC_TABLE );
- mySqlConnection.Close();
- return data;
- }
- public FileData ShowAllFileCont()
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- if ( dsCommand == null )
- {
- throw new System.ObjectDisposedException( GetType().FullName );
- }
- dsCommand.SelectCommand = mySqlConnection.CreateCommand();
- dsCommand.SelectCommand.CommandText="fmGetAllFileCont";
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- dsCommand.SelectCommand.ExecuteNonQuery();
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FILECONT_TABLE);
- mySqlConnection.Close();
- return data;
- }
- public FileData GetNullFileCont()
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- if ( dsCommand == null )
- {
- throw new System.ObjectDisposedException( GetType().FullName );
- }
- dsCommand.SelectCommand = mySqlConnection.CreateCommand();
- dsCommand.SelectCommand.CommandText="fmGetNullFileCont";
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- dsCommand.SelectCommand.ExecuteNonQuery();
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FILECONT_TABLE);
- mySqlConnection.Close();
- return data;
- }
- public void InsertFileCont(int docid,string fname,string fpath,int size,string ftype,byte[] filecont,string dtype)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmInsertFileCont";
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(DOCID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(FNAME_PARM, SqlDbType.NVarChar,64 ));
- sqlParams.Add(new SqlParameter(FSIZE_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(FTYPE_PARM, SqlDbType.NVarChar,128));
- sqlParams.Add(new SqlParameter(FPATH_PARM, SqlDbType.NVarChar,128));
- sqlParams.Add(new SqlParameter(CONT_PARM, SqlDbType.Image));
- sqlParams.Add(new SqlParameter(DOCTYPE_PARM,SqlDbType.NVarChar,10));
- sqlParams[DOCID_PARM].Value = docid;
- sqlParams[FNAME_PARM].Value = fname;
- sqlParams[FSIZE_PARM].Value = size;
- sqlParams[FPATH_PARM].Value = fpath;
- sqlParams[FTYPE_PARM].Value = ftype;
- sqlParams[CONT_PARM].Value = filecont;
- sqlParams[DOCTYPE_PARM].Value = dtype;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
-
- public void DeleteFolder(int folderid,int empid,int flag)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmFolderDelFlag";
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(EMPID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(FOLDERID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter("@flag", SqlDbType.Int));
- sqlParams[EMPID_PARM].Value=empid;
- sqlParams[FOLDERID_PARM].Value=folderid;
- sqlParams["@flag"].Value=flag;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
-
- public void DeleteDoc(int Docid,int empid)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmDocDelFlag";
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(EMPID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(DOCID_PARM, SqlDbType.Int));
- sqlParams[EMPID_PARM].Value=empid;
- sqlParams[DOCID_PARM].Value=Docid;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
- public ArrayList GetDelFolderId(int folderid)
- {
- arrlist =new ArrayList();
- arrlist.Add(folderid);
- DataView dvdata = SubFolderView(folderid);
- AddToArrlist(arrlist,dvdata);
- return arrlist;
- }
- public static DataView SubFolderView(int folderid)
- {
- FileData filedata =(new FileA()).LoadhiFolder(folderid);
- DataView dvdata =filedata.Tables[FileData.FMDOCFOLDER_TABLE].DefaultView;
- return dvdata;
- }
- private static void AddToArrlist(ArrayList arrlist,DataView dvdata)
- {
- int recordId;
- int recordcount;
- int i;
- recordcount=dvdata.Count;
- if(recordcount!=0)
- {
- for(i=0;i<recordcount ;i++)
- {
- recordId = Convert.ToInt32(dvdata[i].Row[0].ToString());
- arrlist.Add(recordId);
- DataView dv = SubFolderView(recordId);
- AddToArrlist(arrlist,dv);
- }
- }
- }
-
- public ArrayList GetDelDocId(ArrayList arrlist)
- {
- int i;
- int j;
- FileData filedata;
- arrlistDoc=new ArrayList();
- for(i=0;i<arrlist.Count;i++)
- {
- int fid=Convert.ToInt32(arrlist[i].ToString(),10) ;
- filedata=SeachAllDocs(0);
- DataView dvdata = filedata.Tables[FileData.FMDOC_TABLE].DefaultView;
-
- if(dvdata.Count!=0)
- {
- dvdata.RowFilter= "FolderId="+fid;
- int recordcount =dvdata.Count;
- for(j=0;j<recordcount;j++)
- {
- int recordid=Convert.ToInt32(dvdata[j].Row[0].ToString(),10);
- arrlistDoc.Add(recordid);
-
- }
- }
- }
- return arrlistDoc;
- }
- public ArrayList GetDelDocIdForReuse(ArrayList arrlist)
- {
- int i;
- int j;
- FileData filedata;
- arrlistDoc=new ArrayList();
- for(i=0;i<arrlist.Count;i++)
- {
- int fid=Convert.ToInt32(arrlist[i].ToString(),10) ;
- filedata=SeachAllDocs(1);
- DataView dvdata = filedata.Tables[FileData.FMDOC_TABLE].DefaultView;
- if(dvdata.Count!=0)
- {
- dvdata.RowFilter= "FolderId="+fid;
- int recordcount =dvdata.Count;
- for(j=0;j<recordcount;j++)
- {
- int recordid=Convert.ToInt32(dvdata[j].Row[0].ToString(),10);
- arrlistDoc.Add(recordid);
- }
- }
- }
- return arrlistDoc;
- }
-
- public FileData LoadRecycleFile()
- {
- dsCommand = new SqlDataAdapter("fmLoadRecycleFileInfo",CONN);
- if ( dsCommand == null )
- {
- throw new System.ObjectDisposedException( GetType().FullName );
- }
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMDOC_TABLE);
- return data;
- }
-
- public void DoRecycle(int opt,int docid)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmDoRecycle";
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(OPT_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(DOCID_PARM, SqlDbType.Int));
- sqlParams[OPT_PARM].Value=opt;
- sqlParams[DOCID_PARM].Value=docid;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
-
- public string GetDocPath(int folderid)
- {
- int id=folderid;
- string path="C:";
- pathstack=new Stack();
- if(id==0)
- {
- return path+"\";
- }
- else
- {
- pathstack.Push(id);
- int fid=gethifolderid(id);
- if(fid==0)
- {
- path=path+"\"+FileA.getfoldername(id);
- }
- else
- {
- pathstack.Push(fid);
-
- id=fid;
- while(fid!=0)
- {
- fid=gethifolderid(id);
- pathstack.Push(fid);
- id=fid;
- }
- pathstack.Pop();
- int recordcount=pathstack.Count;
- for(int j=0;j<recordcount;j++)
- {
- int foldid=Convert.ToInt32(pathstack.Pop());
- if(foldid!=0)
- {
- path=path+"\"+FileA.getfoldername(foldid);
- }
- }
- }
- return path;
- }
- }
-
- public static int gethifolderid(int folderid)
- {
- FileData filedata = (new FileA()).LoadSubFolder(folderid);
- DataView dv=filedata.Tables[FileData.FMDOCFOLDER_TABLE].DefaultView;
- int hifolder=Convert.ToInt32(dv[0].Row[2].ToString(),10);
- return hifolder;
- }
-
- public static string getfoldername(int folderid)
- {
- FileData filedata = (new FileA()).LoadSubFolder(folderid);
- DataView dv=filedata.Tables[FileData.FMDOCFOLDER_TABLE].DefaultView;
- string name=dv[0].Row[15].ToString();
- return name;
- }
-
- public void DeleteFileCont(int filecontId)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmDeleteFileCont";//
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(FIlECONTID_PARM, SqlDbType.Int));
- sqlParams[FIlECONTID_PARM].Value=filecontId;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
- public void MoveFolder(int folderform,int folderto)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmMoveFolder";//
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter("@folderfrom", SqlDbType.Int));
- sqlParams.Add(new SqlParameter("@folderto", SqlDbType.Int));
- sqlParams["@folderfrom"].Value=folderform;
- sqlParams["@folderto"].Value=folderto;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
-
- public void UpdateFileCont()
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmUpdateFileCont";//
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(DOCID_PARM, SqlDbType.Int));
- sqlParams.Add(new SqlParameter(OPT_PARM, SqlDbType.Int));
- sqlParams[DOCID_PARM].Value=0;
- sqlParams[OPT_PARM].Value=1;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
- public void MoveDoc(int docid,int folderid)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmMoveDoc";//
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter(DOCID_PARM,SqlDbType.Int));
- sqlParams.Add(new SqlParameter(FOLDERID_PARM,SqlDbType.Int));
- sqlParams[DOCID_PARM].Value=docid;
- sqlParams[FOLDERID_PARM].Value=folderid;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
-
- public void DeleteRight(int conid,int opt)
- {
- mySqlConnection.Open();
- SqlCommand command = mySqlConnection.CreateCommand();
- command.CommandText ="fmDeleteFolderRight";
- command.CommandType =CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = command.Parameters;
- sqlParams.Add(new SqlParameter("@ConId", SqlDbType.Int));
- sqlParams["@ConId"].Value=conid;
- sqlParams.Add(new SqlParameter("@opt", SqlDbType.Int));
- sqlParams["@opt"].Value=opt;
- command.ExecuteNonQuery();
- mySqlConnection.Close();
- }
-
- public FileData SearchForDoc(string name,string keyword,string content,string empname)
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- dsCommand.SelectCommand = mySqlConnection.CreateCommand();
- dsCommand.SelectCommand.CommandText="fmSearchDoc";
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = dsCommand.SelectCommand.Parameters;
- sqlParams.Add(new SqlParameter("@docname", SqlDbType.NVarChar,50));
- sqlParams["@docname"].Value="%"+name+"%";
- sqlParams.Add(new SqlParameter("@keyword", SqlDbType.NVarChar,50));
- sqlParams["@keyword"].Value="%"+keyword+"%";
- sqlParams.Add(new SqlParameter("@content", SqlDbType.NVarChar,50));
- sqlParams["@content"].Value=content;
- sqlParams.Add(new SqlParameter("@empname", SqlDbType.NVarChar,50));
- sqlParams["@empname"].Value="%"+empname+"%";
- dsCommand.SelectCommand.ExecuteNonQuery();
- FileData data = new FileData();
- dsCommand.Fill(data,FileData.FMDOCFOLDER_TABLE);
- int count=data.Tables[FileData.FMDOCFOLDER_TABLE].DefaultView.Count;
- mySqlConnection.Close();
- return data;
-
- }
- public string GetEmpName(int empid)
- {
- mySqlConnection.Open();
- dsCommand = new SqlDataAdapter();
- dsCommand.SelectCommand = mySqlConnection.CreateCommand();
- dsCommand.SelectCommand.CommandText="fmGetMrBaseInfo";
- dsCommand.SelectCommand.CommandType=CommandType.StoredProcedure;
- SqlParameterCollection sqlParams = dsCommand.SelectCommand.Parameters;
- sqlParams.Add(new SqlParameter("@opt", SqlDbType.Int));
- sqlParams["@opt"].Value=2;
- DataTable data = new DataTable();
- dsCommand.Fill(data);
- string empname;
- DataView dv=data.DefaultView;
- dv.RowFilter="Empid="+empid;
- if(dv.Count!=0)
- {
- empname=dv[0].Row[1].ToString();
- }
- else
- {
- empname="";
- }
- return empname;
- }
- }
- }