Пример #1
0
 /// <summary>
 /// 发送消息
 /// </summary>
 private void SendInformation(int jobflowid, int ruleid)
 {
     EtNet_Models.ApprovalRule rule      = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid);
     string[]                 list       = rule.idgourp.Split(',');
     EtNet_Models.JobFlow     model      = EtNet_BLL.JobFlowManager.GetModel(jobflowid);
     EtNet_Models.Information informodel = null;
     if (model != null)
     {
         informodel               = new EtNet_Models.Information();
         informodel.sortid        = 4;
         informodel.associationid = jobflowid;
         informodel.contents      = "编号为" + model.cname + "的单据需要您审批!";
         informodel.createtime    = DateTime.Now;
         informodel.sendtime      = DateTime.Now;
         informodel.founderid     = ((EtNet_Models.LoginInfo)Session["login"]).Id;
         if (EtNet_BLL.InformationManager.Add(informodel))
         {
             int maxid = EtNet_BLL.InformationManager.GetMaxId();
             EtNet_Models.InformationNotice infnotic = null;
             int len = (rule.sort == "单审") ? 1 : list.Length;
             for (int j = 0; j < len; j++)
             {
                 infnotic = new EtNet_Models.InformationNotice();
                 infnotic.informationid = maxid;
                 infnotic.recipientid   = int.Parse(list[j].ToString());
                 infnotic.remind        = "是";
                 EtNet_BLL.InformationNoticeManager.Add(infnotic);
             }
         }
     }
 }
Пример #2
0
        /// <summary>
        /// 回复消息
        /// </summary>
        private void Replyinfo()
        {
            string[] str = FileUp(Request.Files);
            if (str[0] != "")
            {
                this.iptdate.Value     = "";
                this.tracontents.Value = "";
                this.rbtnleft.Checked  = true;
                this.rbtnright.Checked = false;
                string strerror = "<script>alert('" + str[0] + "')</script>";
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "fileup", strerror, false);
            }
            else
            {
                EtNet_Models.Information model = new EtNet_Models.Information();
                model.founderid     = ((EtNet_Models.LoginInfo)Session["login"]).Id;
                model.associationid = 1;
                model.contents      = Server.UrlDecode(this.tracontents.Value);
                model.createtime    = DateTime.Now;
                model.sendtime      = this.rbtnleft.Checked ? DateTime.Now : DateTime.Parse(this.iptdate.Value);
                model.sortid        = 1;

                if (EtNet_BLL.InformationManager.Add(model))
                {
                    int maxid = EtNet_BLL.InformationManager.GetMaxId();
                    CreateInformationNotice(this.ipthidrecipient.Value, maxid);
                    if (str[6] == "1")
                    {
                        CreateDocumentFile(str, maxid);
                    }
                    Response.Redirect("SendInformationShow.aspx");
                }
            }
        }
Пример #3
0
 /// <summary>
 /// 发送消息
 /// </summary>
 private void SendInformation(int jobflowid, string[] list)
 {
     EtNet_Models.JobFlow     model      = EtNet_BLL.JobFlowManager.GetModel(jobflowid);
     EtNet_Models.Information informodel = null;
     if (model != null)
     {
         informodel               = new EtNet_Models.Information();
         informodel.sortid        = 2;
         informodel.associationid = jobflowid;
         informodel.contents      = "审核编号为" + model.cname + "的单据";
         informodel.createtime    = DateTime.Now;
         informodel.sendtime      = DateTime.Now;
         informodel.founderid     = ((EtNet_Models.LoginInfo)Session["login"]).Id;
         if (EtNet_BLL.InformationManager.Add(informodel))
         {
             int maxid = EtNet_BLL.InformationManager.GetMaxId();
             EtNet_Models.InformationNotice infnotic = null;
             for (int j = 0; j < list.Length; j++)
             {
                 infnotic = new EtNet_Models.InformationNotice();
                 infnotic.informationid = maxid;
                 infnotic.recipientid   = int.Parse(list[j].ToString());
                 infnotic.remind        = "是";
                 EtNet_BLL.InformationNoticeManager.Add(infnotic);
             }
         }
     }
 }
        ///<summary>
        ///发送公告查看消息
        ///</summary>
        ///<param name="id">公告id值</param>
        private void AnnouncementInformation(int id)
        {
            DataTable tbl = EtNet_BLL.LoginInfoManager.getList("");

            EtNet_Models.AnnouncementInfo announcement = EtNet_BLL.AnnouncementInfoManager.GetModel(id);

            EtNet_Models.Information model = new EtNet_Models.Information();
            model.associationid = id;
            model.contents      = "你有一个新公告可以查看,该公告的名称为:'" + announcement.title + "'";
            model.createtime    = DateTime.Now;
            model.sendtime      = model.createtime;
            model.founderid     = announcement.createrid;
            model.sortid        = 8;
            EtNet_BLL.InformationManager.Add(model);
            int maxid = EtNet_BLL.InformationManager.GetMaxId();

            EtNet_Models.InformationNotice noticemodel = null;
            for (int i = 0; i < tbl.Rows.Count; i++)
            {
                noticemodel = new EtNet_Models.InformationNotice();
                noticemodel.informationid = maxid;
                noticemodel.recipientid   = int.Parse(tbl.Rows[i]["id"].ToString());
                noticemodel.remind        = "是";
                EtNet_BLL.InformationNoticeManager.Add(noticemodel);
            }
        }
Пример #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static EtNet_Models.Information GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id, contents, sortid, associationid, founderid, createtime, sendtime  ");
            strSql.Append("  from Information ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;


            EtNet_Models.Information model = new EtNet_Models.Information();
            DataTable tbl = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters);

            if (tbl.Rows.Count > 0)
            {
                model.id            = int.Parse(tbl.Rows[0]["id"].ToString());
                model.contents      = tbl.Rows[0]["contents"].ToString();
                model.sortid        = int.Parse(tbl.Rows[0]["sortid"].ToString());
                model.associationid = int.Parse(tbl.Rows[0]["associationid"].ToString());
                model.founderid     = int.Parse(tbl.Rows[0]["founderid"].ToString());
                model.createtime    = DateTime.Parse(tbl.Rows[0]["createtime"].ToString());
                model.sendtime      = DateTime.Parse(tbl.Rows[0]["sendtime"].ToString());

                return(model);
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        /// <summary>
        /// 创建消息,返回消息的id值
        /// </summary>
        public int CreateInfo(string straudit)
        {
            EtNet_Models.Information model = new EtNet_Models.Information();
            model.sortid        = 1;
            model.associationid = 1;
            model.createtime    = DateTime.Now;
            model.sendtime      = DateTime.Now;
            model.founderid     = ((EtNet_Models.LoginInfo)Session["login"]).Id;
            model.contents      = straudit;
            EtNet_BLL.InformationManager.Add(model);
            int maxid = EtNet_BLL.InformationManager.GetMaxId(((EtNet_Models.LoginInfo)Session["login"]).Id.ToString());

            return(maxid);
        }
Пример #7
0
        ///<summary>
        ///发送消息
        ///</summary>
        ///<param name="id">公告的id值</param>
        ///<param name="sort">公告的分类</param>
        ///<param name="title">公告的标题</param>
        ///<param name="departlist">部门列表</param>
        ///<param name="isnew">是否是新公告</param>
        private void SendInformation(int id, int sort, string title, string departlist, bool isnew)
        {
            string    strsql = "";
            DataTable tbl    = null;

            if (sort == 1)
            {
                //公司公告
                tbl = EtNet_BLL.LoginInfoManager.getList("");
            }
            else
            {
                strsql = " departid in(select departid from DepartmentInfo where departid in(" + departlist + "))";
                tbl    = EtNet_BLL.LoginInfoManager.getList(strsql);
            }

            EtNet_Models.Information model = new EtNet_Models.Information();
            model.associationid = id;
            model.createtime    = DateTime.Now;
            model.sendtime      = model.createtime;
            model.founderid     = ((EtNet_Models.LoginInfo)Session["login"]).Id;
            model.sortid        = 8;
            if (isnew)
            {
                model.contents = "你有一个新公告可以查看,该公告的名称为:'" + title + "'";
            }
            else
            {
                model.contents = "公告的名称为:'" + title + "'已修改,请注意查看";
            }
            EtNet_BLL.InformationManager.Add(model);
            int maxid = EtNet_BLL.InformationManager.GetMaxId();

            EtNet_Models.InformationNotice noticemodel = null;
            for (int i = 0; i < tbl.Rows.Count; i++)
            {
                noticemodel = new EtNet_Models.InformationNotice();
                noticemodel.informationid = maxid;
                noticemodel.recipientid   = int.Parse(tbl.Rows[i]["id"].ToString());
                noticemodel.remind        = "是";
                EtNet_BLL.InformationNoticeManager.Add(noticemodel);
            }
        }
Пример #8
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static bool Update(EtNet_Models.Information model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Information set ");
            strSql.Append(" contents = @contents , ");
            strSql.Append(" sortid = @sortid , ");
            strSql.Append(" associationid = @associationid , ");
            strSql.Append(" founderid = @founderid , ");
            strSql.Append(" createtime = @createtime , ");
            strSql.Append(" sendtime = @sendtime  ");
            strSql.Append(" where id=@id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@id",            SqlDbType.Int,              4),
                new SqlParameter("@contents",      SqlDbType.VarChar,        200),
                new SqlParameter("@sortid",        SqlDbType.Int,              4),
                new SqlParameter("@associationid", SqlDbType.Int,              4),
                new SqlParameter("@founderid",     SqlDbType.Int,              4),
                new SqlParameter("@createtime",    SqlDbType.SmallDateTime),
                new SqlParameter("@sendtime",      SqlDbType.SmallDateTime)
            };

            parameters[0].Value = model.id;
            parameters[1].Value = model.contents;
            parameters[2].Value = model.sortid;
            parameters[3].Value = model.associationid;
            parameters[4].Value = model.founderid;
            parameters[5].Value = model.createtime;
            parameters[6].Value = model.sendtime;

            int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (result >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #9
0
        /// <summary>
        /// 发送审批消息给下一个审批人员
        /// </summary>
        public void SendNextAudit(int jfid)
        {
            EtNet_Models.LoginInfo login   = ((EtNet_Models.LoginInfo)Session["login"]);
            EtNet_Models.JobFlow   jfmodel = EtNet_BLL.JobFlowManager.GetModel(jfid);
            if (jfmodel != null)
            {
                EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(jfmodel.ruleid);
                string[] list = rule.idgourp.Split(',');
                if (rule.sort != "单审" || list.Length == 1)
                {
                    return;
                }
                if (list[list.Length - 1] == login.Id.ToString())
                {
                    return;
                }

                int recipientid = 0;
                for (int i = 0; i < list.Length; i++)
                {
                    if (list[i] == login.Id.ToString() && i != list.Length - 1)
                    {
                        recipientid = int.Parse(list[i + 1]);
                    }
                }
                EtNet_Models.Information model = new EtNet_Models.Information();
                model.sortid        = 9;
                model.associationid = jfid;
                model.createtime    = DateTime.Now;
                model.sendtime      = DateTime.Now;
                model.founderid     = jfmodel.founderid;
                model.contents      = "名称为" + jfmodel.cname + "的客户需要您审批!";;
                EtNet_BLL.InformationManager.Add(model);
                int maxid = EtNet_BLL.InformationManager.GetMaxId(jfmodel.founderid.ToString());

                EtNet_Models.InformationNotice infnotic = new EtNet_Models.InformationNotice();
                infnotic.informationid = maxid;
                infnotic.recipientid   = recipientid;
                infnotic.remind        = "是";
                EtNet_BLL.InformationNoticeManager.Add(infnotic);
            }
        }
Пример #10
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static bool Add(EtNet_Models.Information model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Information(");
            strSql.Append("contents,sortid,associationid,founderid,createtime,sendtime");
            strSql.Append(") values (");
            strSql.Append("@contents,@sortid,@associationid,@founderid,@createtime,@sendtime");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@contents",      SqlDbType.VarChar,        200),
                new SqlParameter("@sortid",        SqlDbType.Int,              4),
                new SqlParameter("@associationid", SqlDbType.Int,              4),
                new SqlParameter("@founderid",     SqlDbType.Int,              4),
                new SqlParameter("@createtime",    SqlDbType.SmallDateTime),
                new SqlParameter("@sendtime",      SqlDbType.SmallDateTime)
            };

            parameters[0].Value = model.contents;
            parameters[1].Value = model.sortid;
            parameters[2].Value = model.associationid;
            parameters[3].Value = model.founderid;
            parameters[4].Value = model.createtime;
            parameters[5].Value = model.sendtime;

            int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (result >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(EtNet_Models.Information model)
 {
     return(EtNet_DAL.InformationService.Update(model));
 }
Пример #12
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool  Add(EtNet_Models.Information model)
 {
     return(EtNet_DAL.InformationService.Add(model));
 }