📄 persondatum.cs
字号:
using System;
using System.Data ;
using System.Data .SqlClient ;
using System.Web ;
using System.IO ;
namespace OI.PersonSend
{
/// <summary>
/// personDatum 的摘要说明。
/// </summary>
public class personDatum :System.Web .UI .Page
{
protected OI.DatabaseOper .DatabaseConnect Dbc=new OI.DatabaseOper.DatabaseConnect ();
public personDatum()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public string GetUpFilePath(string upfileValue,HttpPostedFile upfiles)
{
string strFileNameT=upfileValue ;
if(strFileNameT.Trim ()=="")
{
return "";
}
// HttpPostedFile upfiles=UpFile.PostedFile ;
if(upfiles.ContentLength >8388608)//上传文件8M限制
return "TooBig,,,,,,,,,,,,,,,,,,";
if (upfiles.ContentLength >0)
{
string fileName;
string path =Server.MapPath(OI.Modules.Config.GetSetting("documents")); //reportAccessories
try
{
fileName=OI.Modules.FileName.NewFileName(upfiles.FileName);
upfiles.SaveAs (path+"\\"+fileName) ;
}
catch
{
fileName="false";
//throw new AppException("路径错误:"+path, e);
}
return fileName;
}
else
{
return "";
}
}
public void AddSaveDatum(string title,string content,string savepath,int userid)
{
string savedate=System.DateTime .Now.ToString () ;
string sql="insert into datumsave (title, content,savepath,savedate,userid )values (";
sql +="'"+title +"'";
sql +=",'"+content+"'";
sql +=",'"+savepath+"'";
sql +=",'"+savedate+"'";
sql +=","+userid.ToString () +")";
try
{
Dbc.ExecuteSQL (sql);
}
catch(Exception er)
{
throw new ApplicationException (er.Message );
}
}
public DataTable GetAllSaveDataByUserID(int userid)
{
string sql="select * from datumsave where userid="+userid.ToString () +" order by savedate desc ";
try
{
return Dbc.getBinding (sql,"t").Tables[0] ;
}
catch(Exception er)
{
throw new ApplicationException (er.Message );
}
}
public void DelSaveDataByID(int ID)
{
string sql="delete from datumsave where id="+ID.ToString () ;
try
{
Dbc.ExecuteSQL (sql);
}
catch(Exception er)
{
throw new ApplicationException (er.Message );
}
}
public void ModifySaveDataByID(int ID,string title,string content)
{
string sql=" update datumsave set title='"+title+"' ,content='"+content+"',savedate='"+System.DateTime .Now.ToString () +"'";
sql +=" where id="+ID.ToString ();
try
{
Dbc.ExecuteSQL (sql);
}
catch(Exception er)
{
throw new ApplicationException (er.Message );
}
}
public DataRow GetRowSaveDataByID(int id)
{
string sql="select * from datumsave where id="+id.ToString ();
try
{
DataTable dt= Dbc.getBinding (sql,"t").Tables[0] ;
if (dt.Rows .Count ==0)
{
throw new ApplicationException ("没有找到相关数据...." );
}
else
{
return dt.Rows [0];
}
}
catch(Exception er)
{
throw new ApplicationException (er.Message );
}
}
public string GetSavePathByID(int ID)
{
string sql="select savepath from datumsave where id="+ID.ToString ();
try
{
object o=Dbc.GetObjectBySql (sql);
if (o==null)
{
return "";
}
else
{
return o.ToString ();
}
}
catch(Exception er)
{
throw new ApplicationException (er.Message );
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -