示例#1
0
        protected override void ExcuteSelf()
        {
            try
            {
                if (_WorkTaskQA.Pkid == 0)
                {
                    DalInstance.WorkTaskDalInstance.AddWorkTaskQA(_WorkTaskQA);
                }
                else
                {
                    DalInstance.WorkTaskDalInstance.UpdateWorkTaskQA(_WorkTaskQA);
                }

                if (_IfEmail)
                {
                    string        subject = _WorkTaskQA.QAccount.Name + "´ð¸´ÁËÄãµÄÁôÑÔ";
                    List <string> to      = new List <string>();
                    Account       account = DalInstance.AccountDalInstance.GetAccountById(_WorkTaskQA.WorkTask.Account.Id);
                    if (account != null && account.Id > 0)
                    {
                        to.Add(account.Email1);
                    }
                    new WorkTaskEmail(subject, WorkTaskEmail.BuildQuestionWorkTaskMailBody(_WorkTaskQA), to).SendMail();
                }
            }
            catch
            {
                throw MessageKeys.AppException(MessageKeys._DbError);
            }
        }
示例#2
0
 protected override void ExcuteSelf()
 {
     try
     {
         using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
         {
             //新增新闻基本信息
             //新增新闻附件AddAppendix
             int bulletinID = DalInstance.BulletinDalInstance.InsertBulletin(_Bulletin);
             if (_Bulletin.AppendixList != null)
             {
                 foreach (Appendix appendix in _Bulletin.AppendixList)
                 {
                     appendix.BulletinID = bulletinID;
                     DalInstance.BulletinDalInstance.InsertAppendix(appendix);
                 }
             }
             ts.Complete();
         }
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#3
0
        protected override void Validation()
        {
            if (_NewAccount.Id == _LoginUser.Id)
            {
                return;
            }

            //权限验证
            if (!Powers.HasAuth(_LoginUser.Auths, AuthType.SEP, Powers.A101))
            {
                throw MessageKeys.AppException(MessageKeys._NoAuth);
            }

            //用户名唯一性验证
            if (DalInstance.AccountDalInstance.ValidationLoginName(_NewAccount.Id, _NewAccount.LoginName))
            {
                throw MessageKeys.AppException(MessageKeys._Account_Not_Repeat);
            }

            //姓名唯一性验证
            if (DalInstance.AccountDalInstance.ValidationName(_NewAccount.Id, _NewAccount.Name))
            {
                throw MessageKeys.AppException(MessageKeys._Employee_Name_Repeat);
            }
        }
示例#4
0
 protected override void Validation()
 {
     if (DalInstance.BulletinDalInstance.GetAppendixCountByBulletinIDAndTitle(_Appendix.BulletinID, _Appendix.Title) > 0)
     {
         throw MessageKeys.AppException(MessageKeys._Appendix_Title_Repeat);
     }
 }
 protected override void Validation()
 {
     if (DalInstance.PositionDalInstance.CountPositionByNatureId(_PositionNatureId) > 0)
     {
         throw MessageKeys.AppException(MessageKeys._PositionNature_HasPosition);
     }
 }
示例#6
0
 /// <summary>
 /// 修改职位层级有效性判断:
 /// 1、修改的职位层级已经存在
 /// 2、职位层级不能与已有的其他职位层级重名
 /// 3、职位层级在使用中
 /// </summary>
 protected override void Validation()
 {
     if (DalInstance.PositionDalInstance.CountPositionNatureByNameDiffPKID(_PositionNature.Pkid, _PositionNature.Name) > 0)
     {
         throw MessageKeys.AppException(MessageKeys._PositionNature_Name_Repeat);
     }
 }
示例#7
0
        public void SaveCompanyRegulations(CompanyRegulation companyRegulations, Account loginUser)
        {
            Validation(companyRegulations);

            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew))
            {
                try
                {
                    // 删除公司规章
                    if (companyRegulations.CompanyRegulationsID > 0)
                    {
                        DalInstance.CompanyRegulationDalInstance.DeleteCompanyReguAppendixByCompanyRegulationsID(companyRegulations.CompanyRegulationsID);
                        DalInstance.CompanyRegulationDalInstance.DeleteCompanyRegulationsByPKID(companyRegulations.CompanyRegulationsID);
                    }

                    // 新增公司规章
                    int companyReguID = DalInstance.CompanyRegulationDalInstance.InsertCompanyRegulations(companyRegulations);
                    if (companyRegulations.AppendixList != null)
                    {
                        foreach (CompanyReguAppendix companyReguAppendix in companyRegulations.AppendixList)
                        {
                            companyReguAppendix.CompanyReguID = companyReguID;
                            //新增公司规章附件
                            DalInstance.CompanyRegulationDalInstance.InsertCompanyReguAppendix(companyReguAppendix);
                        }
                    }
                    ts.Complete();
                }
                catch
                {
                    throw MessageKeys.AppException(MessageKeys._DbError);
                }
            }
        }
示例#8
0
 public void SavePositionGradeList(List <PositionGrade> grades, List <int> delItems, Account loginUser)
 {
     try
     {
         using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
         {
             foreach (int i in delItems)
             {
                 DeletePositionGrade(i, loginUser);
             }
             for (int i = 0; i < grades.Count; i++)
             {
                 grades[i].Sequence = i;
                 if (grades[i].Id == -1)
                 {
                     CreatePositionGrade(grades[i], loginUser);
                 }
                 else
                 {
                     UpdatePositionGrade(grades[i], loginUser);
                 }
             }
             ts.Complete();
         }
     }
     catch (Exception ex)
     {
         throw MessageKeys.AppException(ex.Message);
     }
 }
示例#9
0
        protected override void ExcuteSelf()
        {
            try
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    int parentId = 0;
                    if (_ParentDeptId.HasValue)
                    {
                        parentId = _ParentDeptId.Value;
                    }
                    else
                    {
                        Department parentDept = DalInstance.DeptDalInstance.GetDepartmentById(_Department.Id);
                        parentId = parentDept != null && parentDept.ParentDepartment != null
                                       ? parentDept.ParentDepartment.Id
                                       : 0;
                    }

                    DalInstance.DeptDalInstance.UpdateDepartment(parentId, _Department);
                    ts.Complete();
                }
            }
            catch
            {
                throw MessageKeys.AppException(MessageKeys._DbError);
            }
        }
示例#10
0
 public List <Auth> GetAccountAllAuth(int accountId, Account loginUser)
 {
     if (!Powers.HasAuth(loginUser.Auths, AuthType.SEP, Powers.A103) && accountId != loginUser.Id)
     {
         throw MessageKeys.AppException(MessageKeys._NoAuth);
     }
     return(DalInstance.AuthDalInstance.GetAccountAuthTree(accountId));
 }
示例#11
0
 protected override void Validation()
 {
     //验证字段:标题不能重名
     if (DalInstance.BulletinDalInstance.GetBulletinCountByTitle(_Bulletin.Title) > 0)
     {
         throw MessageKeys.AppException(MessageKeys._Bulletin_Title_Repeat);
     }
 }
示例#12
0
 protected override void Validation()
 {
     //该附件是否存在
     if (DalInstance.BulletinDalInstance.GetAppendixByPKID(_AppendixID) == null)
     {
         throw MessageKeys.AppException(MessageKeys._Appendix_Not_Exist);
     }
 }
示例#13
0
 protected override void Validation()
 {
     //该公告是否存在
     if (DalInstance.BulletinDalInstance.GetBulletinByBulletinID(_BulletinID) == null)
     {
         throw MessageKeys.AppException(MessageKeys._Bulletin_Not_Exist);
     }
 }
示例#14
0
 protected override void Validation()
 {
     //权限验证
     if (!Powers.HasAuth(_LoginUser.Auths, AuthType.SEP, Powers.A503))
     {
         throw MessageKeys.AppException(MessageKeys._NoAuth);
     }
 }
示例#15
0
        public List <Auth> GetAllAuth(Account loginUser)
        {
            if (!Powers.HasAuth(loginUser.Auths, AuthType.SEP, Powers.A103))
            {
                throw MessageKeys.AppException(MessageKeys._NoAuth);
            }

            return(GetAllAuth());
        }
示例#16
0
 protected override void Validation()
 {
     //验证字段:记录存在
     _Bulletin = _BulletinDal.GetBulletinByBulletinID(_BulletinID);
     if (_Bulletin == null)
     {
         throw MessageKeys.AppException(MessageKeys._Bulletin_Not_Exist);
     }
 }
示例#17
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.PositionDalInstance.DeletePosition(_PositionId);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#18
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.GoalDalInstance.UpdateCompanyGoal(_CompanyGoal);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.GoalDalInstance.DeleteTeamGoalBySetHostID(_HostID);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#20
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.GoalDalInstance.InsertPersonalGoal(_PersonalGoal);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#21
0
        protected override void Validation()
        {
            //if(!Powers.HasAuth(_LoginUser.Auths, Powers.A401))
            //    throw MessageKeys.AppException(MessageKeys._NoAuth);

            //该目标是否存在
            if (DalInstance.GoalDalInstance.GetGoalByPKID(_GoalId) == null)
            {
                throw MessageKeys.AppException(MessageKeys._Goal_NotExist);
            }
        }
示例#22
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.GoalDalInstance.DeleteGoalByPKID(_GoalId);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#23
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.PositionDalInstance.InsertPositionNature(_PositionNature);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#24
0
        protected override void Validation()
        {
            if (!Powers.HasAuth(_LoginUser.Auths, AuthType.SEP, Powers.A202))
                throw MessageKeys.AppException(MessageKeys._NoAuth);

            Position position = DalInstance.PositionDalInstance.GetPositionByName(_Position.Name);
            if (position != null)
            {
                throw MessageKeys.AppException(MessageKeys._Position_Name_Repeat);
            }
        }
示例#25
0
        protected override void Validation()
        {
            if (!Powers.HasAuth(_LoginUser.Auths, AuthType.SEP, Powers.A203))
            {
                throw MessageKeys.AppException(MessageKeys._NoAuth);
            }

            //List<Position> positions = DalInstance.PositionDalInstance.GetPositionByGradeId(_PositionGradeId);
            //if (positions != null && positions.Count != 0)
            //    throw MessageKeys.AppException(MessageKeys._PositionGrade_HasPosition);
        }
示例#26
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.BulletinDalInstance.InsertAppendix(_Appendix);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#27
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.AccountGroupDalInstance.Delete(_PKID);
     }
     catch (Exception ex)
     {
         throw MessageKeys.AppException(ex.Message);
     }
 }
示例#28
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.WorkTaskDalInstance.DeleteWorkTaskQA(_WorkTaskQAId);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#29
0
 protected override void ExcuteSelf()
 {
     try
     {
         DalInstance.BulletinDalInstance.DeleteAppendixByPKID(_AppendixID);
     }
     catch
     {
         throw MessageKeys.AppException(MessageKeys._DbError);
     }
 }
示例#30
0
 protected override void Validation()
 {
     if (_PersonalGoal.Account.Id != _LoginUser.Id)
     {
         throw MessageKeys.AppException(MessageKeys._NoAuth);
     }
     //个人目标中同一目标主人ID下标题不能重名
     if (DalInstance.GoalDalInstance.GetPersonalGoalCountByTitle(_PersonalGoal.Account.Id, _PersonalGoal.Title) > 0)
     {
         throw MessageKeys.AppException(MessageKeys._PersonalGoal_Title_Repeat);
     }
 }