Beispiel #1
0
 protected void btnAll_Click(object sender, EventArgs e)
 {
     try
     {
         int j = 0;
         string[] filearray = new String[11];
         filearray[0] = " ";
         for (int i = 0; i < gvMsg.Rows.Count; i++)
         {
             CheckBox ckb = gvMsg.Rows[i].FindControl("ckbChoose") as CheckBox;
             if (ckb.Checked == true)
             {
                 int msgid = Convert.ToInt32(gvMsg.DataKeys[i].Value);
                 MessageInfo msg = new MessageInfo(msgid);
                 EmployeeInfo em = new EmployeeInfo(Convert.ToInt32(msg.RecvEmployeeId));
                 MessageInfo.SendMail(em.Qq, "OA�µ���Ϣ", msg.EmployeeName + "," + msg.Msg);
             }
         }
         gvDataBind();
         Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ѳɹ���');</script>");
     }
     catch (Exception Ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('������Ϣ:" + Ex.Message + "');", true);
     }
 }
Beispiel #2
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     int msgid =  Convert.ToInt32(((Button)sender).CommandArgument.ToString());;
     MessageInfo msg = new MessageInfo(msgid);
     EmployeeInfo em = new EmployeeInfo(Convert.ToInt32(msg.RecvEmployeeId));
     MessageInfo.SendMail(em.Qq, "OA�µ���Ϣ", msg.EmployeeName + "," + msg.Msg);
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ѳɹ���');</script>");
 }
        public MessageInfo GetMessageInfoById(int MessageId)
        {
            MessageInfo messageInfo  = null;//
            try
            {
                 messageInfo = new MessageInfo(MessageId);

            }
            catch (AppException)
            {
                return null;
            }

            return  messageInfo;
        }
Beispiel #4
0
        protected void btnSendFile_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {
                    int emid = Convert.ToInt32(Session["EmployeeId"]);
                    EmployeeInfo em = (EmployeeInfo)Session["Employee"];
                    //��ȡ�ļ���
                    string name = this.UpFile.FileName;
                    DateTime sendtime = DateTime.Now;
                    if (!CanYou.OA.BLL.FileInfo.IsFileSame(name))
                    {
                        string[] strto = new String[lbxRecv.Items.Count];
                        for (int i = 0; i < lbxRecv.Items.Count; i++)
                        {
                            CanYou.OA.BLL.FileInfo file = new CanYou.OA.BLL.FileInfo();
                            file.RecvEmployeeId = Convert.ToInt32(lbxRecv.Items[i].Value);
                            file.FileName = name;
                            file.FileTypeId = Convert.ToInt32(ddlFileType.SelectedValue.ToString());
                            file.SendEmployeeId = emid;
                            file.Memo = txtMemo.Text.ToString();
                            file.SendTime = sendtime;
                            file.IsCommon = 0;
                            file.IsDelete = 0;
                            file.IsMsg = 0;
                            file.Save();

                            MessageInfo Msg = new MessageInfo();
                            Msg.Msg = "���յ����ļ�:"+name;
                            Msg.Url = "~/ShareManage/RecvFile.aspx";
                            Msg.RecvEmployeeId = Convert.ToInt32(lbxRecv.Items[i].Value);
                            Msg.Memo = file.FileId.ToString();
                            Msg.EmployeeName = em.EmployeeName;
                            Msg.MsgType = "daiyue";
                            Msg.MsgTime = DateTime.Now.ToString("yyyy-MM-dd");
                            Msg.MsgTitle = name;
                            Msg.Save();

                            EmployeeInfo ems = new EmployeeInfo(Convert.ToInt32(lbxRecv.Items[0].Value));
                            strto[i] = ems.Qq.ToString();
                        }

                        //�ļ��ϴ���ַ��Ŀ¼������ͨ��IIS���豾������ΪFTP������
                        //string FileSaveUri = @"ftp://192.168.11.70/www/Files/File/";
                        ////FTP�û������룬���DZ������û�������
                        //string ftpUser = "******";
                        //string ftpPassWord = "******";
                        //SendFiles(FileSaveUri, ftpUser, ftpPassWord);
                        this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/File/" + UpFile.FileName));
                        MessageInfo.SendMailS(strto, "OA����Ϣ", "���յ����ļ�");

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ͳɹ���');</script>");
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('���ļ����Ѵ��ڣ�����������');</script>");
                    }
                }
                catch (Exception ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + ex.Message + "');", true);
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< MessageInfo> pList, MessageCollection pCollection)
 {
     foreach (Message message in pCollection)
     {
         MessageInfo messageInfo = new MessageInfo();
         LoadFromDAL(messageInfo, message );
         pList.Add(messageInfo);
     }
 }
Beispiel #6
0
 //数据持久化
 internal static void SaveToDb(MessageInfo pMessageInfo, Message  pMessage,bool pIsNew)
 {
     pMessage.MessageId = pMessageInfo.messageId;
      		pMessage.Memo = pMessageInfo.memo;
      		pMessage.RecvEmployeeId = pMessageInfo.recvEmployeeId;
      		pMessage.Msg = pMessageInfo.msg;
      		pMessage.Url = pMessageInfo.url;
      		pMessage.EmployeeName = pMessageInfo.employeeName;
      		pMessage.MsgType = pMessageInfo.msgType;
      		pMessage.MsgTime = pMessageInfo.msgTime;
      		pMessage.MsgTitle = pMessageInfo.msgTitle;
     pMessage.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pMessage.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(MessageInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pMessageInfo.messageId = pMessage.MessageId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(MessageInfo)))
     {
         ResetCache();
     }
 }
Beispiel #7
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(MessageInfo pMessageInfoTo)
 {
     Copy(this,  pMessageInfoTo);
 }
Beispiel #8
0
 //从后台获取数据
 internal static void LoadFromDAL(MessageInfo pMessageInfo, Message  pMessage)
 {
     pMessageInfo.messageId = pMessage.MessageId;
      		pMessageInfo.memo = pMessage.Memo;
      		pMessageInfo.recvEmployeeId = pMessage.RecvEmployeeId;
      		pMessageInfo.msg = pMessage.Msg;
      		pMessageInfo.url = pMessage.Url;
      		pMessageInfo.employeeName = pMessage.EmployeeName;
      		pMessageInfo.msgType = pMessage.MsgType;
      		pMessageInfo.msgTime = pMessage.MsgTime;
      		pMessageInfo.msgTitle = pMessage.MsgTitle;
     pMessageInfo.Loaded=true;
 }
Beispiel #9
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<MessageInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(MessageInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< MessageInfo>;
     }
     else
     {
         List< MessageInfo>  list =new List< MessageInfo>();
         MessageCollection  collection=new  MessageCollection();
         Query qry = new Query(Message.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(Message message in collection)
         {
             MessageInfo messageInfo= new MessageInfo();
             LoadFromDAL(messageInfo,message);
             list.Add(messageInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(MessageInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
Beispiel #10
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<MessageInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< MessageInfo> list = new List< MessageInfo>();

            Query q = Message .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            MessageCollection  collection=new  MessageCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (Message  message  in collection)
            {
                MessageInfo messageInfo = new MessageInfo();
                LoadFromDAL(messageInfo,   message);
                list.Add(messageInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
 public object SaveMessageInfo(MessageInfo messageInfo)
 {
     messageInfo.Save();
     return messageInfo . MessageId;
 }
Beispiel #12
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(MessageInfo pMessageInfoFrom, MessageInfo pMessageInfoTo)
 {
     pMessageInfoTo.MessageId = pMessageInfoFrom.messageId;
      		pMessageInfoTo.Memo = pMessageInfoFrom.memo;
      		pMessageInfoTo.RecvEmployeeId = pMessageInfoFrom.recvEmployeeId;
      		pMessageInfoTo.Msg = pMessageInfoFrom.msg;
      		pMessageInfoTo.Url = pMessageInfoFrom.url;
      		pMessageInfoTo.EmployeeName = pMessageInfoFrom.employeeName;
      		pMessageInfoTo.MsgType = pMessageInfoFrom.msgType;
      		pMessageInfoTo.MsgTime = pMessageInfoFrom.msgTime;
      		pMessageInfoTo.MsgTitle = pMessageInfoFrom.msgTitle;
     pMessageInfoTo.Loaded=pMessageInfoFrom.Loaded;
 }
 public void DeleteById(MessageInfo pMessageInfo)
 {
     MessageInfo messageInfo = new MessageInfo(pMessageInfo.MessageId);
     messageInfo.Delete();
 }
Beispiel #14
0
 public static void Msgs(int EmId, int ApplyId, string Url, string Msgs, string EmName)
 {
     MessageInfo msgs = new MessageInfo();
     //msgs.Msg = Msgs;
     //msgs.Url = Url;
     //msgs.RecvEmployeeId = EmId;
     //msgs.Memo = ApplyId.ToString();
     //msgs.employeeName = EmName;
     //msgs.Save();
 }
Beispiel #15
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(MessageInfo pMessageInfoTo)
 {
     Copy(this, pMessageInfoTo);
 }
Beispiel #16
0
 public object  SaveMessageInfo(MessageInfo messageInfo)
 {
     messageInfo.Save();
     return(messageInfo.MessageId);
 }
Beispiel #17
0
 public List <MessageInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(MessageInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
Beispiel #18
0
 public List <MessageInfo> GetMessageInfoList()
 {
     return(MessageInfo.GetList());
 }
Beispiel #19
0
        public void DeleteById(MessageInfo pMessageInfo)
        {
            MessageInfo messageInfo = new MessageInfo(pMessageInfo.MessageId);

            messageInfo.Delete();
        }