Пример #1
0
        /**
         * 異動角色檔
         **/
        public void updateRole(RoleMgrModel roleMgrModel, CODE_ROLE codeRoleO, SqlConnection conn, SqlTransaction transaction)
        {
            try
            {
                CodeRoleDao codeRoleDao = new CodeRoleDao();

                //新增LOG
                Log log = new Log();
                log.CFUNCTION = "角色管理-修改";
                log.CACTION   = "U";
                log.CCONTENT  = codeRoleDao.roleLogContent(codeRoleO);
                LogDao.Insert(log, Session["UserID"].ToString());

                //異動角色檔
                codeRoleO.DATA_STATUS     = "2";
                codeRoleO.LAST_UPDATE_UID = Session["UserID"].ToString();
                codeRoleO.LAST_UPDATE_DT  = DateTime.Now;
                codeRoleO.FREEZE_UID      = Session["UserID"].ToString();
                codeRoleO.FREEZE_DT       = DateTime.Now;

                int cnt = codeRoleDao.Update(codeRoleO, conn, transaction);
            }
            catch (Exception e)
            {
                logger.Error("[updateRole]其它錯誤:" + e.ToString());
                throw e;
                //新增角色檔失敗
                // return Json(new { success = false, errors = e.ToString() }, JsonRequestBehavior.AllowGet);
            }
        }
Пример #2
0
        public JsonResult execReviewR(string aplyNo, string roleId, string apprStatus)
        {
            string strConn = DbUtil.GetDBTreasuryConnStr();

            using (SqlConnection conn = new SqlConnection(strConn))
            {
                conn.Open();
                SqlTransaction transaction = conn.BeginTransaction("Transaction");

                try
                {
                    AuthApprDao AuthApprDao = new AuthApprDao();
                    AUTH_APPR   authAppr    = AuthApprDao.qryByKey(aplyNo);

                    if (StringUtil.toString(authAppr.CREATE_UID).Equals(Session["UserID"].ToString()))
                    {
                        return(Json(new { success = false, errors = "覆核人員與申請人員相同,不可執行覆核作業!!" }, JsonRequestBehavior.AllowGet));
                    }



                    //異動角色資料檔
                    string         cExecType      = "";
                    CodeRoleHisDao codeRoleHisDao = new CodeRoleHisDao();
                    CodeRoleDao    codeRoleDao    = new CodeRoleDao();
                    CODE_ROLE      cODEROLEO      = new CODE_ROLE();

                    CODE_ROLE_HIS codeRoleHis = codeRoleHisDao.qryByAplyNo(aplyNo);
                    string        execAction  = "";
                    if (codeRoleHis != null)
                    {
                        execAction = StringUtil.toString(codeRoleHis.EXEC_ACTION);
                    }

                    if ("A".Equals(execAction))  //新增角色
                    {
                    }
                    else
                    {  //異動角色
                        cODEROLEO = codeRoleDao.qryRoleByKey(roleId);
                    }



                    if ("A".Equals(execAction))
                    {
                        if ("2".Equals(apprStatus))
                        {
                            cODEROLEO.ROLE_ID         = StringUtil.toString(codeRoleHis.ROLE_ID);
                            cODEROLEO.ROLE_NAME       = StringUtil.toString(codeRoleHis.ROLE_NAME);
                            cODEROLEO.ROLE_AUTH_TYPE  = StringUtil.toString(codeRoleHis.ROLE_AUTH_TYPE);
                            cODEROLEO.IS_DISABLED     = codeRoleHis.IS_DISABLED;
                            cODEROLEO.MEMO            = StringUtil.toString(codeRoleHis.MEMO);
                            cODEROLEO.DATA_STATUS     = "1";
                            cODEROLEO.CREATE_UID      = authAppr.CREATE_UID;
                            cODEROLEO.CREATE_DT       = authAppr.CREATE_DT;
                            cODEROLEO.LAST_UPDATE_UID = StringUtil.toString(authAppr.CREATE_UID);
                            cODEROLEO.LAST_UPDATE_DT  = authAppr.CREATE_DT;
                            cODEROLEO.APPR_UID        = Session["UserID"].ToString();
                            cODEROLEO.APPR_DT         = DateTime.Now;

                            int cnt = codeRoleDao.Create(cODEROLEO, conn, transaction);

                            //新增LOG
                            Log log = new Log();
                            log.CFUNCTION = "角色管理-新增";
                            log.CACTION   = "A";
                            log.CCONTENT  = codeRoleDao.roleLogContent(cODEROLEO);
                            LogDao.Insert(log, Session["UserID"].ToString());

                            //20190418 201904160117-00 Bianco 新增稽核軌跡
                            procTrackLog("A", codeRoleDao, cODEROLEO, conn, transaction);
                        }
                    }
                    else
                    {
                        //新增LOG
                        Log log = new Log();
                        log.CFUNCTION = "角色管理-修改";
                        log.CACTION   = "U";
                        log.CCONTENT  = codeRoleDao.roleLogContent(cODEROLEO);
                        LogDao.Insert(log, Session["UserID"].ToString());

                        cODEROLEO.DATA_STATUS     = "1";
                        cODEROLEO.LAST_UPDATE_UID = StringUtil.toString(authAppr.CREATE_UID);
                        cODEROLEO.LAST_UPDATE_DT  = authAppr.CREATE_DT;
                        cODEROLEO.APPR_UID        = Session["UserID"].ToString();
                        cODEROLEO.APPR_DT         = DateTime.Now;
                        cODEROLEO.FREEZE_DT       = null;
                        cODEROLEO.FREEZE_UID      = "";

                        if ("U".Equals(execAction) && "2".Equals(apprStatus))
                        {
                            cODEROLEO.ROLE_NAME   = StringUtil.toString(codeRoleHis.ROLE_NAME);
                            cODEROLEO.IS_DISABLED = codeRoleHis.IS_DISABLED;
                            cODEROLEO.MEMO        = StringUtil.toString(codeRoleHis.MEMO);
                        }


                        int cnt = codeRoleDao.Update(cODEROLEO, conn, transaction);

                        //20190418 201904160117-00 Bianco 修改稽核軌跡
                        procTrackLog("E", codeRoleDao, cODEROLEO, conn, transaction);
                    }


                    //覆核狀態=核可時
                    if ("2".Equals(apprStatus))
                    {
                        procRoleFuncHis(roleId, aplyNo, conn, transaction);  //異動角色功能

                        procRoleEquipHis(roleId, aplyNo, conn, transaction); //異動角色設備功能

                        procRoleItemHis(roleId, aplyNo, conn, transaction);  //異動存取項目、表單申請權限
                    }



                    //異動覆核資料檔
                    procAuthAppr(aplyNo, apprStatus, conn, transaction);

                    transaction.Commit();
                    return(Json(new { success = true }));
                }
                catch (Exception e)
                {
                    transaction.Rollback();
                    logger.Error("[execReviewR]其它錯誤:" + e.ToString());

                    return(Json(new { success = false, errors = "其它錯誤,請洽系統管理員!!" }, JsonRequestBehavior.AllowGet));
                }
            }
        }