Esempio n. 1
0
        /// <summary>
        /// 数据操作
        /// </summary>
        /// <param name="add"></param>
        /// <param name="update"></param>
        /// <param name="del"></param>
        /// <param name="audit"></param>
        public void Operation(SevenSOfficeEntity add, SevenSOfficeEntity update, string del, SevenSOfficeAuditEntity audit, SevenSOfficeAuditEntity auditupdate)
        {
            try
            {
                if (audit != null)
                {
                    if (add != null)
                    {
                        if (string.IsNullOrEmpty(add.aduitstate))
                        {
                            add.aduitstate = "待审核";
                        }
                        audit.officeid = add.id;
                    }

                    audit.auditid = Guid.NewGuid().ToString();
                    var list = getAuditByid(audit.officeid);
                    audit.sort = list.Count() + 1;
                }
                service.Operation(add, update, del, audit, auditupdate);
                #region 消息推送
                MessageBLL messagebll = new MessageBLL();
                if (add != null)
                {
                    //待办通知
                    messagebll.SendMessage("待审核7S创新提案", add.id);
                }
                if (auditupdate != null)
                {
                    //修改时无新增
                    if (audit == null && update == null)
                    {
                        if (auditupdate.state == "审核通过")
                        {
                            messagebll.SendMessage("7S创新提案审批通过", auditupdate.officeid);
                        }
                        else
                        {
                            messagebll.SendMessage("7S创新提案审批不通过", auditupdate.officeid);
                        }
                    }
                }
                #endregion
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 数据操作
        /// </summary>
        /// <param name="add"></param>
        /// <param name="update"></param>
        /// <param name="del"></param>
        /// <param name="audit"></param>
        public void Operation(SevenSOfficeEntity add, SevenSOfficeEntity update, string del, SevenSOfficeAuditEntity audit, SevenSOfficeAuditEntity auditupdate)
        {
            var db = new RepositoryFactory().BaseRepository().BeginTrans();;

            try
            {
                if (audit != null)
                {
                    db.Insert(audit);
                }
                if (add != null)
                {
                    db.Insert(add);
                }
                if (update != null)
                {
                    db.Update(update);
                }
                if (del != null)
                {
                    var getOne = db.IQueryable <SevenSOfficeEntity>(x => x.id == del).ToList();
                    var List   = getAuditByid(del);
                    db.Delete(List);
                    db.Delete(getOne);
                }

                if (auditupdate != null)
                {
                    //修改时无新增
                    if (audit == null && update == null)
                    {
                        var getOne       = db.IQueryable <SevenSOfficeEntity>(x => x.id == auditupdate.officeid).ToList();
                        var officeEntity = getOne[0];
                        officeEntity.aduitresult = auditupdate.state;
                        officeEntity.aduitstate  = "已审核";
                        db.Update(officeEntity);
                    }
                    db.Update(auditupdate);
                }
                db.Commit();
            }
            catch (Exception)
            {
                db.Rollback();
                throw;
            }
        }