public OperationsStatus AddProductToCart(ShoppingCart cartObj)
        {
            OperationsStatus operationsStatusObj = new OperationsStatus();

            try
            {
                SqlParameter statusCode = null;
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[InsertShoppingCart]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value             = cartObj.ProductID;
                        cmd.Parameters.Add("@CustomerID", SqlDbType.Int).Value            = cartObj.CustomerID;
                        cmd.Parameters.Add("@ItemID", SqlDbType.Int).Value                = cartObj.ItemID;
                        cmd.Parameters.Add("@ProductSpecXML", SqlDbType.Xml).Value        = _attributesRepository.GetAttributeXML(cartObj.AttributeValues);
                        cmd.Parameters.Add("@Qty", SqlDbType.Int).Value                   = cartObj.Qty;
                        cmd.Parameters.Add("@CurrencyCode", SqlDbType.NVarChar, 3).Value  = cartObj.CurrencyCode;
                        cmd.Parameters.Add("@CurrencyRate", SqlDbType.Decimal).Value      = cartObj.CurrencyRate;
                        cmd.Parameters.Add("@Price", SqlDbType.Decimal).Value             = cartObj.Price;
                        cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value   = cartObj.logDetails.CreatedBy;
                        cmd.Parameters.Add("@CreatedDate", SqlDbType.SmallDateTime).Value = cartObj.logDetails.CreatedDate;
                        statusCode           = cmd.Parameters.Add("@StatusOut", SqlDbType.SmallInt);
                        statusCode.Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        switch (statusCode.Value.ToString())
                        {
                        case "0":
                            operationsStatusObj.StatusCode    = Int16.Parse(statusCode.Value.ToString());
                            operationsStatusObj.StatusMessage = constObj.InsertFailure;
                            break;

                        case "1":
                            operationsStatusObj.StatusCode    = Int16.Parse(statusCode.Value.ToString());
                            operationsStatusObj.StatusMessage = constObj.InsertSuccess;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(operationsStatusObj);
        }
        public OperationsStatus InsertBookings(Bookings bookingsObj)
        {
            OperationsStatus operationsStatusObj = new OperationsStatus();

            try
            {
                SqlParameter statusCode = null;
                using (SqlConnection con = _databaseFactory.GetDBConnection())
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        if (con.State == ConnectionState.Closed)
                        {
                            con.Open();
                        }
                        cmd.Connection  = con;
                        cmd.CommandText = "[InsertBookings]";
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value              = bookingsObj.ProductID;
                        cmd.Parameters.Add("@CustomerID", SqlDbType.Int).Value             = bookingsObj.CustomerID;
                        cmd.Parameters.Add("@RequiredDate", SqlDbType.SmallDateTime).Value = bookingsObj.RequiredDate;
                        cmd.Parameters.Add("@SourceIP", SqlDbType.NVarChar, 50).Value      = bookingsObj.SourceIP;
                        cmd.Parameters.Add("@Qty", SqlDbType.Int).Value                   = bookingsObj.Qty;
                        cmd.Parameters.Add("@Price", SqlDbType.Decimal).Value             = bookingsObj.Price;
                        cmd.Parameters.Add("@AdditionalCharges", SqlDbType.Decimal).Value = bookingsObj.AdditionalCharges;
                        cmd.Parameters.Add("@TaxAmt", SqlDbType.Decimal).Value            = bookingsObj.TaxAmt;
                        cmd.Parameters.Add("@DiscountAmt", SqlDbType.Decimal).Value       = bookingsObj.DiscountAmt;
                        cmd.Parameters.Add("@Message", SqlDbType.NVarChar, -1).Value      = bookingsObj.Message;
                        cmd.Parameters.Add("@ProductSpecXML", SqlDbType.Xml).Value        = _attributesRepository.GetAttributeXML(bookingsObj.AttributeValues);

                        cmd.Parameters.Add("@CustomerAddressID", SqlDbType.Int).Value           = bookingsObj.CustomerAddress.ID;
                        cmd.Parameters.Add("@BillLocation", SqlDbType.Int).Value                = bookingsObj.CustomerAddress.LocationID;
                        cmd.Parameters.Add("@BillPrefix", SqlDbType.NVarChar, 100).Value        = bookingsObj.CustomerAddress.Prefix;
                        cmd.Parameters.Add("@BillFirstName", SqlDbType.NVarChar, 100).Value     = bookingsObj.CustomerAddress.FirstName;
                        cmd.Parameters.Add("@BillMidName", SqlDbType.NVarChar, 100).Value       = bookingsObj.CustomerAddress.MidName;
                        cmd.Parameters.Add("@BillLastName", SqlDbType.NVarChar, 100).Value      = bookingsObj.CustomerAddress.LastName;
                        cmd.Parameters.Add("@BillAddress", SqlDbType.NVarChar, 100).Value       = bookingsObj.CustomerAddress.Address;
                        cmd.Parameters.Add("@BillCity", SqlDbType.NVarChar, 100).Value          = bookingsObj.CustomerAddress.City;
                        cmd.Parameters.Add("@BillCountryCode", SqlDbType.NVarChar, 3).Value     = bookingsObj.CustomerAddress.CountryCode;
                        cmd.Parameters.Add("@BillStateProvince", SqlDbType.NVarChar, 100).Value = bookingsObj.CustomerAddress.StateProvince;
                        cmd.Parameters.Add("@BillContactNo", SqlDbType.NVarChar, 20).Value      = bookingsObj.CustomerAddress.ContactNo;

                        cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value   = bookingsObj.logDetails.CreatedBy;
                        cmd.Parameters.Add("@CreatedDate", SqlDbType.SmallDateTime).Value = bookingsObj.logDetails.CreatedDate;
                        statusCode           = cmd.Parameters.Add("@StatusOut", SqlDbType.SmallInt);
                        statusCode.Direction = ParameterDirection.Output;
                        cmd.ExecuteNonQuery();

                        switch (statusCode.Value.ToString())
                        {
                        case "0":
                            operationsStatusObj.StatusCode    = Int16.Parse(statusCode.Value.ToString());
                            operationsStatusObj.StatusMessage = constObj.InsertFailure;
                            break;

                        case "1":
                            operationsStatusObj.StatusCode    = Int16.Parse(statusCode.Value.ToString());
                            operationsStatusObj.StatusMessage = constObj.InsertSuccess;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(operationsStatusObj);
        }