Example #1
0
        /// <summary>
        /// Line Item Input Validation
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public IDPProxyResponse ValidationLineItem(LineItem input)
        {
            IDPProxyResponse message = null;

            Regex junk_Chars = new Regex(@"[\\\~!@#$%^*()_+{}|""?`;',/[\]]+");

            //Line Item Validation
            if (string.IsNullOrEmpty(input.dataSource) | junk_Chars.IsMatch(input.dataSource))
            {
                message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.dataSource);
            }
            else if (!(input.dataSource.Equals(Constant.PAS) | input.dataSource.Equals(Constant.SIS) | input.dataSource.Equals(Constant.HDES) | input.dataSource.Equals(Constant.ADES) | input.dataSource.Equals(Constant.HUON) | input.dataSource.Equals(Constant.PUPSYS) | input.dataSource.Equals(Constant.HLSYS)))
            {
                message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.dataSource);
            }
            else if (string.IsNullOrEmpty(input.writingCompany) | junk_Chars.IsMatch(input.writingCompany))
            {
                message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.writingCompany);
            }
            else if (!(input.writingCompany.Equals(Constant.writingcompany_CSIIB) | (input.writingCompany.Equals(Constant.writingcompany_4WUIC)) | (input.writingCompany.Equals(Constant.writingcompany_1MWIC))))
            {
                message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.writingCompany);
            }
            else if (string.IsNullOrEmpty(input.productCode) | junk_Chars.IsMatch(input.productCode))
            {
                message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.productCode);
            }
            else if (!(input.productCode.Equals(Constant.ProductCode_PA) | input.productCode.Equals(Constant.ProductCode_HO) | input.productCode.Equals(Constant.ProductCode_HL) | input.productCode.Equals(Constant.ProductCode_PU) | input.productCode.Equals(Constant.ProductCode_DF) | input.productCode.Equals(Constant.ProductCode_MC) | input.productCode.Equals(Constant.ProductCode_WC) | input.productCode.Equals(Constant.ProductCode_IM)))
            {
                message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.productCode);
            }

            else if (!string.IsNullOrEmpty(input.policyPrefix))
            {
                if (junk_Chars.IsMatch(input.policyPrefix))
                {
                    message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.policyPrefix);
                }
            }
            else if (string.IsNullOrEmpty(input.policyNumber) | junk_Chars.IsMatch(input.policyNumber))
            {
                message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.policyNumber);
            }
            else if (!string.IsNullOrEmpty(input.policyState))
            {
                if (junk_Chars.IsMatch(input.policyState))
                {
                    message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.policyState);
                }
            }
            else if (string.IsNullOrEmpty(input.Amount.ToString()) | junk_Chars.IsMatch(input.Amount.ToString()))
            {
                message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.Amount);
            }
            else if (!string.IsNullOrEmpty(input.revenueType))
            {
                if (junk_Chars.IsMatch(input.revenueType))
                {
                    message = new IDPProxyResponse(Constant.RESPONSE_FAILURE, Constant.ERR_VALIDATION + Constant.revenueType);
                }
            }
            else
            {
                message = new IDPProxyResponse(Constant.RESPONSE_SUCCESS, "");
            }


            return(message);
        }
Example #2
0
        /// <summary>
        /// Method to insert the items based on line items
        /// </summary>
        /// <param name="input"></param>
        /// <param name="paymentid"></param>
        /// <param name="checknumber"></param>
        /// <param name="paymentMethod"></param>
        /// <returns></returns>

        public string InsertItem(LineItem input, string paymentid, string checknumber, string paymentMethod, int lineItemCount)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(connstring))
                {
                    if (input.revenueType == null)
                    {
                        input.revenueType = string.Empty;
                    }
                    if (input.policyState == null)
                    {
                        input.policyState = string.Empty;
                    }
                    if (input.policyPrefix == null)
                    {
                        input.policyPrefix = string.Empty;
                    }
                    if (checknumber == null)
                    {
                        checknumber = string.Empty;
                    }

                    conn.Open();
                    SqlCommand comm = new SqlCommand();
                    comm.Connection  = conn;
                    comm.CommandType = System.Data.CommandType.StoredProcedure;
                    comm.CommandText = Constant.SP_INSERT_ITEM;

                    comm.Parameters.AddWithValue("@PaymentId", paymentid);
                    comm.Parameters.AddWithValue("@LineItemNo", lineItemCount);
                    comm.Parameters.AddWithValue("@productCode", input.productCode);
                    comm.Parameters.AddWithValue("@Amount", input.Amount);
                    comm.Parameters.AddWithValue("@lastName", "");
                    comm.Parameters.AddWithValue("@firstName", "");
                    comm.Parameters.AddWithValue("@policyNumber", input.policyNumber);
                    comm.Parameters.AddWithValue("@revenueType", input.revenueType);
                    comm.Parameters.AddWithValue("@policyState", input.policyState);
                    comm.Parameters.AddWithValue("@policyPrefix", input.policyPrefix);
                    comm.Parameters.AddWithValue("@companyID", input.writingCompany);
                    comm.Parameters.AddWithValue("@checkNumber", checknumber);
                    //MAIG - CH2 - BEGIN - Added the below code to support the newly added mailing Zip parameter
                    comm.Parameters.AddWithValue("@mailingZip", "");
                    //MAIG - CH2 - END - Added the below code to support the newly added mailing Zip parameter
                    comm.Parameters.AddWithValue("@paymentTypeID", paymentMethod);

                    string result = (comm.ExecuteNonQuery()).ToString();
                    return(result);
                }
            }
            catch (FaultException ex)
            {
                log.WriteLog(ex.Message.ToString());
            }
            catch (CommunicationException exp)
            {
                log.WriteLog(exp.Message.ToString());
            }
            catch (Exception e)
            {
                string Error = e.Message.ToString() + e.StackTrace.ToString();
                log.WriteLog(Error.ToString());
                return(Error);
            }
            return(string.Empty);
        }