Example #1
0
        public void AuthorizateUser(string name, string password)
        {
            try
            {
                _logger.Debug("AuthorizateUser.");
                if (string.IsNullOrEmpty(name))
                {
                    throw new ArgumentNullException("Name param can not be null.");
                }
                if (string.IsNullOrEmpty(password))
                {
                    throw new ArgumentNullException("Password param can not be null.");
                }
                _logger.Debug("Params: name = {0};", name);

                OraCommand command = new OraCommand("MAIN_PKG.CONNECT_TO_DB");
                command.CommandType = CommandType.StoredProcedure;

                OraParamInt32 returnParam = new OraParamInt32("return", ParameterDirection.ReturnValue, null);
                command.AddDBParam(returnParam);
                command.AddDBParam(new OraParamString("p_userName", ParameterDirection.Input, name));
                command.AddDBParam(new OraParamString("p_password", ParameterDirection.Input, password));

                Execute(command);
            }
            catch (Exception ex)
            {
                throw new AuthorizateExceptions(ex);
            }
        }
Example #2
0
        public string InsRequest(RequestEntity request)
        {
            _logger.Debug("InsRequest.");
            if (request == null)
            {
                throw new ArgumentNullException("Request param can not be null.");
            }
            _logger.Debug("Params: request = {0};", request.ToInternalString());

            OraCommand command = new OraCommand("REQ_PKG.INS_REQ");

            command.CommandType = CommandType.StoredProcedure;
            OraParamInt32 returnParam = new OraParamInt32("return", ParameterDirection.ReturnValue, null);

            command.AddDBParam(returnParam);
            command.AddDBParam(new OraParamDateTime("p_req_date", ParameterDirection.Input, request.ReqDateTime));
            command.AddDBParam(new OraParamString("p_subject", ParameterDirection.Input, request.Subject));
            command.AddDBParam(new OraParamString("p_note", ParameterDirection.Input, request.Comments));
            command.AddDBParam(new OraParamInt32("p_orig_id", ParameterDirection.Input, request.Organization.NumId));
            command.AddDBParam(new OraParamString("p_contact", ParameterDirection.Input, request.Contact));
            command.AddDBParam(new OraParamInt32("p_req_type", ParameterDirection.Input, request.InfoSourceTypeId));
            command.AddDBParam(new OraParamInt32("p_comp_id", ParameterDirection.Input, request.Application.NumId));
            command.AddDBParam(new OraParamInt32("p_resp_id", ParameterDirection.Input, request.ResponseUser.NumId));
            command.AddDBParam(new OraParamInt32("p_req_state", ParameterDirection.Input, request.StateId));
            command.AddDBParam(new OraParamString("p_bug_num", ParameterDirection.Input, request.BugNumber));
            command.AddDBParam(new OraParamInt32("p_CM_num", ParameterDirection.Input, string.IsNullOrEmpty(request.CMVersion)? (int?)null : Convert.ToInt32(request.CMVersion)));
            command.AddDBParam(new OraParamString("p_ver_num", ParameterDirection.Input, request.ComponentVersion));
            command.AddDBParam(new OraParamString("p_important", ParameterDirection.Input, request.IsImportantString));
            OraParamDateTime createDateParam = new OraParamDateTime("p_create_date_out", ParameterDirection.Output, null);

            command.AddDBParam(createDateParam);

            Execute(command);

            request.CreateDateTime = createDateParam.ParamValue.Value;
            request.Id             = returnParam.ParamValue.Value.ToString();
            return(request.Id);
        }