示例#1
0
        /// <summary>
        /// 新增員工資料
        /// </summary>
        public bool InsertEmployeeData(AccountParams param)
        {
            InsertResult insResult = new InsertResult()
            {
                IsSuccess = false
            };

            using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
            {
                insResult = empAuthDao.Insert <Employee>(new Employee()
                {
                    EmpAccount            = param.EmpAccount,
                    EmpPassword           = param.EmpPassword,
                    EmpName               = param.EmpName,
                    Email                 = param.Email,
                    Remarks               = param.Remarks,
                    DeptId                = param.DeptId,
                    RoleId                = param.RoleId,
                    IsAccessDenied        = param.IsAccessDenied,
                    StartDate             = param.StartDate,
                    EndDate               = param.EndDate,
                    OwnerAccount          = param.OwnerAccount,
                    PasswordHashed        = param.PasswordHashed,
                    DefaultRandomPassword = param.DefaultRandomPassword,
                    PostAccount           = param.PostAccount,
                    PostDate              = DateTime.Now
                });

                dbErrMsg = empAuthDao.GetErrMsg();

                if (insResult.IsSuccess)
                {
                    param.EmpId = (int)insResult.NewId;
                }
                else if (empAuthDao.GetSqlErrNumber() == 2601)
                {
                    param.HasAccountBeenUsed = true;
                }
            }

            return(insResult.IsSuccess);
        }
示例#2
0
        /// <summary>
        /// 新增後端作業選項
        /// </summary>
        public bool InsertOperationData(OpParams param)
        {
            InsertResult insResult = new InsertResult()
            {
                IsSuccess = false
            };

            using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
            {
                int?objParentId = null;

                if (param.ParentId != 0)
                {
                    objParentId = param.ParentId;
                }

                Operations entity = new Operations()
                {
                    ParentId       = objParentId,
                    OpSubject      = param.OpSubject,
                    LinkUrl        = param.LinkUrl,
                    IsNewWindow    = param.IsNewWindow,
                    IconImageFile  = param.IconImageFile,
                    SortNo         = param.SortNo,
                    IsHideSelf     = param.IsHideSelf,
                    CommonClass    = param.CommonClass,
                    EnglishSubject = param.EnglishSubject,
                    PostAccount    = param.PostAccount,
                    PostDate       = DateTime.Now
                };

                insResult = empAuthDao.Insert <Operations>(entity);
                dbErrMsg  = empAuthDao.GetErrMsg();

                if (insResult.IsSuccess)
                {
                    param.OpId = (int)insResult.NewId;
                }
            }

            return(insResult.IsSuccess);
        }
示例#3
0
        /// <summary>
        /// 新增後端操作記錄
        /// </summary>
        public bool InsertBackEndLogData(BackEndLogData data)
        {
            InsertResult insResult = new InsertResult()
            {
                IsSuccess = false
            };

            using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
            {
                insResult = empAuthDao.Insert <BackEndLog>(new BackEndLog()
                {
                    EmpAccount  = data.EmpAccount,
                    Description = data.Description,
                    IP          = data.IP,
                    OpDate      = DateTime.Now
                });

                dbErrMsg = empAuthDao.GetErrMsg();
            }

            return(insResult.IsSuccess);
        }