예제 #1
0
 public ArgsHelp DeleteFloder(string floderName, string path)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         if (Directory.Exists(path))
         {
             Directory.Delete(path, true);
         }
         else
         {
             ah.flag = false;
             ah.msg = "不存在文件夹!";
         }
         var floder = (from fd in userFloderDB.userfloder where fd.floder_name == floderName select fd).First();
         userFloderDB.userfloder.DeleteOnSubmit(floder);
         userFloderDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
 public ArgsHelp AddAccessoriesNoJs(string filePath, string fileName, string fileID)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         GlobalVar.AttachmentID.Clear();
         // Create  the file attachment for this e-mail message.
         Attachment data = new Attachment(filePath, MediaTypeNames.Application.Octet);//(ofd.FileName, MediaTypeNames.Application.Octet);
         // Add time stamp information for the file.
         ContentDisposition disposition = data.ContentDisposition;
         disposition.CreationDate = System.IO.File.GetCreationTime(filePath);// (ofd.FileName);
         disposition.ModificationDate = System.IO.File.GetLastWriteTime(filePath);// (ofd.FileName);
         disposition.ReadDate = System.IO.File.GetLastAccessTime(filePath);// (ofd.FileName);
         // Add the file attachment to this e-mail message.
         if (GlobalVar.AttachmentID.Contains(fileID))
             throw new Exception("已经存在");
         else
         {
             GlobalVar.AttachmentID.Add(fileID);
             GlobalVar.message.Attachments.Add(data);
         }
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
 public ActionResult MoveToFloder(string fileID, string floderName, string higherFloder, UserModel user)
 {
     ArgsHelp ah = new ArgsHelp();
     string filePath = string.Empty;
     if (higherFloder == null || higherFloder == "")
         filePath = user.UserInfo.user_id + "/" + floderName;
     else
         filePath = user.UserInfo.user_id + "/" + higherFloder + "/" + floderName;
     ah = floderDAO.MoveFileToNewFloder(fileID, floderName, filePath, Request.MapPath("/UploadFiles/"));
     if (ah.flag)
         return JavaScript("alert('移动成功');refresh();");
     else
         return JavaScript("alert('移动失败');");
 }
예제 #4
0
 public ArgsHelp DelFile(string fileId)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var file = (from f in filesDB.wjgl_files
                     where f.file_id == fileId
                     select f).First();
         string[] pathInfos = file.file_path.Split('\\');
         string[] idInfos = file.file_id.Split('-');
         string path = BulidFilePath(pathInfos, idInfos,file.file_name.Split('.').Last());
         var zyhGx = (from zg in zyhGxFilesDB.gxgl_zyhgx
                      where zg.file_id == fileId
                      select zg).ToList();
         zyhGxFilesDB.gxgl_zyhgx.DeleteAllOnSubmit(zyhGx);
         var fsyhGx = (from fg in fsyhGxFilesDB.gxgl_fsyhgxb
                       where fg.file_id == fileId
                       select fg).ToList();
         fsyhGxFilesDB.gxgl_fsyhgxb.DeleteAllOnSubmit(fsyhGx);
         fsyhGxFilesDB.SubmitChanges();
         zyhGxFilesDB.SubmitChanges();
         if (File.Exists(file.file_path))
         {
             File.Delete(file.file_path);
             if (File.Exists(path + ".swf"))
                 File.Delete(path + ".swf");
             if (File.Exists(path + ".pdf"))
                 File.Delete(path + ".pdf");
         }
         else
         {
             throw new Exception("没有找到文件");
         }
         var lsbh=(from c in lsbhDB.lsgl_lsbh
                 where c.lsbh_name == "文件上传"
                 select c).First();
         lsbh.lsbh_lasttime = lsbh.lsbh_beforetime;
         lsbh.lsbh_code = (Convert.ToInt32(lsbh.lsbh_code) - 1).ToString();
         lsbhDB.SubmitChanges();
         filesDB.wjgl_files.DeleteOnSubmit(file);
         filesDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #5
0
 public ArgsHelp SendZnx(yjgl_znx znx)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         znxDB.yjgl_znx.InsertOnSubmit(znx);
         znxDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
 public ActionResult ChangeBz()
 {
     string friendId = Request.Form["hiddenId"];
     string bz = Request.Form["bz"];
     string type = Request.Form["friendType"];
     ArgsHelp ah=new ArgsHelp();
     if (type == "主用户")
         ah = friendDAO.ChangeBz(Convert.ToInt32(friendId), bz);
     else
         ah = friendDAO.FsyhChangeBz(Convert.ToInt32(friendId), bz);
     if (ah.flag)
         return JavaScript("alert('备注更改成功!');refresh();");
     else
         return JavaScript("alert('错误!" + ah.msg + "');");
 }
예제 #7
0
 public ArgsHelp SaveEmailInfo(yjgl_yjmx yjmx)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         yjmxDB.yjgl_yjmx.InsertOnSubmit(yjmx);
         yjmxDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
 public ActionResult DelFile(string fileId)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         ah = fileDAO.DelFile(fileId);
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     if (ah.flag)
         return JavaScript("alert('删除成功!');refresh();");
     else
         return JavaScript("alert('删除失败!" + ah.msg + "');");
 }
 /// <summary>
 /// 增加好友分组
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public ActionResult AddNewGroup(UserModel user)
 {
     string groupName = Request.Form["groupName"];
     ArgsHelp ah = new ArgsHelp();
     try
     {
         ah = yhglDAO.AddNewGroup(groupName, user.UserInfo.user_id);
         if(ah.flag)
             return JavaScript("alert('增加分组成功!');refresh();");
         else
             return JavaScript("alert('增加分组失败!');");
     }
     catch (Exception e)
     {
         return JavaScript("alert('增加分组失败!');");
     }
 }
예제 #10
0
 public ArgsHelp SetIsRead(int id)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var znx = (from z in znxDB.yjgl_znx
                    where z.znx_id == id
                    select z).First();
         znx.znx_isread = "是";
         znxDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #11
0
 public ArgsHelp ChangeGroupName(int groupId,string newName)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var group = (from g in groupDB.hygl_group
                      where g.group_id == groupId
                      select g).First();
         group.group_name = newName;
         groupDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #12
0
 public ArgsHelp FsyhChangeBz(int friendId, string bz)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var fsyh = (from f in fsyhDB.yhgl_fsyh
                     where f.fsyh_id == friendId
                     select f).First();
         fsyh.fsyh_bz = bz;
         fsyhDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #13
0
 public ArgsHelp ChangeBz(int friendId, string bz)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var friend = (from f in friendDB.hygl_friend
                       where f.hy2_id == friendId
                       select f).First();
         friend.hy_bz = bz;
         friendDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
 public ActionResult DelFloder(string floderName, string higherFloder, UserModel user)
 {
     ArgsHelp ah = new ArgsHelp();
     foreach (var file in user.Files)
     {
         if (file.floder_name == floderName)
             return JavaScript("alert('文件夹内还有文件,无法删除!')");
     }
     string filePath = string.Empty;
     if (higherFloder == null || higherFloder == "")
         filePath = Request.MapPath("/UploadFiles/" + user.UserInfo.user_id + "/") + floderName;
     else
         filePath = Request.MapPath("/UploadFiles/" + user.UserInfo.user_id + "/") + higherFloder + "/" + floderName;
     ah = floderDAO.DeleteFloder(floderName, filePath);
     if (ah.flag)
         return JavaScript("alert('删除成功');refresh();");
     else
         return JavaScript("alert('删除失败');");
 }
 //
 // GET: /Floder/
 public ActionResult AddFloder(UserModel user)
 {
     ArgsHelp ah = new ArgsHelp();
     string floderName = Request.Form["floderName"];
     string higherFloder = Request.Form["higherFloder"];
     if (floderName == "")
         return JavaScript("alert('请填写文件名')");
     string filePath = Request.MapPath("/UploadFiles/" + user.UserInfo.user_id + "/");
     if (higherFloder == null || higherFloder == "/")
     {
         filePath = Request.MapPath("/UploadFiles/" + user.UserInfo.user_id + "/") + floderName;
         higherFloder = "";
     }
     else
         filePath = Request.MapPath("/UploadFiles/" + user.UserInfo.user_id + "/") + higherFloder + "/" + floderName;
     ah = floderDAO.AddNewFloder(user.UserInfo.user_id, floderName, filePath, higherFloder);
     if (ah.flag)
         return JavaScript("alert('添加成功');refresh();");
     else
         return JavaScript("alert('添加失败');");
 }
예제 #16
0
 /// <summary>
 /// 好友分组
 /// </summary>
 /// <param name="groupName"></param>
 /// <param name="userId"></param>
 /// <returns></returns>
 public ArgsHelp AddNewGroup(string groupName,int userId)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var group = new hygl_group
         {
             group_name = groupName,
             user_id = userId,
             group_cjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")
         };
         friendGroupDB.hygl_group.InsertOnSubmit(group);
         friendGroupDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #17
0
 /// <summary>
 /// 新建文件夹
 /// </summary>
 /// <param name="userId">用户ID(用来保存到数据库)</param>
 /// <param name="floderName">文件夹名称</param>
 /// <param name="filePath">新建文件夹路径</param>
 /// <returns></returns>
 public ArgsHelp AddNewFloder(int userId,string floderName,string filePath,string higherFloder)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         userfloder userfloder = new userfloder
         {
             floder_name = floderName,
             user_id = userId,
             floder_higher = higherFloder
         };
         userFloderDB.userfloder.InsertOnSubmit(userfloder);
         userFloderDB.SubmitChanges();
         Directory.CreateDirectory(filePath);
         ah.flag = true;
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #18
0
 public ArgsHelp CancelGx(string gxId,string userType)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         if (userType == "主用户")
         {
             var gxInfo = (from gx in zyhGxFilesDB.gxgl_zyhgx
                           where gx.gx_id == Convert.ToInt32(gxId)
                           select gx).First();
             zyhGxFilesDB.gxgl_zyhgx.DeleteOnSubmit(gxInfo);
             zyhGxFilesDB.SubmitChanges();
         }
         else
         {
             var gxInfo = (from gx in fsyhGxFilesDB.gxgl_fsyhgxb
                           where gx.fsyhgx_id == Convert.ToInt32(gxId)
                           select gx).First();
             fsyhGxFilesDB.gxgl_fsyhgxb.DeleteOnSubmit(gxInfo);
             fsyhGxFilesDB.SubmitChanges();
         }
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #19
0
 public ArgsHelp SetIsRead(string id)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var gx = (from g in zyhGxFilesDB.gxgl_zyhgx
                   where g.file_id == id
                   select g).First();
         gx.gx_isread = "是";
         zyhGxFilesDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #20
0
 /// <summary>
 /// 好友移动
 /// </summary>
 /// <param name="groupId"></param>
 /// <param name="friendId"></param>
 /// <param name="userId"></param>
 /// <returns></returns>
 public ArgsHelp MoveToNewGroup(string groupId,string friendId,int userId)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var friend = (from f in friendDB.hygl_friend
                       where f.hy1_id == userId
                       where f.hy2_id == Convert.ToInt32(friendId)
                       select f).First();
         friend.group_id = Convert.ToInt32(groupId);
         friendDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #21
0
 public ArgsHelp SetNewPsw(int userId, string newPsw)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var user = (from u in userDB.yhgl_users
                     where u.user_id == userId
                     select u).First();
         user.user_psw = newPsw;
         userDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #22
0
 /// <summary>
 /// 启用好友
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public ArgsHelp EnabledZyh(int userId)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var user = (from u in userDB.yhgl_users
                     where u.user_id == userId
                     select u).First();
         user.user_qy = "是";
         userDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="senderName"></param>
 /// <param name="receiver"></param>
 /// <param name="topic"></param>
 /// <param name="content"></param>
 /// <param name="psw"></param>
 /// <returns></returns>
 public ArgsHelp SendMail(string sender, string senderName, string receiver, string topic, string content, string psw,int userID)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         GlobalVar.message.From = new MailAddress(sender, senderName);//必须是提供smtp服务的邮件服务器
         GlobalVar.message.To.Clear();//清空以前的收件人
         GlobalVar.message.To.Add(new MailAddress(receiver));  //收件人
         GlobalVar.message.Subject = topic;
         GlobalVar.message.IsBodyHtml = true;
         GlobalVar.message.BodyEncoding = System.Text.Encoding.UTF8;
         GlobalVar.message.Body = content;
         GlobalVar.message.Priority = System.Net.Mail.MailPriority.High;
         SmtpClient client = new SmtpClient("mail.skywalk.cn", 25); // 587;//Gmail使用的端口
         client.Credentials = new System.Net.NetworkCredential(sender, psw); //这里是申请的邮箱和密码
         client.EnableSsl = false; //必须经过ssl加密
         string fj = string.Empty;
         client.Send(GlobalVar.message);
         foreach (var id in GlobalVar.AttachmentID)
         {
             fj += id + "|";
         }
         yjgl_yjmx yjmx = new yjgl_yjmx
         {
             user_id = userID,
             yj_fssj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"),
             yj_nr = content,
             yj_zt = topic,
             yj_sjr = receiver,
             yj_fj = fj
         };
         emailglDAO.SaveEmailInfo(yjmx);
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #24
0
 public ArgsHelp UpdateUserInfo(yhgl_users userInfo)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var user = (from u in userDB.yhgl_users
                     where u.user_id == userInfo.user_id
                     select u).First();
         user.user_name = userInfo.user_name;
         user.user_mobile = userInfo.user_mobile;
         user.user_email = userInfo.user_email;
         user.user_avatar = userInfo.user_avatar;
         user.user_fax = userInfo.user_fax;
         user.user_tel = userInfo.user_tel;
         userDB.SubmitChanges();
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }
예제 #25
0
 /// <summary>
 /// 文件移动到文件夹
 /// </summary>
 /// <param name="fileID">文件ID</param>
 /// <param name="filePath">文件夹所在路径</param>
 /// <returns></returns>
 public ArgsHelp MoveFileToNewFloder(string fileID, string floderName, string filePath, string file_Prefix)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         var file = (from f in filesDB.wjgl_files
                     where f.file_id == fileID
                     select f).First();
         FileInfo fi = new FileInfo(file_Prefix + file.file_path.Replace("/", "\\"));
         FileInfo fiPDF = new FileInfo(file_Prefix + file.file_path.Replace("/", "\\") + ".pdf");
         FileInfo fiSWF = new FileInfo(file_Prefix + file.file_path.Replace("/", "\\") + ".swf");
         string fileName = file.file_path.Split('/').Last();
         fi.MoveTo(filePath + "\\" + fileName);
         if (fiPDF.Exists == true)
             fiPDF.MoveTo(filePath + "\\" + fileName + ".pdf");
         if (fiSWF.Exists == true)
             fiSWF.MoveTo(filePath + "\\" + fileName + ".swf");
         file.floder_name = floderName;
         file.file_path = filePath + "\\" + fileName;
         filesDB.SubmitChanges();
         ah.flag = true;
     }
     catch (Exception e)
     {
         ah.flag = false;
     }
     return ah;
 }
 /// <summary>
 /// 增加用户操作
 /// </summary>
 /// <returns></returns>
 public ActionResult AddNewZyh2SQL()
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         string userName = Request.Form["username"];
         string psw = Request.Form["psw"];
         string email = Request.Form["email"];
         string bm = Request.Form["bm"];
         string mobile = Request.Form["mobile"];
         string tel = Request.Form["tel"];
         string fax = Request.Form["fax"];
         var userInfo = new yhgl_users
         {
             user_name = userName,
             user_email = email,
             user_psw = psw,
             user_bm = bm,
             user_mobile = mobile,
             user_tel = tel,
             user_fax = fax,
             level_id = 2,
             user_qy = "是",
             user_avatar = GlobalVar.AvatarPath ?? GlobalVar.DefaultAvatar
         };
         ah = yhglDAO.AddNewUser(userInfo);
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     if (ah.flag)
         return JavaScript("alert('增加成功!');refresh();");
     else
         return JavaScript("alert('增加失败!');");
 }
 public ActionResult SetNewPsw(int userId)
 {
     string newPsw = Request.Form["newPsw"].ToString();
     ArgsHelp ah = new ArgsHelp();
     ah = yhglDAO.SetNewPsw(userId, newPsw);
     if (ah.flag)
         return JavaScript("alert('修改成功!');");
     else
         return JavaScript("alert('修改失败!" + ah.msg + "');");
 }
예제 #28
0
 /// <summary>
 /// 注册新用户
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public ArgsHelp AddNewUser(yhgl_users user)
 {
     ArgsHelp ah = new ArgsHelp();
     try
     {
         userDB.yhgl_users.InsertOnSubmit(user);
         userDB.SubmitChanges();
         ah.flag = true;
     }
     catch (Exception e)
     {
         ah.flag = false;
         ah.msg = e.Message;
     }
     return ah;
 }