当前位置: 首页>>代码示例>>C#>>正文


C# DBOperationsUtil.instertNewRecord方法代码示例

本文整理汇总了C#中DBOperationsUtil.instertNewRecord方法的典型用法代码示例。如果您正苦于以下问题:C# DBOperationsUtil.instertNewRecord方法的具体用法?C# DBOperationsUtil.instertNewRecord怎么用?C# DBOperationsUtil.instertNewRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBOperationsUtil的用法示例。


在下文中一共展示了DBOperationsUtil.instertNewRecord方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: sendInsertPromotionToDb

    private TransactionResponse sendInsertPromotionToDb(string spName, IDictionary<string, object> parameters)
    {
        //Pass Stored Procedure Name and parameter list. 
        DBOperationsUtil storeToDb = new DBOperationsUtil(spName, parameters);

        TransactionResponse response = new TransactionResponse();
        try
        {
            //call store to DB mathod and get reponse. 
            storeToDb.instertNewRecord();
            response.setSuccess(true);
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_PROMOTION_REGISTER_OK);
        }

        catch (SqlException ex) 
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_PROMOTION_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_APP_RATING_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {            
            //Write this exception to file for investigation of the issue later. 
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
开发者ID:jLeta,项目名称:HN_HR_1.0,代码行数:43,代码来源:PromotionManager.cs

示例2: AddHROfficerOrClerk

    /**
     * calls Store to DB utility for the current employee.
     */
    public TransactionResponse AddHROfficerOrClerk(string SPName, string EmpID)
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> paramater = new Dictionary<string, object>();

        paramater.Add("@Emp_ID", EmpID);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(SPName, paramater);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_HR_OFFICER_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
开发者ID:ETH-WORKS-DASHBOARD,项目名称:CBEHR,代码行数:52,代码来源:EmployeeManager.cs

示例3: storeInactiveEmployee

    // Insert Inactive Employeee into DB
    public TransactionResponse storeInactiveEmployee()
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> employeeArgumentaMap = new Dictionary<string, object>();

        employeeArgumentaMap.Add("@EmpID", employee.EmpID);
        employeeArgumentaMap.Add("@FName", employee.FName);
        employeeArgumentaMap.Add("@MName", employee.MName);
        employeeArgumentaMap.Add("@LName", employee.LName);
        employeeArgumentaMap.Add("@Sex", employee.Sex);
        employeeArgumentaMap.Add("@JobTitle", employee.JobTitle);
        employeeArgumentaMap.Add("@branch", employee.Branch);
        employeeArgumentaMap.Add("@dateOfEmp", inactiveEmployee.DateOfEmployment);
        employeeArgumentaMap.Add("@dateOfTerm", inactiveEmployee.DateOfTermination);
        employeeArgumentaMap.Add("@majorCategory", inactiveEmployee.MajorCategory);
        employeeArgumentaMap.Add("@ReasonForleave", inactiveEmployee.ReasonForLeave);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddInactiveEmployee, employeeArgumentaMap);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_INACTIVE_EMPLOYEE_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

           //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR);
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setSuccess(false);
            return response;
        }
        return response;
    }
开发者ID:ETH-WORKS-DASHBOARD,项目名称:CBEHR,代码行数:63,代码来源:EmployeeManager.cs

示例4: storeEmployeeremark

    /**
     * Add employee remark
    */
    public TransactionResponse storeEmployeeremark(MembershipUser currentUser)
    {
        //get detail of the logged on user.
        Employee employee = EmployeeManager.getLoggedOnUser((Guid)currentUser.ProviderUserKey);
        if (employee == null)
        {
            return EmployeeManager.handleLoggedInUserCanNotBeIdentfied();
        }

        //Add List of Arguments for new employee
        IDictionary<string, object> employeeRemarkMap = new Dictionary<string, object>();

        employeeRemarkMap.Add("@EmpID", employeeRemark.EmployeeID);
        employeeRemarkMap.Add("@remarkRefNo", employeeRemark.RemarkReferanceNo);
        employeeRemarkMap.Add("@dateOfRemark", employeeRemark.DateOfRemark);
        employeeRemarkMap.Add("@remarkType", employeeRemark.RemarkType);
        employeeRemarkMap.Add("@penalityPerc", employeeRemark.PenaltyPerc);
        employeeRemarkMap.Add("@managerID", employeeRemark.ManagerID);
        employeeRemarkMap.Add("@managerPosition", employeeRemark.ManagerPosition);
        employeeRemarkMap.Add("@remarkReason", employeeRemark.RemarkReason);
        employeeRemarkMap.Add("@responsiblehrOfficerID", employee.EmpID);
        employeeRemarkMap.Add("@Branch", employeeRemark.Branch);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddEmployeeRemark, employeeRemarkMap);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_REMARK_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_REF_NO_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
开发者ID:ETH-WORKS-DASHBOARD,项目名称:CBEHR,代码行数:68,代码来源:EmployeeManager.cs

示例5: storeEmployeefromOtherDistrictForPromotion

    /**
     * Add promoted employee from other district
    */
    public TransactionResponse storeEmployeefromOtherDistrictForPromotion(string minNumber, string districtID)
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> employeeArgumentaMap = new Dictionary<string, object>();

        employeeArgumentaMap.Add("@Minute_No", minNumber);
        employeeArgumentaMap.Add("@Emp_ID", employee.EmpID);
        employeeArgumentaMap.Add("@First_Name", employee.FName);
        employeeArgumentaMap.Add("@Middle_Name", employee.MName);
        employeeArgumentaMap.Add("@Last_Name", employee.LName);
        employeeArgumentaMap.Add("@Curr_Jtitle", employee.PrevJob);
        employeeArgumentaMap.Add("@Curr_JGrade", employee.PrevJobGrade);
        employeeArgumentaMap.Add("@Exp_JGrade", employee.JobGrade);
        employeeArgumentaMap.Add("@Salary", employee.Salary);
        employeeArgumentaMap.Add("@district", districtID);
        employeeArgumentaMap.Add("@status", "Active");

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddPromotedEmployeefromOtherDistrict, employeeArgumentaMap);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
开发者ID:ETH-WORKS-DASHBOARD,项目名称:CBEHR,代码行数:62,代码来源:EmployeeManager.cs

示例6: storeEmployee

    /**
     * calls Store to DB utility for the current employee.
     */
    public TransactionResponse storeEmployee()
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> employeeArgumentaMap = new Dictionary<string, object>();

        employeeArgumentaMap.Add("@Emp_ID", employee.EmpID);
        employeeArgumentaMap.Add("@UserId", employee.UserID);
        employeeArgumentaMap.Add("@First_Name", employee.FName);
        employeeArgumentaMap.Add("@Middle_Name", employee.MName);
        employeeArgumentaMap.Add("@Last_Name", employee.LName);
        employeeArgumentaMap.Add("@Sex", employee.Sex);
        employeeArgumentaMap.Add("@Prev_Job_Tittle", employee.PrevJob);
        employeeArgumentaMap.Add("@Job_Tittle", employee.JobTitle);
        employeeArgumentaMap.Add("@Grade", employee.JobGrade);
        employeeArgumentaMap.Add("@Salary", employee.Salary);
        employeeArgumentaMap.Add("@branch", employee.Branch);
        DateTime HDatefinal = DateTime.ParseExact(employee.Hdate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
        employeeArgumentaMap.Add("@HDate", HDatefinal);
        employeeArgumentaMap.Add("@MajorCategory", employee.MajorCategory);
        employeeArgumentaMap.Add("@district", employee.District);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddNewEmployee, employeeArgumentaMap);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
开发者ID:ETH-WORKS-DASHBOARD,项目名称:CBEHR,代码行数:66,代码来源:EmployeeManager.cs

示例7: addNewVacancy

    public TransactionResponse addNewVacancy()
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> vacancyParameters = new Dictionary<string, object>();

        vacancyParameters.Add("@vacancy_No", vacancy.VacancyNo);
        vacancyParameters.Add("@Vancay_title", vacancy.VancayTitle);
        vacancyParameters.Add("@branch_id", vacancy.BranchId);
        vacancyParameters.Add("@vancy_deadline", vacancy.VancyDeadline);
        vacancyParameters.Add("@vacancy_for_JobGrade", vacancy.VacancyforJobGrade);
        vacancyParameters.Add("@vacancy_opened_for", vacancy.VacancyOpenedFor);
        vacancyParameters.Add("@vacancy_evaluation_form", vacancy.VacancyEvaluationForm);
        vacancyParameters.Add("@year_gen_required", vacancy.YearRequiredforGeneral);
        vacancyParameters.Add("@year_spec_required", vacancy.YearRequiredforSpec);
        vacancyParameters.Add("@general_wrk_expr_percent", vacancy.GeneralWrkExprPercent);
        vacancyParameters.Add("@specific_wrk_expr_percent", vacancy.SpecificWrkExprPercent);
        vacancyParameters.Add("@related_wrk_expr_percent", vacancy.RelatedWrkExprPercent);
        vacancyParameters.Add("@examination_percent", vacancy.ExaminationPercent);
        vacancyParameters.Add("@manager_Recom_percent", vacancy.ManagerRecPercent);
        vacancyParameters.Add("@interview_percent", vacancy.InterviewPercent);
        vacancyParameters.Add("@JobDescription", vacancy.JobDescription);
        vacancyParameters.Add("@JobRequirement", vacancy.JobRequirement);
        vacancyParameters.Add("@JobBenefit", vacancy.SalaryAndBenefit);
        vacancyParameters.Add("@districtId", PageAccessManager.getDistrictID());

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddNewVacancy, vacancyParameters);

        TransactionResponse response = new TransactionResponse();
        try
        {
            //call store to DB mathod and get reponse.
            storeToDb.instertNewRecord();
            response.setSuccess(true);
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_VACANCY_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_VACANCY_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_VACANCY_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
开发者ID:ETH-WORKS-DASHBOARD,项目名称:CBEHR,代码行数:66,代码来源:VacancyRegistrationAndEvaluationManager.cs

示例8: AddEmployeeInTrainingRoom

    /**
     * Add Employee into training room
     */
    public TransactionResponse AddEmployeeInTrainingRoom(string EmpID, string dueDate, string startDate, string endDate, string trainID)
    {
        //create parameters map to pass
        IDictionary<string, object> argumentsMap = new Dictionary<string, object>();
        argumentsMap.Add("@Emp_ID", EmpID);
        argumentsMap.Add("@Training_ID", trainID);
        argumentsMap.Add("@DueDate", dueDate);
        argumentsMap.Add("@StartDate", startDate);
        argumentsMap.Add("@EndDate", endDate);
        
        //Pass Stored Procedure Name and parameter list. 
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddEmployeeIntoTrainingRoom, argumentsMap);

        //call sote to DB method. 
        //bool response = storeToDb.instertNewRecord();

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse. 
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_TRANSACTION_SUCCESS);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setSuccess(false);
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setSuccess(false);
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later. 
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
开发者ID:jLeta,项目名称:HN_HR_1.0,代码行数:60,代码来源:EmployeeManager.cs

示例9: addNewNotification

    private TransactionResponse addNewNotification()
    {
        IDictionary<string, object> notificationParams = new Dictionary<string, object>();
        notificationParams.Add("@taskReference", notification.TaskRreference);
        notificationParams.Add("@receiverEmpId", notification.Receiver);
        notificationParams.Add("@senderEmpId", notification.Sender);
        notificationParams.Add("@notificationIsFor", notification.NotificationIsFor);
        notificationParams.Add("@registeredDate", notification.RegisteredDate);
        notificationParams.Add("@disctrictId", PageAccessManager.getDistrictID());

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            //Pass Stored Procedure Name and parameter list.
            DBOperationsUtil dbOperation = new DBOperationsUtil(DbAccessConstants.spGetAddNewNotification, notificationParams);
            dbOperation.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_NOTIF_REGISTER_OK);
            response.setSuccess(true);
        }
        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_NOTIF_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_NOTIFY_REGISTERED_PROMOTION_FAILED);
                response.setErrorCode(DBOperationErrorConstants.E_PROMOTION_NOTIFICATION_FAILED);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
开发者ID:ETH-WORKS-DASHBOARD,项目名称:CBEHR,代码行数:50,代码来源:NotificationManager.cs


注:本文中的DBOperationsUtil.instertNewRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。