还是关于Linq-sql的问题
发布到IIS只是初始运行没有问题,当你登录一个用户>1小时不操作后,也会在规定的时候内被系统踢下线,可是在次登录的时候却不正常因为了,好像是数据库那一块死了。不知道如何去解决,还请高手帮忙,谢谢了。
下面是其中一个文件的写法,其他的都是一样的写法
Code
#region "根据ProjectID返回资料信息数据集合"
/// <summary>
/// 根据ProjectID返回资料信息数据集合
/// </summary>
/// <param name="ProjectID">项目编码</param>
/// <returns></returns>
public static ArrayList CustomerDataArrayList(int ProjectID,out int RecordCount)
{
ArrayList lst = new ArrayList();
using (ProjectDataClassesDataContext DataContext = new ProjectDataClassesDataContext())
{
var q = from p in DataContext.project_CustomerData
where p.ProjectID == ProjectID
orderby p.CustomerDataID descending
select p;
foreach (var var in q)
{
PGGSOA.COMMON.Components.CustomerData ct = new PGGSOA.COMMON.Components.CustomerData();
ct.CustomerDataID = var.CustomerDataID;
ct.ProjectID = (int)var.ProjectID;
ct.Title = var.Title;
ct.Title_Topic = var.Title_Topic;
ct.Medium = var.Medium;
ct.InfoChannels = var.InfoChannels;
ct.DataContent = var.DataContent;
ct.AddTime = (DateTime)var.AddTime;
ct.UserID = (int)var.UserID;
lst.Add(ct);
}
RecordCount = q.Count();
}
return lst;
}
#endregion
#region "根据自动编码ID返回项目信息"
/// <summary>
/// 根据自动编码ID返回项目信息
/// </summary>
/// <param name="CustomerDataID">资料编码ID</param>
/// <returns></returns>
public static PGGSOA.COMMON.Components.CustomerData CustomerDataDisp(int CustomerDataID)
{
PGGSOA.COMMON.Components.CustomerData ct = new PGGSOA.COMMON.Components.CustomerData();
using (ProjectDataClassesDataContext DataContext = new ProjectDataClassesDataContext())
{
var q = (from p in DataContext.project_CustomerData
where p.CustomerDataID == CustomerDataID
select p).FirstOrDefault();
if (q != null)
{
ct.CustomerDataID = q.CustomerDataID;
ct.ProjectID = (int)q.ProjectID;
ct.Title = q.Title;
ct.Title_Topic = q.Title_Topic;
ct.Medium = q.Medium;
ct.InfoChannels = q.InfoChannels;
ct.DataContent = q.DataContent;
ct.AddTime = (DateTime)q.AddTime;
ct.UserID = (int)q.UserID;
}
}
return ct;
}
#endregion
#region "甲方/相关资料操作方法"
/// <summary>
/// 甲方/相关资料操作方法 添加、修改、删除
/// </summary>
/// <param name="ct"></param>
/// <returns></returns>
public static bool CustomerDataExecute(PGGSOA.COMMON.Components.CustomerData ct)
{
bool rBool = false;
using (ProjectDataClassesDataContext DataContext = new ProjectDataClassesDataContext())
{
if (ct.DB_Option_Action_ == "Insert")
{
var q = new project_CustomerData
{
ProjectID = (int)ct.ProjectID,
Title = ct.Title,
Title_Topic = ct.Title_Topic,
Medium = ct.Medium,
InfoChannels = ct.InfoChannels,
DataContent = ct.DataContent,
AddTime = (DateTime)ct.AddTime,
UserID = (int)ct.UserID
};
DataContext.project_CustomerData.InsertOnSubmit(q);
DataContext.SubmitChanges();
rBool = true;
}
else if (ct.DB_Option_Action_ == "Update")
{
var q = (from p in DataContext.project_CustomerData
where p.CustomerDataID == ct.CustomerDataID
select p).FirstOrDefault();
if (q != null)
{
q.Title = ct.Title;
q.Title_Topic = ct.Title_Topic;
q.Medium = ct.Medium;
q.InfoChannels = ct.InfoChannels;
q.DataContent = ct.DataContent;
DataContext.SubmitChanges();
rBool = true;
}
}
else if (ct.DB_Option_Action_ == "Delete")
{
var q = (from p in DataContext.project_CustomerData
where p.CustomerDataID == ct.CustomerDataID
select p).FirstOrDefault();
if (q != null)
{
DataContext.project_CustomerData.DeleteOnSubmit(q);
DataContext.SubmitChanges();
rBool = true;
}
}
else
{
//出现错误 友好错误提示
}
}
return rBool;
}
#endregion