📄 default.aspx.cs
字号:
/// <param name="tel"></param>
/// <param name="mobile"></param>
/// <param name="qQ"></param>
/// <param name="email"></param>
/// <param name="address"></param>
/// <param name="explian"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public bool addressListUpdate(int id,string trueName,string niceName,int sortID,string birthday,string tel,string mobile,string qQ,string email,string address,string explian)
{
c_AddressListInfo _c_AddressListInfo = Globals.DbProvider.Select_c_AddressListByID(id); _c_AddressListInfo.TrueName = trueName; _c_AddressListInfo.NiceName = niceName; _c_AddressListInfo.SortID =sortID; _c_AddressListInfo.Birthday = DateTime.Parse(birthday); _c_AddressListInfo.Tel = tel; _c_AddressListInfo.Mobile = mobile; _c_AddressListInfo.QQ = qQ; _c_AddressListInfo.Email = email; _c_AddressListInfo.Address = address; _c_AddressListInfo.Explian = explian; _c_AddressListInfo.RegisterID = this.RegisterId;
return Globals.DbProvider.Update_c_AddressListInfo(_c_AddressListInfo);
}
/// <summary>
/// 删除通讯录
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public bool addressListDelete(int id)
{
return Globals.DbProvider.Delete_c_AddressListByID(id);
}
/// <summary>
/// 转移通讯录
/// </summary>
/// <param name="sortID"></param>
/// <param name="ids"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public int addressListMove(int sortID,string ids)
{
return Globals.DbProvider.NonQueryInt("Update c_AddressList set SortID="+sortID+" where ID in ("+ids.Trim(',')+")");
}
#endregion
#region 网址收藏夹操作
[Ajax.AjaxMethod()]
public bool favoriteAdd(string url,string title,string explain,int sortID)
{
c_FavoriteInfo _c_FavoriteInfo=new c_FavoriteInfo();
_c_FavoriteInfo.Explain = explain;
_c_FavoriteInfo.RegisterID = this.RegisterId;
_c_FavoriteInfo.SortID = sortID;
_c_FavoriteInfo.Title= title;
_c_FavoriteInfo.Url= url;
return Globals.DbProvider.Create_c_FavoriteInfo(_c_FavoriteInfo);
}
/// <summary>
/// 删除收藏地址
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public bool favoriteDelete(int id)
{
return Globals.DbProvider.Delete_c_FavoriteByID(id);
}
/// <summary>
/// 转移收藏地址
/// </summary>
/// <param name="sortID"></param>
/// <param name="ids"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public int favoriteMove(int sortID,string ids)
{
return Globals.DbProvider.NonQueryInt("Update c_Favorite set SortID="+sortID+" where ID in ("+ids.Trim(',')+")");
}
/// <summary>
/// 更新收藏夹
/// </summary>
/// <param name="url"></param>
/// <param name="title"></param>
/// <param name="explain"></param>
/// <param name="sortID"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public bool favoriteUpdate(int id,string url,string title,string explain,int sortID)
{
c_FavoriteInfo _c_FavoriteInfo=Globals.DbProvider.Select_c_FavoriteByID(id);
_c_FavoriteInfo.Explain = explain;
_c_FavoriteInfo.RegisterID = this.RegisterId;
_c_FavoriteInfo.SortID = sortID;
_c_FavoriteInfo.Title= title;
_c_FavoriteInfo.Url= url;
return Globals.DbProvider.Update_c_FavoriteInfo(_c_FavoriteInfo);
}
#endregion
#region 图片操作
[Ajax.AjaxMethod()]
public bool photoAdd(string photoName,string photoExplian,int sortID,bool isUpLoad,int photoType,int circleID,string imageName)
{
c_PhotoInfo _c_PhotoInfo=new c_PhotoInfo();
_c_PhotoInfo.PhotoName = photoName;
_c_PhotoInfo.PhotoExplian = photoExplian; _c_PhotoInfo.PostDate = DateTime.Now; _c_PhotoInfo.SortID = sortID; _c_PhotoInfo.RegisterID = this.RegisterId; _c_PhotoInfo.IsUpLoad =isUpLoad; _c_PhotoInfo.PhotoType = photoType; _c_PhotoInfo.CircleID = circleID; if(_c_PhotoInfo.IsUpLoad) { _c_PhotoInfo.ImageName = imageName; string photoPath=Globals.GetFilePath(Config.ClubPhotoPath); if(Config.Settings.UpFileIsMakeDir) { photoPath = photoPath+this.RegisterId+"\\"; } System.IO.FileInfo file=new System.IO.FileInfo(photoPath+_c_PhotoInfo.ImageName); _c_PhotoInfo.PhotoSize = System.Convert.ToInt32(file.Length); }
else { string photoPath=Globals.GetFilePath(Config.ClubPhotoPath);
string photoSPath=Globals.GetFilePath(Config.ClubSPhotoPath); if(Config.Settings.UpFileIsMakeDir)
{
photoPath=photoPath+this.RegisterId+"\\";
photoSPath=photoSPath+this.RegisterId+"\\";
FileHelper.AddFolder(photoPath);
FileHelper.AddFolder(photoSPath);
} WebClient _webClient = new WebClient();
//下载远程文件资源
byte[] buff = _webClient.DownloadData(imageName);
_c_PhotoInfo.PhotoSize = buff.Length;
if(buff.Length==0)
{
return false;
}
this.userDataCount = Globals.DbProvider.GetUserCountInfo(this.RegisterId);
this.setting=Globals.DbProvider.Select_c_HomeSettingByRegisterID(this.RegisterId);
if(this.setting==null)
{
this.setting=new c_HomeSettingInfo();
}
if((this.userDataCount.UseCapabilitySize+buff.Length)/1048576.0>this.setting.CapabilitySize)
{
//个人空间不足,返回;
return false;
}
imageName = StringHelper.GetDataRandom()+"."+StringHelper.GetLastStr(imageName,".");
using(FileStream fs = new FileStream(Globals.GetFilePath(photoPath+imageName),FileMode.Create,FileAccess.Write))
{
fs.Write(buff,0,buff.Length);
fs.Close();
} ImageHelper _imageHelper=new ImageHelper();
_imageHelper.SourcePath = photoPath+imageName;
_imageHelper.SavePath = photoSPath+imageName;
try
{
_imageHelper.MakeAlbumImages(100,100);
}
catch
{
return false;
} _c_PhotoInfo.ImageName = imageName; } return Globals.DbProvider.Create_c_PhotoInfo(_c_PhotoInfo); }
/// <summary>
/// 更新图片信息
/// </summary>
/// <param name="id"></param>
/// <param name="photoName"></param>
/// <param name="photoExplian"></param>
/// <param name="sortID"></param>
/// <param name="isUpLoad"></param>
/// <param name="photoType"></param>
/// <param name="circleID"></param>
/// <param name="imageName"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public bool photoUpdate(int id,string photoName,string photoExplian,int sortID,bool isUpLoad,int photoType,int circleID,string imageName)
{
c_PhotoInfo _c_PhotoInfo=Globals.DbProvider.Select_c_PhotoByID(id);
_c_PhotoInfo.PhotoName = photoName;
_c_PhotoInfo.PhotoExplian = photoExplian; _c_PhotoInfo.PostDate = DateTime.Now; _c_PhotoInfo.SortID = sortID; _c_PhotoInfo.RegisterID = this.RegisterId; _c_PhotoInfo.IsUpLoad =isUpLoad; _c_PhotoInfo.PhotoType = photoType; _c_PhotoInfo.CircleID = circleID;
if(_c_PhotoInfo.IsUpLoad) { if(_c_PhotoInfo.ImageName!=imageName) { _c_PhotoInfo.ImageName = imageName; string photoPath=Globals.GetFilePath(Config.ClubPhotoPath); if(Config.Settings.UpFileIsMakeDir) { photoPath = photoPath+this.RegisterId+"\\"; } System.IO.FileInfo file=new System.IO.FileInfo(photoPath+_c_PhotoInfo.ImageName); _c_PhotoInfo.PhotoSize = System.Convert.ToInt32(file.Length); } }
else { string photoPath=Globals.GetFilePath(Config.ClubPhotoPath);
string photoSPath=Globals.GetFilePath(Config.ClubSPhotoPath); if(Config.Settings.UpFileIsMakeDir)
{
photoPath=photoPath+this.RegisterId+"\\";
photoSPath=photoSPath+this.RegisterId+"\\";
FileHelper.AddFolder(photoPath);
FileHelper.AddFolder(photoSPath);
} WebClient _webClient = new WebClient();
//下载远程文件资源
byte[] buff = _webClient.DownloadData(imageName);
_c_PhotoInfo.PhotoSize = buff.Length;
if(buff.Length==0)
{
return false;
}
this.userDataCount = Globals.DbProvider.GetUserCountInfo(this.RegisterId);
this.setting=Globals.DbProvider.Select_c_HomeSettingByRegisterID(this.RegisterId);
if(this.setting==null)
{
this.setting=new c_HomeSettingInfo();
}
if((this.userDataCount.UseCapabilitySize+buff.Length)/1048576.0>this.setting.CapabilitySize)
{
//个人空间不足,返回;
return false;
}
imageName = StringHelper.GetDataRandom()+"."+StringHelper.GetLastStr(imageName,".");
using(FileStream fs = new FileStream(Globals.GetFilePath(photoPath+imageName),FileMode.Create,FileAccess.Write))
{
fs.Write(buff,0,buff.Length);
fs.Close();
} ImageHelper _imageHelper=new ImageHelper();
_imageHelper.SourcePath = photoPath+imageName;
_imageHelper.SavePath = photoSPath+imageName;
try
{
_imageHelper.MakeAlbumImages(100,100);
}
catch
{
return false;
} _c_PhotoInfo.ImageName = imageName; }
return Globals.DbProvider.Update_c_PhotoInfo(_c_PhotoInfo);
}
/// <summary>
/// 删除图片
/// </summary>
/// <param name="imgName"></param>
[Ajax.AjaxMethod()]
public void delImage(string imgName)
{
string photoPath=Globals.GetFilePath(Config.ClubPhotoPath);
string photoSPath=Globals.GetFilePath(Config.ClubSPhotoPath);
if(Config.Settings.UpFileIsMakeDir)
{
photoPath=photoPath+this.RegisterId+"\\";
photoSPath=photoSPath+this.RegisterId+"\\";
}
FileHelper.DelFileExe(photoPath+imgName);
FileHelper.DelFileExe(photoSPath+imgName);
}
/// <summary>
/// 图片删除
/// </summary>
/// <param name="id"></param>
/// <param name="imageName"></param>
[Ajax.AjaxMethod()]
public bool photoDel(int id,string imageName)
{
this.delImage(imageName);
return Globals.DbProvider.Delete_c_PhotoByID(id);
}
[Ajax.AjaxMethod()]
public int photoMove(int sortID,string ids)
{
return Globals.DbProvider.NonQueryInt("Update c_Photo set SortID="+sortID+" where ID in ("+ids.Trim(',')+")");
}
/// <summary>
/// 移动照片
/// </summary>
/// <param name="id"></param>
/// <param name="orderId"></param>
/// <param name="eId"></param>
/// <param name="eOrderId"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public bool photoUpDown(int id,int orderId,int eId,int eOrderId)
{
Globals.DbProvider.NonQueryInt("update c_Photo set orderId="+eOrderId+" where id="+id);
Globals.DbProvider.NonQueryInt("update c_Photo set orderId="+orderId+" where id="+eId);
return true;
}
#endregion
#region 文集操作
/// <summary>
/// 文章添加
/// </summary>
/// <param name="title"></param>
/// <param name="content"></param>
/// <param name="articleType"></param>
/// <param name="sortID"></param>
/// <returns></returns>
[Ajax.AjaxMethod()]
public bool articleAdd(string title,string content,int articleType,int sortID)
{
c_ArticleInfo _c_ArticleInfo=new c_ArticleInfo();
_c_ArticleInfo.PostDate = DateTime.Now;
_c_ArticleInfo.Title = title;
_c_ArticleInfo.Content = content;
_c_ArticleInfo.RegisterID = this.RegisterId;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -